[go: nahoru, domu]

CN106375837B - A kind of advertisement cut-in method and device - Google Patents

A kind of advertisement cut-in method and device Download PDF

Info

Publication number
CN106375837B
CN106375837B CN201611002602.6A CN201611002602A CN106375837B CN 106375837 B CN106375837 B CN 106375837B CN 201611002602 A CN201611002602 A CN 201611002602A CN 106375837 B CN106375837 B CN 106375837B
Authority
CN
China
Prior art keywords
advertisement
video
thread
data
audio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611002602.6A
Other languages
Chinese (zh)
Other versions
CN106375837A (en
Inventor
宋明胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201611002602.6A priority Critical patent/CN106375837B/en
Publication of CN106375837A publication Critical patent/CN106375837A/en
Priority to PCT/CN2017/079592 priority patent/WO2018086303A1/en
Application granted granted Critical
Publication of CN106375837B publication Critical patent/CN106375837B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4333Processing operations in response to a pause request
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/458Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/812Monomedia components thereof involving advertisement data

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention provides a kind of advertisement cut-in method and device, it is related to multimedia play technology field.This method includes:By media load thread cache positive media data and by play thread play during, when receiving advertisement insertion instruction, suspend and load the follow-up data of thread acquisition positive media data by media and make broadcasting thread continue to play buffered positive media data;Thread acquisition and the corresponding advertising media data of advertisement insertion instruction are loaded by media, advertisement audio sample and advertisement video frame are obtained to advertising media data decoding by decoding thread;After the buffered positive media data of broadcasting thread broadcasting terminates, broadcasting thread is set to play advertisement audio sample and advertisement video frame.Be not in loading delay and blank screen in commercial breaks in the present invention, while avoiding the occurrence of extra consumption server resource and not smooth video positive broadcasting.

Description

A kind of advertisement cut-in method and device
Technical field
The present invention relates to multimedia play technology field, in particular to a kind of advertisement cut-in method and device.
Background technology
With the fast development of Internet technology, increasing user starts to watch video online, and Online Video is obtained It is widely applied, for the purpose of profit, it is necessary to insert video ads during video positive is played.But, inserting When entering video ads, need to switch between video positive and video ads, but easily video occur when switching over The problem of loading delay and blank screen.
The problem of in order to be produced when solving and switching between video positive and video ads, a kind of method of the prior art is Video ads and video positive are recompiled and are merged into a video, are played out according still further to common mode, but in solution Code and substantial amounts of server resource can be consumed during recompiling, cause the waste of server resource;Another way, then It is to preload video ads while video positive is played, until needing to intercut video ads, then is switched to video ads Play out, still, limited bandwidth resources can be consumed by preloading video ads, be easily caused video positive and play not smooth.
The content of the invention
In view of this, the purpose of the embodiment of the present invention is to provide a kind of advertisement cut-in method and device, to attempt to solve Or alleviate above-mentioned produced problem.
In a first aspect, the embodiments of the invention provide a kind of advertisement cut-in method, wherein, methods described includes:
It is wide when receiving during loading thread cache positive media data by media and being played by playing thread When announcement intercuts instruction, pause loads the follow-up data of the thread acquisition positive media data by the media and made described Thread is played to continue to play the buffered positive media data;
Thread acquisition and the corresponding advertising media data of advertisement insertion instruction are loaded by the media, passes through decoding Thread obtains advertisement audio sample and advertisement video frame to advertising media data decoding;
After the buffered positive media data of the broadcasting thread broadcasting terminates, play the broadcasting thread The advertisement audio sample and the advertisement video frame.
With reference in a first aspect, the embodiments of the invention provide the possible implementation of the first of above-mentioned first aspect, its In, it is described that advertisement audio sample and advertisement video frame are obtained to advertising media data decoding by decoding thread, including:
The advertisement packets of audio data in the advertising media data is decoded by audio decoder thread, obtains described Advertisement audio sample;
Thread is decoded by video to decode the advertisement video data bag in the advertising media data, obtains described Advertisement video frame.
With reference in a first aspect, the embodiments of the invention provide the possible implementation of second of above-mentioned first aspect, its In, it is described the broadcasting thread is played the advertisement audio sample and the advertisement video frame, including:
Audio is played thread and play the advertisement audio sample, the video playback thread is played the advertisement video Frame.
With reference in a first aspect, the embodiments of the invention provide the possible implementation of the third of above-mentioned first aspect, its In, it is described to load thread acquisition with before the corresponding advertising media data of advertisement insertion instruction, also wrapping by the media Include:
Thread is loaded by the media and opens advertising media's stream corresponding with advertisement insertion instruction, and is parsed described The header byte of advertising media's stream, judges the Format Type of advertising media's stream;
The Format Type parsing audio decoder configuration parameter and Video Decoder configuration ginseng flowed according to the advertising media Number.
With reference to the third possible implementation of first aspect, the embodiments of the invention provide the of above-mentioned first aspect Four kinds of possible implementations, wherein, the excessively described media loading thread obtains corresponding with advertisement insertion instruction wide After announcement media data, in addition to:
Advertisement packets of audio data and advertisement video data bag are parsed from the advertising media data, and mark is parsed First advertisement packets of audio data and first advertisement video data bag.
With reference to the 4th kind of possible implementation of first aspect, the embodiments of the invention provide the of above-mentioned first aspect Five kinds of possible implementations, wherein, it is described to mark the first advertisement packets of audio data and first advertisement video data parsed Bag, including:
The attribute of the first advertisement packets of audio data and the tag field of the first advertisement video data bag is set It is true;
Audio decoder configuration parameter is inserted in the first advertisement packets of audio data, in the first advertisement video number According to insertion Video Decoder configuration parameter in bag.
With reference to the 4th kind of possible implementation of first aspect, the embodiments of the invention provide the of above-mentioned first aspect Six kinds of possible implementations, wherein, it is described that advertising media data decoding is obtained by advertisement audio adopted by decoding thread Sample and advertisement video frame, including:
Whether be first packets of audio data, described wide if judging the advertisement packets of audio data in presently described advertising media data Accuse whether video data bag is first video data bag;
When it is determined that the advertisement packets of audio data is the first advertisement packets of audio data, the advertisement video data bag is During the first advertisement video data bag, the audio decoder configuration parameter in the first advertisement packets of audio data is to sound Frequency decoder is initialized, and the Video Decoder configuration parameter in the first advertisement video data bag is decoded to video Device is initialized;
The advertisement packets of audio data is decoded according to the audio decoder after initialization, the advertisement audio is obtained Sampling, decodes to the advertisement video data bag according to the Video Decoder after initialization, obtains the advertisement video frame.
With reference in a first aspect, the embodiments of the invention provide the possible implementation of the 7th of above-mentioned first aspect kind, its In, after the positive media data buffered in the broadcasting thread broadcasting terminates, play the broadcasting thread The advertisement audio sample and the advertisement video frame, including:
The configuration parameter of Current ad audio sample and the configuration parameter of previous audio sample, and Current ad are regarded The configuration parameter of frequency frame and the configuration parameter of previous frame of video are compared, and the configuration parameter of the audio sample includes institute Sampling resolution, sample rate and the port number of audio sample are stated, the configuration parameter of the frame of video includes the color of frame of video, form It is high with width;
When it is determined that the configuration parameter of configuration parameter and the previous audio sample of the Current ad audio sample, , will be described current when the configuration parameter of the Current ad frame of video and the different configuration parameter of the previous frame of video The configuration parameter of advertisement audio sample and the configuration parameter of the Current ad frame of video reset output, and export described current wide Accuse audio sample and advertisement video frame.
With reference in a first aspect, the embodiments of the invention provide the possible implementation of the 8th of above-mentioned first aspect kind, its In, methods described also includes:
When receive exit play instruction after, exit the positive media data or advertising media's number being currently played According to.
Second aspect, the embodiments of the invention provide a kind of advertisement insertion device, wherein, described device includes:
Load-on module, for loading thread cache positive media data by media;And, for being referred to according to advertisement insertion Order pause loads the follow-up data that thread obtains the positive media data by the media, and obtains and the advertisement insertion Instruct corresponding advertising media data;
Decoder module, for obtaining advertisement audio sample and advertisement to advertising media data decoding by decoding thread Frame of video;
Playing module, for playing the positive media data that the media load thread cache by playing thread;And, For after the buffered positive media data of the broadcasting thread broadcasting terminates, making the broadcasting thread play described Advertisement audio sample and the advertisement video frame.
Advertisement cut-in method and device provided in an embodiment of the present invention, are not in loading delay and black when breaking for commercialsy Screen, while avoiding the occurrence of extra consumption server resource and not smooth video positive broadcasting.
To enable the above objects, features and advantages of the present invention to become apparent, preferred embodiment cited below particularly, and coordinate Appended accompanying drawing, is described in detail below.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be attached to what is used required in embodiment Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore is not construed as pair The restriction of scope, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to this A little accompanying drawings obtain other related accompanying drawings.
Fig. 1 shows a kind of flow chart for advertisement cut-in method that the embodiment of the present invention 1 is provided;
Fig. 2 shows being decoded to advertising media data in a kind of advertisement cut-in method that the embodiment of the present invention 1 is provided Flow chart;
Fig. 3, which is shown, plays advertisement audio sample and wide in a kind of advertisement cut-in method that the embodiment of the present invention 1 is provided Accuse the flow chart of frame of video;
Fig. 4 shows a kind of structural representation for advertisement insertion device that the embodiment of the present invention 2 is provided.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention Middle accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only It is a part of embodiment of the invention, rather than whole embodiments.The present invention being generally described and illustrated herein in the accompanying drawings is real Applying the component of example can be arranged and be designed with a variety of configurations.Therefore, it is of the invention to what is provided in the accompanying drawings below The detailed description of embodiment is not intended to limit the scope of claimed invention, but is merely representative of the selected reality of the present invention Apply example.Based on embodiments of the invention, the institute that those skilled in the art are obtained on the premise of creative work is not made There is other embodiment, belong to the scope of protection of the invention.
In view of in the prior art, for the video loading occurred when solving and switching between video positive and video ads The problem of delay and blank screen, otherwise video ads and video positive are recompiled into one video of synthesis, according still further to common side Formula is played out, but substantial amounts of server resource can be so consumed during decoding and recompiling, and causes server The waste of resource;, video ads exactly are preloaded while video positive is played, until needing to break for commercialsy, then It is switched to video ads to play out, still, limited bandwidth resources can be consumed by preloading advertisement, be easily caused video positive and broadcast Put not smooth.Based on this, the embodiments of the invention provide a kind of advertisement cut-in method and device, retouched below by embodiment State.
Embodiment 1
The embodiments of the invention provide a kind of advertisement cut-in method, as shown in figure 1, being wrapped when being broken for commercialsy using this method Step S110-S130 is included, it is specific as follows.
S110, during loading thread cache positive media data by media and being played by playing thread, when connecing When receiving advertisement insertion instruction, suspend and load the follow-up data of thread acquisition positive media data by media and make broadcasting line Cheng Jixu plays buffered positive media data.
Advertisement cut-in method provided in an embodiment of the present invention is realized by multithreading, and matchmaker is obtained by media loading thread Volume data, decoding thread is decoded to the media data of acquisition, plays thread and decoded media data is played out.
The executive agent of advertisement cut-in method can be the video player in terminal in the embodiment of the present invention, and the terminal can To be mobile phone, computer, tablet personal computer etc..
The instruction of above-mentioned advertisement insertion include the advertisement that needs are intercutted title or it is other can really need to intercut it is wide The mark of announcement and the time of advertisement insertion, such as, it is connected to after advertisement insertion instruction, is immediately performed advertisement insertion, works as broadcasting Device is received after advertisement insertion instruction, then pause loads the follow-up data of thread positive media data by media, makes simultaneously Thread is played to continue to play buffered positive media data.
Wherein, above-mentioned advertising media data and positive media data is Media Stream.
S120, loads thread acquisition and the corresponding advertising media data of advertisement insertion instruction by media, passes through decoding line Journey obtains advertisement audio sample and advertisement video frame to advertising media data decoding.
When receiving advertisement insertion instruction, the player in terminal can suspend loads thread acquisition positive matchmaker by media The follow-up data of volume data, meanwhile, load thread by media and obtain and the corresponding advertising media data of advertisement insertion instruction.
Wherein, the player in terminal can obtain the advertising media data and positive for needing to play from same server Media data, can also obtain the advertising media data and positive media data for needing to play from different servers respectively.
Wherein, if the player in terminal obtains advertising media data and positive media data from different servers, Then pause obtains the follow-up data for the positive media data being currently played, can be by disconnecting the connection with current server Realize, while in order to obtain advertising media data corresponding with advertisement play instruction, then by setting up and advertisement video server Connection.
If the player in terminal obtains the advertising media data and positive media for needing to play from same server Data, then when receiving advertisement insertion instruction, it is also desirable to disconnect the connection with current server, then re-establish with currently taking Connection between business device, this time connection belongs to different connections from last time connection.
And by media load thread obtain with before the corresponding advertising media data of advertisement insertion instruction, in addition to: Thread is loaded by media and opens advertising media's stream corresponding with advertisement insertion instruction, and parses the head word of advertising media's stream Section, judges the Format Type of advertising media's stream;The Format Type parsing audio decoder configuration parameter that is flowed according to advertising media and Video Decoder configuration parameter.
The Format Type of above-mentioned advertising media's stream can be the types such as mp4, ts (Teamspeak).
Wherein, the above-mentioned corresponding format standard of Format Type that can be flowed according to advertising media parses audio decoder The configuration parameter of configuration parameter and Video Decoder.
Above-mentioned audio decoder configuration parameter includes type of coding, sample format, sample rate, port number and the sound of audio Frequency frame length etc., type of coding, color format, the width that Video Decoder configuration parameter includes video is high.
In embodiments of the present invention, corresponding with advertisement insertion instruction advertising media's number is obtained when passing through media and load thread After also, advertisement packets of audio data and advertisement video data bag are parsed from advertising media data, and mark what is parsed First advertisement packets of audio data and first advertisement video data bag.
After advertisement packets of audio data and advertisement video data bag are parsed from advertising media data, if the advertisement sound Frequency packet is not first advertisement packets of audio data, and the advertisement video data bag is not first advertisement video data bag, then will The advertisement packets of audio data is cached in advertisement packets of audio data queue, and the advertisement video data bag is cached into advertisement video number According in bag queue, if above-mentioned advertisement packets of audio data is first advertisement packets of audio data, the first advertisement audio number is marked According to bag, if above-mentioned advertisement video data surrounds first advertisement video data bag, the first advertisement video data bag is marked.
Wherein, above-mentioned mark is parsed first advertisement packets of audio data and first advertisement video data bag, including:Will be upper The attribute for stating first advertisement packets of audio data and the tag field of first advertisement video data bag is set to very;In first advertisement sound Audio decoder configuration parameter is inserted in frequency packet, Video Decoder configuration ginseng is inserted in first advertisement video data bag Number.
Parsed from advertising media data first advertisement packets of audio data is defined as first advertisement voice data Bag, first advertisement video data bag is defined as by parsed from advertising media data first advertisement video data bag.
Advertisement audio sample and advertisement video frame are obtained to advertising media data decoding by decoding thread afterwards.
Wherein, the advertisement packets of audio data and advertisement video data bag in above-mentioned advertising media data can be by different Thread is realized, specifically, being decoded by audio decoder thread to the advertisement packets of audio data in advertising media data, is obtained To advertisement audio sample;Thread is decoded by video to decode the advertisement video data bag in advertising media data, is obtained Advertisement video frame.
As one embodiment, as shown in Fig. 2 advertising media data decoding is obtained advertisement audio and adopted by decoding thread Sample and advertisement video frame, are specifically included:
Whether S210, it is first packets of audio data, advertisement to judge the advertisement packets of audio data in Current ad media data Whether video data bag is first video data bag.
S220, when it is determined that above-mentioned advertisement packets of audio data is first advertisement packets of audio data, above-mentioned advertisement video data bag During for first advertisement video data bag, the audio decoder configuration parameter in first advertisement packets of audio data is to audio decoder Device is initialized, and the decoder configuration parameter that regards in first advertisement video data bag is carried out initially to Video Decoder Change.
S230, is decoded according to the audio decoder after initialization to advertisement packets of audio data, is obtained advertisement audio and is adopted Sample, is decoded according to the Video Decoder after initialization to advertisement video data bag, obtains advertisement video frame.
Wherein, whether the above-mentioned advertisement packets of audio data judged in Current ad media data is first advertisement voice data Whether bag can be true by the attribute for the tag field for judging above-mentioned advertisement packets of audio data, if above-mentioned advertisement voice data The attribute of the tag field of bag is true, it is determined that above-mentioned advertisement packets of audio data is first advertisement packets of audio data, similarly, above-mentioned Whether judge the advertisement video data bag in Current ad media data is that first advertisement video data bag can be by judgement Whether the attribute for stating the tag field of advertisement video data bag is frame, if the category of the tag field of above-mentioned advertisement video data bag Property is true, it is determined that above-mentioned advertisement video data bag is first advertisement video data bag, when determining that advertisement packets of audio data is First advertisement packets of audio data, and advertisement video data bag be first advertisement video data bag when, this explanation is all before this Decoded to positive media data, the configuration parameter of decoder is all configured according to positive media data, therefore, At this moment the audio decoder configuration parameter in advertisement packets of audio data is needed to initialize audio decoder, i.e. basis Audio decoder configuration parameter in advertisement packets of audio data is adjusted to the configuration parameter of audio decoder, and according to advertisement Video Decoder configuration parameter in video data bag is initialized to Video Decoder.
After being initialized to audio decoder and Video Decoder, configuration parameter and the advertisement audio of audio decoder Packet is consistent, i.e., audio decoder at this moment can be decoded to advertisement packets of audio data, and Video Decoder is matched somebody with somebody It is consistent that parameter, which is put, with advertisement video data bag, i.e., Video Decoder at this moment can be solved to advertisement video data bag Code, decodes to advertisement packets of audio data according to the audio decoder after initialization, obtains advertisement audio sample, and will obtain Advertisement audio sample be cached in advertisement audio sample queue, according to the Video Decoder after initialization to advertisement video data Bag is decoded, and obtains advertisement video frame, will decode obtained advertisement video frame buffer into advertisement video frame queue.
If above-mentioned advertisement packets of audio data is not first advertisement packets of audio data, above-mentioned advertisement video data bag is simultaneously It is not first advertisement video data bag, then illustrates to be exactly that advertisement packets of audio data and advertisement video data bag are entered before this Row decoding, at this moment need not be initialized to audio decoder and Video Decoder.
S130, after the buffered positive media data of broadcasting thread broadcasting terminates, plays broadcasting thread above-mentioned wide Accuse audio sample and advertisement video frame.
Above-mentioned decoding thread is played thread and can played always and delayed during being decoded to advertising media data The positive media data deposited, after positive media data plays end, then broadcasting thread commences play out above-mentioned to advertising media Advertisement audio sample and advertisement video frame that data decoding is obtained.
Wherein, as one embodiment, as shown in figure 3, above-mentioned advertisement audio sample and advertisement video frame are played, including:
S310, by the configuration parameter of Current ad audio sample and the configuration parameter of previous audio sample, and will The configuration parameter of Current ad frame of video and the configuration parameter of previous frame of video are compared, the configuration ginseng of the audio sample Number includes sampling resolution, sample rate and the port number of audio sample, and the configuration parameter of the frame of video includes the color of frame of video, lattice Formula and width are high.
S320, when it is determined that the configuration parameter of configuration parameter and the previous audio sample of Current ad audio sample, when When the configuration parameter of preceding advertisement video frame and the different configuration parameter of previous frame of video, by Current ad audio sample Configuration parameter and the configuration parameter of Current ad frame of video reset output, and export the Current ad audio sample and advertisement is regarded Frequency frame.
In embodiments of the present invention, play thread and advertisement audio sample is read from advertisement audio sample queue, from advertisement Advertisement video frame is read in video frame queue, if the configuration parameter of the advertisement audio sample currently read and previous audio The configuration parameter of sampling, and the advertisement video frame currently read configuration parameter and previous frame of video configuration parameter not Identical, then the audio sample and frame of video once played before illustrating are the audio sample and frame of video of positive, at this moment, are worked as playing , it is necessary to inform that audio output system needs the audio sample played and informed to regard when preceding advertisement audio sample and advertisement video frame Frequency output system needs the frame of video played to switch to advertisement via positive, is so responsible for the operating system and hardware ability played Advertisement audio sample and advertisement video frame can be correctly exported, so playing Current ad audio sample and advertisement video frame When exported, it is necessary to which the configuration parameter of the configuration parameter of advertisement audio sample and advertisement video frame is resetted, to inform that audio is defeated Going out system and video output system needs the audio sample and frame of video of broadcasting to switch to advertisement via positive, and audio is adopted Sample exports clock and video sampling output clock is resetted, and then exports Current ad audio sample and advertisement video frame.
When the player in user's using terminal is watching video, if other things will be done or use the end During the other application program at end, user needs to exit current video broadcasting, therefore, advertisement insertion side provided in an embodiment of the present invention Method, in addition to:
When receive exit play instruction after, exit the advertising media data being currently played or positive media data.
Wherein, user can exit broadcasting at any time.
In embodiments of the present invention, after media loading thread receives the instruction that positive is switched back into by advertisement, then stop The follow-up data of advertising media data is obtained, while obtaining positive media data.
Advertisement cut-in method provided in an embodiment of the present invention, is not in that loading is delayed and blank screen when breaking for commercialsy, together When avoid extra consumption server resource and the occurrence of video positive plays not smooth.
Embodiment 2
The embodiments of the invention provide a kind of advertisement insertion device, as shown in figure 4, the device includes:Load-on module 410, Decoder module 420 and playing module 430;
Above-mentioned load-on module 410, for loading thread cache positive media data by media;And, for according to wide Accuse to intercut to instruct to suspend and load the follow-up data that thread obtains positive media data by media, and obtain and advertisement insertion instruction Corresponding advertising media data;
Above-mentioned decoder module 420, for by decode thread to advertising media data decoding obtain advertisement audio sample and Advertisement video frame;
Above-mentioned playing module 430, for playing the positive media number that above-mentioned media load thread cache by playing thread According to;And, for after the buffered positive media data of above-mentioned broadcasting thread broadcasting terminates, playing broadcasting thread above-mentioned Advertisement audio sample and advertisement video frame.
Wherein, above-mentioned advertisement insertion device can obtain the advertising media data and just for needing to play from same server Piece media data, can also obtain the advertising media data and positive media data for needing to play from different servers respectively.
The instruction of above-mentioned advertisement insertion include the advertisement that needs are intercutted title or it is other can really need to intercut it is wide The mark of announcement, after advertisement insertion instruction is received, the pause of load-on module 410 obtains the positive media number being currently played According to follow-up data, and obtain and need the advertising media data that intercuts.
Wherein, if load-on module 410 obtains the advertising media data for needing to play and positive matchmaker from different servers Volume data, then pause obtains the follow-up data for the positive media data being currently played, and can pass through disconnection and current service The connection of device is realized, while in order to obtain advertising media data corresponding with advertisement play instruction, then being regarded by setting up with advertisement The connection of frequency server.
If above-mentioned load-on module 410 obtains the advertising media data and positive media for needing to play from same server Data, then after advertisement insertion instruction is received, it is also desirable to disconnect the connection with current server, then re-establish with currently taking Connection between business device, this time connection belongs to different connections from last time connection.
Advertisement insertion device provided in an embodiment of the present invention, is not in that loading is delayed and blank screen when breaking for commercialsy, together When avoid extra consumption server resource and the occurrence of video positive plays not smooth.
The advertisement insertion device that the embodiment of the present invention is provided for the specific hardware in equipment or can be installed on equipment On software or firmware etc..The technique effect of the device that the embodiment of the present invention is provided, its realization principle and generation and foregoing side Method embodiment is identical, to briefly describe, and device embodiment part does not refer to part, refers in corresponding in preceding method embodiment Hold.It is apparent to those skilled in the art that, for convenience and simplicity of description, system described above, device With the specific work process of unit, the corresponding process in above method embodiment is may be referred to, be will not be repeated here.
, can be by others side in embodiment provided by the present invention, it should be understood that disclosed apparatus and method Formula is realized.Device embodiment described above is only schematical, for example, the division of the unit, only one kind are patrolled Collect function to divide, there can be other dividing mode when actually realizing, in another example, multiple units or component can combine or can To be integrated into another system, or some features can be ignored, or not perform.It is another, it is shown or discussed each other Coupling or direct-coupling or communication connection can be the INDIRECT COUPLING or communication link of device or unit by some communication interfaces Connect, can be electrical, machinery or other forms.
The unit illustrated as separating component can be or may not be it is physically separate, it is aobvious as unit The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
In addition, each functional unit in the embodiment that the present invention is provided can be integrated in a processing unit, also may be used To be that unit is individually physically present, can also two or more units it is integrated in a unit.
If the function is realized using in the form of SFU software functional unit and is used as independent production marketing or in use, can be with It is stored in a computer read/write memory medium.Understood based on such, technical scheme is substantially in other words The part contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter Calculation machine software product is stored in a storage medium, including some instructions are to cause a computer equipment (can be individual People's computer, server, or network equipment etc.) perform all or part of step of each of the invention embodiment methods described. And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi It is defined in individual accompanying drawing, then it further need not be defined and explained in subsequent accompanying drawing, in addition, term " the One ", " second ", " the 3rd " etc. are only used for distinguishing description, and it is not intended that indicating or implying relative importance.
Finally it should be noted that:Embodiment described above, is only the embodiment of the present invention, to illustrate the present invention Technical scheme, rather than its limitations, protection scope of the present invention is not limited thereto, although with reference to the foregoing embodiments to this hair It is bright to be described in detail, it will be understood by those within the art that:Any one skilled in the art The invention discloses technical scope in, it can still modify to the technical scheme described in previous embodiment or can be light Change is readily conceivable that, or equivalent substitution is carried out to which part technical characteristic;And these modifications, change or replacement, do not make The essence of appropriate technical solution departs from the spirit and scope of technical scheme of the embodiment of the present invention.The protection in the present invention should all be covered Within the scope of.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.

Claims (10)

1. a kind of advertisement cut-in method, it is characterised in that methods described includes:
By media load thread cache positive media data and by play thread play during, when receive advertisement insert When broadcasting instruction, suspend and load the follow-up data of the thread acquisition positive media data by the media and make the broadcasting Thread continues to play the buffered positive media data;
Thread acquisition and the corresponding advertising media data of advertisement insertion instruction are loaded by the media, by decoding thread Advertisement audio sample and advertisement video frame are obtained to advertising media data decoding;
After the buffered positive media data of the broadcasting thread broadcasting terminates, the broadcasting thread is set to play described Advertisement audio sample and the advertisement video frame.
2. according to the method described in claim 1, it is characterised in that described by decoding thread to the advertising media data solution Code obtains advertisement audio sample and advertisement video frame, including:
The advertisement packets of audio data in the advertising media data is decoded by audio decoder thread, the advertisement is obtained Audio sample;
Thread is decoded by video to decode the advertisement video data bag in the advertising media data, obtains the advertisement Frame of video.
3. according to the method described in claim 1, it is characterised in that described to adopt the broadcasting thread broadcasting advertisement audio Sample and the advertisement video frame, including:
Audio is played thread and play the advertisement audio sample, the video playback thread is played the advertisement video frame.
4. according to the method described in claim 1, it is characterised in that described to load thread acquisition and described wide by the media Announcement is intercutted before the corresponding advertising media data of instruction, in addition to:
Thread is loaded by the media and opens advertising media's stream corresponding with advertisement insertion instruction, and parses the advertisement The header byte of Media Stream, judges the Format Type of advertising media's stream;
The Format Type parsing audio decoder configuration parameter and Video Decoder configuration parameter flowed according to the advertising media.
5. method according to claim 4, it is characterised in that described to load thread acquisition and described wide by the media Announcement is intercutted after the corresponding advertising media data of instruction, in addition to:
Advertisement packets of audio data and advertisement video data bag are parsed from the advertising media data, and marks the head parsed Individual advertisement packets of audio data and first advertisement video data bag.
6. method according to claim 5, it is characterised in that first advertisement packets of audio data that the mark is parsed and First advertisement video data bag, including:
The attribute of the first advertisement packets of audio data and the tag field of the first advertisement video data bag is set to very;
Audio decoder configuration parameter is inserted in the first advertisement packets of audio data, in the first advertisement video data bag Middle insertion Video Decoder configuration parameter.
7. method according to claim 6, it is characterised in that described by decoding thread to the advertising media data solution Code obtains advertisement audio sample and advertisement video frame, including:
Whether be first packets of audio data, the advertisement is regarded if judging the advertisement packets of audio data in presently described advertising media data Whether frequency packet is first video data bag;
When it is determined that the advertisement packets of audio data is the first advertisement packets of audio data, the advertisement video data bag is described During first advertisement video data bag, the audio decoder configuration parameter in the first advertisement packets of audio data is to audio solution Code device is initialized, and the Video Decoder configuration parameter in the first advertisement video data bag enters to Video Decoder Row initialization;
All advertisement packets of audio data in the advertising media data are carried out according to the audio decoder after initialization Decoding, obtains the advertisement audio sample, according to the Video Decoder after initialization to all in the advertising media data The advertisement video data bag is decoded, and obtains the advertisement video frame.
8. according to the method described in claim 1, it is characterised in that it is described the broadcasting thread play it is buffered described in After positive media data terminates, the broadcasting thread is set to play the advertisement audio sample and the advertisement video frame, including:
By the configuration parameter of Current ad audio sample and the configuration parameter of previous audio sample, and Current ad frame of video Configuration parameter and the configuration parameter of previous frame of video be compared, the configuration parameter of the audio sample includes the sound Sampling resolution, sample rate and the port number of frequency sampling, the configuration parameter of the frame of video include color, form and the width of frame of video It is high;
When it is determined that the configuration parameter of the configuration parameter and the previous audio sample of the Current ad audio sample, described When the configuration parameter of Current ad frame of video and the different configuration parameter of the previous frame of video, by the Current ad The configuration parameter of audio sample and the configuration parameter of the Current ad frame of video reset output, and export the Current ad sound Frequency sampling and advertisement video frame.
9. according to the method described in claim 1, it is characterised in that methods described also includes:
When receive exit play instruction after, exit the positive media data or advertising media data being currently played.
10. a kind of advertisement insertion device, its feature is being that described device includes:
Load-on module, for loading thread cache positive media data by media;And, it is temporary for being instructed according to advertisement insertion Stop loading the follow-up data that thread obtains the positive media data by the media, and obtain and advertisement insertion instruction Corresponding advertising media data;
Decoder module, for obtaining advertisement audio sample and advertisement video to advertising media data decoding by decoding thread Frame;
Playing module, for playing the positive media data that the media load thread cache by playing thread;And, it is used for After the buffered positive media data of the broadcasting thread broadcasting terminates, the broadcasting thread is set to play the advertisement Audio sample and the advertisement video frame.
CN201611002602.6A 2016-11-14 2016-11-14 A kind of advertisement cut-in method and device Active CN106375837B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201611002602.6A CN106375837B (en) 2016-11-14 2016-11-14 A kind of advertisement cut-in method and device
PCT/CN2017/079592 WO2018086303A1 (en) 2016-11-14 2017-04-06 Advertisement inter-cut method and device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611002602.6A CN106375837B (en) 2016-11-14 2016-11-14 A kind of advertisement cut-in method and device

Publications (2)

Publication Number Publication Date
CN106375837A CN106375837A (en) 2017-02-01
CN106375837B true CN106375837B (en) 2017-10-10

Family

ID=57894020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611002602.6A Active CN106375837B (en) 2016-11-14 2016-11-14 A kind of advertisement cut-in method and device

Country Status (2)

Country Link
CN (1) CN106375837B (en)
WO (1) WO2018086303A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375837B (en) * 2016-11-14 2017-10-10 武汉斗鱼网络科技有限公司 A kind of advertisement cut-in method and device
CN108366271B (en) * 2018-02-09 2020-12-01 腾讯音乐娱乐科技(深圳)有限公司 Multimedia file playing method and device and storage medium
CN109218763A (en) * 2018-11-12 2019-01-15 青岛海信传媒网络技术有限公司 A kind of method and smart television of streaming media video switching
CN112163895A (en) * 2020-10-14 2021-01-01 广州欢网科技有限责任公司 High-concurrency advertisement putting method, device, equipment and system based on asynchronous programming
CN112770176B (en) * 2020-12-23 2022-10-25 北京爱奇艺科技有限公司 Video frame determination method and device, electronic equipment and computer readable medium
CN112785333B (en) * 2021-01-12 2023-09-01 北京奇艺世纪科技有限公司 Advertisement putting method, electronic equipment, storage medium and device
CN116347124B (en) * 2023-03-29 2024-03-29 上海枭柯文化传播有限公司 Advertisement loading method based on video playing state

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101179700A (en) * 2006-12-20 2008-05-14 腾讯科技(深圳)有限公司 Program source switch method and stream media play system
CN101198022A (en) * 2007-12-26 2008-06-11 青岛海信移动通信技术股份有限公司 Method for inter cutting video information in stream media broadcasting or buffering course

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101345882B (en) * 2008-08-20 2010-09-22 北京搜狗科技发展有限公司 Playing device and method for inter-cutting audio files
CN102196312A (en) * 2010-03-02 2011-09-21 北大方正集团有限公司 Audio and video data stream playing method and device
CN102238139A (en) * 2010-04-27 2011-11-09 华为技术有限公司 Method, device and system for inserting advertisement
CN102905188B (en) * 2012-11-01 2015-09-30 北京奇艺世纪科技有限公司 A kind of video code flow changing method and device
KR20140126094A (en) * 2013-04-22 2014-10-30 삼성전자주식회사 Method and apparatus for playing contents in multimedia system
US9066048B2 (en) * 2013-06-17 2015-06-23 Spotify Ab System and method for switching between audio content while navigating through video streams
CN105451034B (en) * 2015-12-04 2019-08-27 优酷网络技术(北京)有限公司 A kind of advertisement control method for playing back and system
CN106375837B (en) * 2016-11-14 2017-10-10 武汉斗鱼网络科技有限公司 A kind of advertisement cut-in method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101179700A (en) * 2006-12-20 2008-05-14 腾讯科技(深圳)有限公司 Program source switch method and stream media play system
CN101198022A (en) * 2007-12-26 2008-06-11 青岛海信移动通信技术股份有限公司 Method for inter cutting video information in stream media broadcasting or buffering course

Also Published As

Publication number Publication date
CN106375837A (en) 2017-02-01
WO2018086303A1 (en) 2018-05-17

Similar Documents

Publication Publication Date Title
CN106375837B (en) A kind of advertisement cut-in method and device
US7707485B2 (en) System and method for dynamic transrating based on content
CN105007527B (en) Data live broadcasting method and device
CN105791889A (en) Advertisement inter-cut method for video live broadcasting and advertisement inter-cut device for video live broadcasting
CN104378331B (en) The broadcasting of network media information and response processing method, device and system
CN106131550B (en) Method and device for playing multimedia file
CN104837052A (en) Playing method of multimedia data and device
CN101360234A (en) Multimedia information playing method, system, terminal apparatus and server
CN102891997A (en) Audio and video frequency multi-media file format for fast play, playing method and playing device
CN105187897B (en) The media file span playback method and system more being segmented
CN107025847A (en) A kind of advertisement broadcast method and system
CN105263034A (en) Spot video advertisement playing method and device
CN105872589A (en) Multi-channel video playing method, multi-channel video playing server and multi-channel video playing terminal
CN106997542A (en) Internet advertising put-on method and device
CN102780577A (en) Method for detecting network fault
CN107786903A (en) video interactive method and device
CN103399917A (en) Data file insertion method, device and system
CN105635763A (en) Method and system for putting advertisement into network video
CN103248921B (en) Advertisement broadcast method, Apparatus and system
CN107801060A (en) The player method and device of Online Video
CN104883625A (en) Information display method, terminal device, server, and system
CN103916700A (en) Method and system for identifying information in video file
CN107580264A (en) Multimedia resource play handling method and device
CN106254961A (en) Video broadcasting method in TV and TV
KR102689741B1 (en) Method for providing of advertisement and apparatus therefor

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant