WO2020029935A1 - Video live-broadcast processing method, apparatus and terminal - Google Patents

Video live-broadcast processing method, apparatus and terminal Download PDF

Info

Publication number
WO2020029935A1
WO2020029935A1 PCT/CN2019/099343 CN2019099343W WO2020029935A1 WO 2020029935 A1 WO2020029935 A1 WO 2020029935A1 CN 2019099343 W CN2019099343 W CN 2019099343W WO 2020029935 A1 WO2020029935 A1 WO 2020029935A1
Authority
WO
WIPO (PCT)
Prior art keywords
video
live
broadcast
live broadcast
gop
Prior art date
Application number
PCT/CN2019/099343
Other languages
French (fr)
Chinese (zh)
Inventor
李剑峰
Original Assignee
南京中兴软件有限责任公司
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 南京中兴软件有限责任公司 filed Critical 南京中兴软件有限责任公司
Publication of WO2020029935A1 publication Critical patent/WO2020029935A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/239Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/239Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
    • H04N21/2393Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests involving handling client requests
    • 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
    • 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
    • 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/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/65Transmission of management data between client and server
    • H04N21/658Transmission by the client directed to the server
    • H04N21/6587Control parameters, e.g. trick play commands, viewpoint selection

Definitions

  • the present invention relates to the field of multimedia technology, and in particular, to a method, device and terminal for processing live video.
  • Video live broadcast is becoming more and more popular among video users, and it meets people's needs for social, adventure, and other forms of interactive content.
  • users who currently use video services tend to have more surplus on package traffic and more monthly monthly traffic; and, with the introduction of higher compression encoding algorithms, traffic is no longer a service experience for video services Focus.
  • the focus of today's video service experience is mainly reflected in three parts: resolution, initial buffer time and stall rate. Among them, the shorter the initial buffer time and the lower the stall rate, the better the user experience.
  • the above problems have not been solved at present, which leads to a poor video service experience.
  • the main object of the present invention is to provide a method, device and terminal for processing live video, which can at least partially solve the problems of long initial cache time and high stall rate.
  • a live video processing method includes:
  • the live broadcast of the first video is stopped, and the second video is broadcast live using the cached video data.
  • a video live processing device includes:
  • a video live broadcast module for live broadcast of the first video; and also for stopping the live broadcast of the first video when a switching instruction is detected, and live broadcast of the second video by using the cached video data;
  • the buffering module is configured to buffer video data of the second video when the first video is broadcast live.
  • An embodiment of the present invention further provides a terminal, where the terminal includes a processor and a memory for storing a computer program capable of running on the processor; wherein, when the processor is used to run a computer program, any one of the present invention is implemented
  • the live video processing method provided in the embodiment is not limited to the embodiment.
  • An embodiment of the present invention further provides a live video processing system, where the system includes: a terminal and a media server;
  • the terminal is configured to implement a live video processing method provided by any embodiment of the present invention.
  • the media server is configured to send video data of a first video and / or video data of a second video to the terminal.
  • the method, device and terminal for processing live video provided by the embodiments of the present invention, by buffering video data of the second video during live broadcast of the first video, it is beneficial to quickly play the second video when switching to the second video Video content.
  • the live broadcast device can pass as soon as it switches to the second video Play the pre-buffered video data of the second video. Compared with the lack of time to obtain the video data, such as the black screen caused by the direct switching without pre-buffering, it takes almost 1s to switch to the abnormal state of playback.
  • the display screen can be switched to the display picture of the second video in a shorter time, and the switching rate of the live video is faster and the switching efficiency is higher.
  • the method provided by the embodiment of the present invention also reduces the time required for the first appearance of a non-first live video, reduces the stall rate of the entire live broadcast process, and brings a better video live experience to users.
  • FIG. 1 is a schematic flowchart of buffering video data according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of Embodiments 1, 2, 3, 4, and 5 of a method for processing a live video broadcast according to the present invention
  • FIG. 3 is a schematic flowchart of a sixth embodiment of a live video processing method according to the present invention.
  • FIG. 4 is a schematic flowchart of a seventh embodiment of a live video processing method according to the present invention.
  • Embodiment 8 of a live video processing method according to the present invention
  • FIG. 6 is a schematic flowchart of a ninth embodiment of a live video processing method according to the present invention.
  • FIG. 7 is a schematic flowchart of a tenth embodiment of a live video processing method according to the present invention.
  • Embodiment 11 of a live video processing method according to the present invention is a schematic flowchart of Embodiment 11 of a live video processing method according to the present invention.
  • FIG. 9 is a schematic structural diagram of a live video processing apparatus according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of a hardware structure of a live video processing apparatus according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a live video processing system according to an embodiment of the present invention.
  • the live video processing method provided by the example of the present invention is mainly applied to the field of live video.
  • the current live video system includes a media server and a terminal.
  • the terminal is equipped with a live video software APP.
  • a live video software APP can be Yingke live software, peppercorn.
  • the terminal may be a mobile phone, iPad, PC, or other electronic devices.
  • a streaming device pushes a video stream to a media server, and the media server forwards the video stream to other media servers or directly to the terminal APP, which is decoded by the terminal APP.
  • Output For the live broadcast platform, there are many live streaming devices that push the live broadcast videos of each anchor to the media server, and terminal APP users select favorite anchors and content to watch for a long time according to personal preferences. Over time, users may continue to change video content in search of more preferred content. During the switching process, the user often slides the interactive screen to change the next video.
  • live video is the real-time acquisition and encoding of live signals (such as cameras) and television signals (such as TV programs and videotapes) into standard streaming data for management, classification, etc. ,
  • live signals such as cameras
  • television signals such as TV programs and videotapes
  • the specific implementation process is: when the user sends a live broadcast request, the server will tell the user the broadcast address of the live broadcast channel according to the live broadcast information, and the user joins the corresponding multicast group according to the address to receive the live broadcast channel. Stream.
  • Video live streaming evolved on the basis of video on demand.
  • the specific implementation process is: When the end user sends an on demand request, the streaming media server system will retrieve the program information stored in the source library according to the on demand information. Audio stream and video stream files are transmitted to user terminals for playback through the network.
  • the live video is collected in real time for playback, for the download mode of live video, it may only need to cache a part of the video content to be played, the download time of the video content is short, and the retention time is short; and Because video on demand must be downloaded to a local cache before it can be played, it often requires a large amount of video content to be played, which often requires a large amount of storage resources.
  • the video data in the live video broadcast is not collected in advance, but is played while collecting; and video on demand generally collects the video in advance and stores it in a video server or a video database.
  • video on demand generally collects the video in advance and stores it in a video server or a video database.
  • an embodiment of the present invention provides a live video processing method.
  • the method includes the following steps.
  • Step 101 broadcast the first video
  • the interactive display screen of the touch terminal enters the live APP page, and clicks to enter the first video to live broadcast the first video.
  • the terminal when the first video is being broadcast live, the terminal sends a request to pull the video data of the first video to the media server; after the terminal receives the video data of the first video, the terminal APP decodes the video data of the first video, so that the first The video content of the video is presented on a display interactive screen.
  • the video data of the first video is specifically a video stream.
  • Step 103 when the first video is broadcast live, buffer the video data of the second video;
  • the terminal when the terminal broadcasts the first video, the terminal further sends a request for pulling the video data of the second video to the media server, so that the media server sends the video data of the second video to the terminal based on the request;
  • the terminal may buffer the video data of the second video.
  • the video data of the second video corresponds to a video stream containing image data and An audio stream containing audio data.
  • a streaming media protocol for example, real-time streaming media protocol (RTP), real-time transmission control protocol (RTCP)
  • RTP real-time streaming media protocol
  • RTCP real-time transmission control protocol
  • the buffering of the video data of the second video may include buffering the video stream data, or buffering the video stream data and the audio stream data.
  • the video data may include: image data and audio data; usually, the data amount of the image data of a video frame is much larger than the data amount of the audio data.
  • the number of videos buffering the second video includes: buffering at least the image data of the second video. Because the data volume of the audio data is small, when switching to live broadcast of the second video, the terminal can also promptly download from the media server. Request audio data for live broadcast.
  • the buffering the video data of the second video in step 103 may include: synchronizing the image data and the audio data of the buffered video data. In this way, when switching to live broadcast of the second video, live broadcast can be performed directly based on the cached image data and audio data.
  • step 105 when a switching instruction is detected, the live broadcast of the first video is stopped, and the cached video data is used to broadcast the second video.
  • the terminal when the terminal detects the execution of the switching, the terminal stops the live broadcast of the first video; switches to live broadcast the second video; and in the embodiment of the present invention, the live broadcast second video directly utilizes the cached Video data of the second video starts the live broadcast of the second video; there is no need to temporarily obtain the video information of the second video, and start buffering the video data of the second video based on the video information, after the video data of the second video is buffered
  • the live broadcast has only begun, which obviously improves the efficiency of live broadcast switching and reduces the anomalies such as freezes and black screens during live broadcast switching.
  • the first video and the second video are not only characterized by two videos, but may be characterized by multiple live videos that are constantly changing live videos; when a switching instruction is detected, the Switching a live video to another live video does not only signify the switching between two live videos, but also the switching between multiple live videos that a user may watch during the entire live switching process.
  • the next live broadcast of host B is cached.
  • the next live broadcast of host C is cached.
  • the user continuously switches from A-caster-B-caster-C-caster-D-caster-.
  • the switch instruction stop the live broadcast of the A host's live video, and use the cached live data of the B host's live video for the live broadcast, and cache the video data of the C host's live video;
  • stop The live broadcast of the B host's live video, and the cached live data of the C host's live video is used for the live broadcast, and the D data of the live broadcast of the D host is cached;
  • the switching execution order is detected, the video of the live broadcast of the D host is stopped Data ... and so on, until the live video of interest is selected for a long live video broadcast.
  • the user when the user is looking for a favorite channel or program, the user buffers the video data of the second video when the first video is live, so that when a switch instruction is detected, the switch
  • the cached video data of the second video can be used for live broadcast, thus avoiding the “black screen” state or no program state caused by accessing the live video from a random point in time; and, It can be realized that when the user continuously switches the process of the live video, the user can watch the cut-in live video in a very short time, reducing the waiting time of the first appearance of the live video, and achieving a better effect than the second opening; and During the entire switching process, the video data of the next video will be cached when the previous video is played, which also overcomes the feeling of stutter caused by the continuous switching to the user during the live broadcast.
  • step 105 further includes:
  • the second direction is opposite to or the same as the first direction.
  • the detecting the switching instruction may be: detecting the generated switching instruction according to a user operation.
  • the interactive display screen with a finger or other touch object to control the live broadcast screen of the first video to slide out of the display area from the first direction, and / or to control the live broadcast screen of the second video from
  • the second direction of the display area is drawn into the display area; wherein the first direction and the second direction may be a direction parallel to the horizontal axis of the display area or a direction parallel to the vertical axis of the display area; It can be in any direction, as long as it does not affect the control to slide the live picture of the first video from the display area, and does not affect the control to slide the live picture of the second video from the display area;
  • the first direction and the second direction may be opposite directions or the same.
  • the horizontal axis direction may be a direction in which a long side of the display screen is located; and the vertical axis direction may be a direction in which a short side of the display screen is located.
  • the switching instruction when the switching instruction is detected, according to the switching instruction, it may also be executed to exit the homepage of the first video live broadcast to the live broadcast APP, scroll the interactive display screen to switch from the first video to the second video, and touch to enter The second video broadcasts the operation of the second video.
  • the switching instruction may be a sliding operation instruction corresponding to a sliding operation, or may be a voice instruction collected through voice, or a control instruction received from another electronic device, for example, received from a mouse or a remote control device. Switch instruction.
  • step 105 further includes:
  • the sliding direction of the sliding operation is the first direction.
  • the terminal detects a sliding operation performed by the user on the display interactive screen, and the direction of the sliding operation may be the first direction or a direction opposite to the first direction; if the sliding operation is detected, then Generate a switch instruction.
  • step 103 further includes:
  • At least one group of pictures GOP that is live broadcast at the current moment of the second video is buffered.
  • the current time can be understood as: the current time point. Play the current moment at any one of the first videos.
  • buffering the video data may include: buffering the data content of the video stream.
  • the video stream includes a collection of video frames. Taking MPEG1, MPEG2, MPEG4, and H.264 as examples, it is a video stream including a group of pictures (GOP) set.
  • GOP group of pictures
  • a cache space is allocated for the second video in advance, and the cache space can accommodate at least one GOP of the second video; in some embodiments, the capacity of the cache space can be at least Cache two or more GOPs.
  • the buffering of at least one GOP of the second video live at the current moment may write the GOP of the second video currently downloaded from the network side into the cache space, and if the cache space is full, directly replace the farther from the current moment Cached GOP for historical moments.
  • a cache queue is established in the cache space, and the cache queue may be a first-in-first-out (FIFO) queue. In this way, if a GOP is written to the end of the queue, a first is popped up at the head of the FIFO. GOP.
  • FIFO first-in-first-out
  • the second video is cached, on the one hand, it does not occupy a large amount of cache space, which saves the cache capacity of the playback terminal; on the other hand, it can timely discard the cached GOP at the historical moment, reducing switching to live broadcast due to switching errors
  • the GOP selected for entering the live broadcast is incorrect (for example, the GOP at the historical moment is selected for live broadcast at the current moment), and the live broadcast skip caused by the GOP from the historical moment to the GOP at the next moment is reduced.
  • the continuous phenomenon, so the special setting of the cache space also improves the live broadcast effect of the second video.
  • the user may pre-cache a GOP or a set of more than one GOP of the next adjacent live video B anchor and store it in the terminal's local cache. . If the user switches the video content at this time, the terminal APP can directly read the GOP or GOP set in the cache for playback, and continue to download the rest of the video frames of B anchor. At the same time, pre-cache and download the live video C anchor one or more GOPs stored in In the local cache, waiting for the user to switch.
  • the GOP includes: an I frame, a P frame, and a B frame;
  • I frame is a key frame, which is usually the first frame of each GOP. It can retain a complete picture. When decoding, only the data of this frame can be used to complete the decoding.
  • the P frame is a forward prediction frame.
  • the P frame can retain the difference between this frame and the previous frame. Therefore, when decoding, the P frame depends on the previous P frame / I frame;
  • the B frame is a bidirectional prediction frame.
  • the B frame can retain the difference between this frame and the previous and subsequent frames. Therefore, when decoding, the B frame depends on the previous P frame / I frame and the next P frame; the B frame is not a reference frame and will not Causes the proliferation of decoding errors.
  • the video files all start from 0 seconds, and the first frame from 0 seconds is the key frame I frame, so when the user clicks into the on-demand video, it does not exist.
  • the "black screen" caused by entering P-frames or B-frames is seen as video content with pictures.
  • the frame at this point in time may be an I frame, or a P frame or a B frame.
  • a P frame or a B frame is connected at this time point, this will cause the display interactive screen to appear in a "black screen” state. Therefore, it is necessary to wait until the next key frame I frame arrives before the video content with pictures can start to appear.
  • the first video when the first video is broadcast live, at least one frame group GOP of the second video being broadcasted at the current moment is cached.
  • P frames can be avoided directly from the time point. Or the possibility that the B frame enters the live video; when the second video of the live broadcast is entered, the pre-cached GOP can be played, so that the live broadcast can be accessed from the time of the I frame, so that the display interactive screen does not appear " "Blank screen” status or no program status, thereby avoiding the "black screen” or stutter problems during the switching process.
  • the step 103 further includes: buffering at least one first-type GOP of the second video at the current moment when the first video is broadcasted live, wherein the first One type of GOP includes: I-frame, B-frame, and P-frame.
  • the terminal caches the live broadcast of the second video at the current moment. At least one first-class GOP.
  • the step 103 further includes: buffering at least one second-type GOP or at least one third-type GOP when the first video is broadcast live;
  • the second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
  • optional drop Frame types include: types of dropping B frames, or dropping P and B frames.
  • each GOP in a video coding standard based on the GOP structure, each GOP must start with an I frame, followed by a series of P frames and B frames. Because the I frame is decoded independently within the frame, the entire picture can be decoded without reference to other frames when decoding; while the P frame is forward predictive coding, it needs to refer to the I frame or P frame before it; The B frame is bidirectional predictive decoding. When decoding, it needs to refer to the I frame or P frame located on the front and back sides of the frame. When a frame is decided to be dropped, all other frames in the GOP that depend directly or indirectly on the frame must be discarded. Otherwise, it will cause decoder error or failure.
  • each B frame can be dropped randomly; when a P frame is dropped, all other P frames and B frames in the current GOP that are located after the P frame in decoding order should be dropped; When an I frame is dropped, all frames in the current GOP should also be dropped.
  • GOP video content does not affect the intuitive feeling of the entire video viewed by the user. In this way, traffic can be greatly saved, and for some electronic device users with limited traffic, the user's experience of watching live video can be greatly improved.
  • the method further includes step 104: detecting whether the duration of the live broadcast of the first video exceeds a set threshold;
  • the buffering of video data of the second video is stopped.
  • a timer may be set to start at the start time of the live broadcast of the first video to record the duration of the live broadcast of the first video;
  • the terminal stops buffering the video data of the second video.
  • the set threshold may be set according to the history of the user ’s previous browsing of the live video and staying on the live video; for example, if the user stays on A's live broadcast for more than 30s, the user can be regarded as the user ’s live video on A ’s live broadcast. If you are interested, you will stay on the page of A's live video for a long time.
  • the threshold that can be set can be 30s; different users can set the threshold time differently; the same user corresponds to different types of live video, The set threshold time can also be different.
  • the threshold time of the timer when switching from one live video to another live video, the threshold time of the timer needs to be reset.
  • the set threshold time may be the same as or different from the previous threshold. For example, for the live video of the A host, the threshold time of the timer is set to 30s; for the live video of the B host, the threshold time of the timer can be set to 15s.
  • the terminal APP switches from the live video of the anchor A to the live video of the anchor B, the timing from the start time of the live broadcast of the live broadcast of the B anchor is counted from 0, and the set threshold time is 15s.
  • the duration of the live broadcast of the first video exceeds a set threshold to infer whether the user is interested in the content of the first video, so as to determine whether it will stay in the place for a long time.
  • the first video is described, and the video content of the first video is viewed. If it is determined that the dwell time exceeds the set threshold time, it is determined that the user will stay on the first video for a long time, so that it will not switch to the second video in a short time, and by stopping the video data of the second video
  • the cache can save the cache space; and because it does not need to perform synchronous buffering of the video data of the second video, it can also reduce the power consumption of the terminal device, thereby achieving the purpose of saving power.
  • step 102 is further included to determine whether a cache condition is satisfied;
  • the terminal determines whether the cache condition is satisfied.
  • the step 103 includes: if the buffer condition is satisfied, buffering video data of the second video when the first video is live broadcasted.
  • determining whether the cache condition is satisfied in step 102 includes at least one of the following:
  • Scenario 1 if it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, it is determined that the cache condition is satisfied;
  • Scenario 2 if it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required to receive video data of the first video and the second video, it is determined that the cache condition is satisfied;
  • Scenario 3 if it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied;
  • the live broadcast device is a terminal, which may be a desktop computer, a smart phone, a tablet computer, or other electronic equipment; the live broadcast device is an electronic device that performs video live broadcast.
  • the bandwidth of the live broadcast device can cache the video data of the first video, and at least the video data of the second video may be cached.
  • the bandwidth of the live broadcast device may be On the premise of buffering the video data of the first video, there is still at least a part of the excess bandwidth for buffering the video data of the second video.
  • the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the bandwidth of the live broadcast device can cache the first video.
  • video data of at least the second video may be cached.
  • whether to buffer the video data of the next live video in advance may be implemented according to whether the bandwidth of the live broadcast device meets the conditions.
  • step 106 is further included to determine the second video according to the association relationship between the videos.
  • step 106 further includes:
  • a video corresponding to a second live link adjacent to the first live link of the first video is selected as the second video.
  • the determining the second video according to the association relationship between the videos may further be: selecting the first video according to the display position relationship of the homepage of the live video on the interactive display screen.
  • the live video corresponding to the homepage of a video adjacent to or adjacent to the homepage of the live video is the second video.
  • the determining the second video according to the association relationship between the videos may further be: selecting a first connection with the first video according to a display position relationship of the live link on the live video selection page.
  • the video corresponding to the third live link of one live link separated by one or more live links is the second video.
  • the present invention also proposes a live video processing method.
  • the method is mainly directed to a scenario where a terminal receives a first type of GOP; the first type of GOP is a complete GOP, and the first type of GOP includes : I frame, P frame, and B frame; as shown in FIG. 6, the method includes the following steps.
  • Step S001 Select live video A; and set timer T1;
  • start the terminal device click to enter the terminal APP page; click to select a certain live video A in the live video category in the terminal APP; set a timer in the terminal APP, and the timer is set to start from the live broadcast A of the terminal APP
  • the timing starts at the moment, and the set threshold time is T1;
  • the terminal APP is an application program for live video broadcasting, for example, it can be Yingke live software, pepper pepper live software, Huya live software, Douyu live software, etc.
  • the threshold time of the timer it is possible to determine whether the user may broadcast video A for a long time according to the duration of the terminal APP's subsequent live broadcast on video A.
  • Step S002 Send a request to pull A media stream
  • the terminal APP sends a request for pulling the A media stream to the media server.
  • Step S003 Push A media stream
  • the media server pushes A media stream to the terminal APP;
  • the media stream may be understood as the video data in the first embodiment, and the media stream includes a video stream and an audio stream.
  • Step S004 Live A media stream
  • the terminal APP decodes the A media stream.
  • Step S005 Send a request to pull a neighboring B media stream
  • the terminal APP while the terminal APP normally plays the A stream, the terminal APP sends a request to the media server to pull the media stream of the video B corresponding to the second live connection adjacent to the live link of the video A; the terminal APP detects that When the currently accessed network is WIFI or a wired network, or when the user is configured to pre-cache the first type of GOP, a request to pull a media stream including the first type of GOP to the media server is sent.
  • the first type of GOP includes: I frame, B frame, and P frame.
  • Step S006 Push the B media stream
  • the media server pushes the B media stream to the terminal APP;
  • the B media stream includes: a B video stream and a B audio stream.
  • the GOP in the pushed media stream is the first type of GOP.
  • Step S007 Save 1 or N GOPs of the B media stream
  • one or N first-type GOPs in the B media stream are buffered in a local cache of the terminal; where N is a natural number greater than 1.
  • Step S008 receiving a switching instruction to control the live B media stream; and resetting the T1 timer;
  • the terminal detects the duration of the live A media stream; if the terminal receives a switching instruction before the duration of the live A media stream is less than T1, the terminal APP controls the live B media stream according to the switching instruction; and the terminal resets the timing
  • the timer is set to start counting from the start time of the live B media stream, and the threshold time is T1.
  • the switching instruction to control the live B media stream it may be performed by performing a sliding operation in the live broadcast display area of the terminal APP to switch to video B to live the B media stream; or it may be performed other operations to switch to video B Live B media stream.
  • the time for resetting the timer may be different from T1.
  • Step S009 playing one or N GOPs of the buffered B media stream
  • the terminal determines whether a B media stream exists in the local cache space; if so, the terminal APP plays the B media stream cached in the local cache space; specifically, plays a first-type GOP or N of the cached B media stream GOP of the first kind.
  • Step S010 Send a request to continue pulling the B media stream
  • the terminal APP sends a request to the media server to continue to pull the B media stream; wherein, it may be a request to send the first type of GOP of the unbuffered B media stream; or the first request to send the unbuffered B media stream GOP-like and GOP of the first type that sends a B media stream that has been buffered in the local cache space but has not started to play.
  • Step S011 continue to push the B media stream
  • the media server continues to push the B media stream to the terminal APP; after the terminal APP receives the B media stream, it decodes the B media stream; the decoded B is normally displayed by the media stream for the normal live broadcast of the video B; said B
  • the media stream includes: a B video stream and a B audio stream, and the B media stream includes a first type GOP set.
  • Step S012 Send a request to pull a neighboring C media stream
  • the terminal APP sends a request to the media server to pull the media stream of the video C corresponding to the third live connection adjacent to the live link of the video B; the terminal APP detects the current connection
  • the incoming network is WIFI or a wired network, or when the user is configured to pre-cache the first type of GOP, a request to pull the first type of GOP is sent to the media server.
  • the first type of GOP includes: an I frame, a B frame, and a P frame.
  • Step S013 Push the C media stream
  • the media server pushes a C media stream to the terminal APP;
  • the C media stream includes a C video stream and a C audio stream, and the C video stream includes one or N A first type of GOP video stream.
  • Step S014 save 1 or N GOPs of the C media stream
  • one first-type GOP or N first-type GOP sets of the C video stream is cached in a local cache; where N is a natural number greater than 1.
  • Step S015 no longer change the video
  • the terminal APP continuously broadcasts the B media stream.
  • the terminal APP continuously broadcasts the B media stream, indicating that the end user is interested in video B.
  • Step S016 T1 timeout is detected
  • the terminal detects that the duration of the terminal APP's continuous live broadcast of the B media stream exceeds the threshold time T1 of the timer.
  • Step S017 Send a request to stop pushing the media stream of C, and disconnect the connection;
  • the terminal APP when the duration of the live broadcast of the B media stream of the terminal APP exceeds the time T1, the terminal APP sends a request to the media service to stop pushing the C media stream; and stops receiving the C media by disconnecting the transmission protocol between the terminal APP and the media server. flow.
  • Step S018 Clear the cache of the media stream of C.
  • the terminal clears the C media stream in the buffer space.
  • the user can continuously switch the live video by sliding when searching for a favorite channel or program; by pre-buffering the media stream of the B video during the playback of the A video One GOP or N GOP set.
  • the "black screen" state or no program state caused by switching can be avoided, which can be achieved.
  • the waiting time for the first appearance of other live videos is short, which is shorter than the second open time.
  • this embodiment greatly reduces the stall rate, so that the entire live broadcast process can present a picture state, which greatly improves user satisfaction.
  • the first type of GOP is cached when the next live video is cached. Since the first type of GOP is a complete frame set, including I frames, B frames, and P-frame, so when switching live video, users can watch the video content at the full frame rate, so they can watch very clear pictures and increase user satisfaction.
  • the present invention also proposes a live video processing method.
  • the method is mainly for a scenario in which a terminal receives a second type of GOP / a third type of GOP; the second type of GOP is discarded compared to the first type of GOP.
  • B frame, the second type of GOP discards B frame and P frame compared to the first type of GOP; as shown in FIG. 7, the method includes the following steps.
  • Step S201 Select live video A; and set timer T1;
  • start the terminal device click to enter the terminal APP page; click to select a certain live video A in the live video category in the terminal APP; set a timer in the terminal APP, and the timer is set to start from the live broadcast A of the terminal APP
  • the timing starts at the moment, and the set threshold time is T1.
  • the terminal APP is an application program for performing live video streaming, such as Momo Live Streaming Software, Zanthoxy Live Streaming Software, Huya Live Streaming Software, Douyu Live Streaming Software, and Live Bar Software. and many more
  • the threshold time of the timer it is possible to determine whether the user may broadcast video A for a long time according to the duration of the terminal APP's subsequent live broadcast on video A.
  • Step S202 Send a request to pull A media stream
  • the terminal APP sends a request for pulling the A media stream to the media server.
  • Step S203 Push A media stream
  • the media server pushes A media stream to the terminal APP;
  • the A media stream includes: A video stream and A audio stream.
  • Step S204 Live A media stream
  • the terminal APP decodes the A media stream.
  • Step S205 sending a request for pulling the neighboring B media stream; the request carries an indication of frame loss;
  • the terminal APP while the terminal APP normally plays the A stream, the terminal APP sends a request to the media server to pull the media stream of the video B corresponding to the second live connection adjacent to the live link of the video A; and
  • the request carries an indication of dropped frames, and the indication of dropped frames is: the indication of dropped B frames, or the indication of dropped B and P frames.
  • the request carries the indication identifier of the dropped frame.
  • the request is to pull an incomplete GOP.
  • the request carries the indication identifier of the dropped B frame.
  • the request carrying the indication identifiers of the dropped B and P frames is to pull the third type of GOP; wherein the second type of GOP includes: P frame and I frame; the third type of GOP includes: I frame.
  • the request may carry an indication identifier for dropping a B frame and an indication identifier for dropping a P frame and a B frame.
  • the request to pull adjacent B media streams carries the indication that the most recent GOP at the current moment is the discarded B frame, and the carrying the most recent 2 to 5 GOPs at the current moment is the discarded B frame And the indication identifier of the P frame.
  • the request for pulling the adjacent B media stream may also carry an indication identifier that the most recent first to third GOPs at the current moment are the dropped B frame and P frame, and carry the current
  • the fourth GOP with the most recent moment is the indication that the B frame is dropped, and the indication that the fifth GOP with the most recent moment is the complete GOP.
  • Step S206 Push the B media stream
  • the media server pushes the B media stream to the terminal APP;
  • the B media stream includes: a B video stream and a B audio stream; and the B video stream includes a second Class / Third GOP or N Second / Third GOP Set Video Streams.
  • the push B video stream is an incomplete GOP, such as a second type GOP or a third type GOP; however, the audio stream corresponding to the B video stream does not drop frames and is pushed to the terminal APP The audio stream is unchanged.
  • the push B video stream can be controlled to be a set of the second type of GOP and the third type of GOP; correspondingly, the request may carry an instruction for dropping B frames and an instruction for dropping P frames and B frames.
  • Step S207 Save one or N GOPs of the B media stream
  • one or N second-type / third-type GOPs of the B media stream are buffered in a local cache of the terminal; where N is a natural number greater than 1.
  • Step S208 receiving a switching instruction, controlling the live B media stream; and resetting the T1 timer;
  • the terminal detects the duration of the live A media stream; if the terminal receives a switching instruction before the duration of the live A media stream is less than T1, the terminal APP controls the live B media stream according to the switching instruction; and the terminal resets the timing
  • the timer is set to start counting from the start time of the live B media stream, and the threshold time is T1.
  • the switching instruction to control the live B media stream it may be performed by performing a sliding operation in the live broadcast display area of the terminal APP to switch to video B to live the B media stream; or it may be performed other operations to switch to video B Live B media stream.
  • the time for resetting the timer may be different from T1.
  • Step S209 play one or N GOPs of the buffered B media stream
  • the terminal determines whether a B media stream exists in the local cache space; if so, the terminal APP plays the B media stream cached in the local cache space; specifically, plays one or N GOPs of the cached B media stream;
  • the GOP type for playing one or N GOPs of the buffered B media stream is described as the second type / third type GOP.
  • Step S210 Send a request to continue to pull the B media stream
  • the terminal APP sends a request to the media server to continue to pull the B media stream; wherein, it may be a request to send the first type of GOP of the unbuffered B media stream; or the first request to send the unbuffered B media stream GOP-like and the first GOP that sends a B media stream that has been buffered in the local cache space but has not started playing.
  • step S210 since the B video stream has already been broadcast live at this time, the first type GOP or N GOP set of the B media stream can be pulled, and the B media stream can be played normally, so that the video The picture is clearer; moreover, it is also possible to clear the second type / third type GOP that was previously cached but not played, and pull the first type GOP to be cached.
  • Step S211 Continue to push the B media stream
  • the media server continues to push the B media stream to the terminal APP; after the terminal APP receives the B media stream, the B media stream is decoded; the decoded B is normally displayed by the media stream for the normal live broadcast of the video B; said B
  • the media stream includes a B video stream and a B audio stream.
  • the B video stream is a video stream including a first type of GOP set.
  • Step S212 Send a request to pull the adjacent C media stream; the request carries an indication of frame loss;
  • the terminal APP sends a request to the media server to pull the media stream of the video C corresponding to the third live link adjacent to the live link of the video B; and in the request, It carries an indication identifier of dropped frames, where the indication identifier of dropped frames is: the indication identifier of dropped B frames, or the indication identifier of dropped B frames and P frames.
  • the request in the request carries an indication identifier of a dropped frame.
  • the request is to pull an incomplete GOP; for example, in one embodiment, the indication identifier of a dropped B frame is carried.
  • Request for pulling the second type of GOP; in another embodiment, the request carrying the indication identifiers of discarded B and P frames is pulling the third type of GOP; wherein the second type of GOP includes : P frame and I frame; the third type of GOP includes: I frame.
  • Step S213 Push the C media stream
  • the media server pushes the C media stream to the terminal APP;
  • the C media stream includes a C video stream and a C audio stream, and the C video stream includes a second Class / Third GOP or N Second / Third GOP Set Video Streams.
  • the C audio stream in the C media stream is not dropped when the terminal APP is pushed.
  • Step S214 Save 1 or N GOPs of the C media stream
  • a second type / third type GOP or N second type / third type GOP set of the C media stream is cached in a local cache; wherein, N is a natural number greater than 1.
  • Step S215 no longer change the video
  • the terminal APP continuously broadcasts the B media stream.
  • the terminal APP continuously broadcasts the B media stream, indicating that the end user is interested in video B.
  • Step S216 T1 timeout is detected
  • the terminal detects that the duration of the terminal APP's continuous live broadcast of the B media stream exceeds the threshold time T1 of the timer.
  • Step S217 Send a request to stop pushing the media stream of C, and disconnect the connection;
  • the terminal APP when the duration of the live broadcast of the B media stream of the terminal APP exceeds the time T1, the terminal APP sends a request to the media service to stop pushing the C media stream; and stops receiving the C media by disconnecting the transmission protocol between the terminal APP and the media server. flow.
  • Step S218 Clear the buffer of C's media stream.
  • the terminal clears the C media stream in the buffer space.
  • the user can continuously switch the live video by sliding when searching for a favorite channel or program; by pre-buffering the media stream of the B video during the playback of the A video One or N GOPs.
  • the "black screen" state or no program state caused by switching can be avoided.
  • the waiting time for the first appearance of other live videos is short, and the time to achieve the opening is shorter than the second opening time. In this way, this embodiment greatly reduces the stall rate, so that the entire live broadcast process can present a picture state, which greatly improves user satisfaction.
  • the second / third type of GOP linking adjacent video streams is pre-cached by audio and video to achieve fast playback of the switching process; when the user switches to the next live broadcast linking adjacent
  • users can watch low frame rate video content according to different network conditions, making it possible to sacrifice the sharpness of the screen in exchange for saving traffic; after playing for a period of time connected to the next live video, it can be played again. Watch the full frame rate of video content and the picture clarity is restored.
  • a unique scenario for pre-caching the media stream of the next live video can be set, and B frames or P and B frames can be dropped to achieve fast video playback during video switching. .
  • the present invention also proposes a live video processing method.
  • the method is mainly directed to a scenario in which pre-cache is not performed when the bandwidth of the live broadcast device does not meet the pre-cache conditions. As shown in FIG. 8, the method includes the following steps.
  • Step S301 selecting a live video A
  • start a terminal device click to enter the terminal APP page; click to select a live video A in the live video category of the terminal APP; wherein the terminal APP is an application program for performing live video, such as Panda Live, CC Live, Tentacle, Dragon Ball Live, etc.
  • Step S302 determine that the bandwidth is insufficient, and do not pre-cache the media stream of the next video;
  • the terminal detects that the configuration data of the live broadcast device indicates that the next video is not pre-cached When a media stream is generated, the terminal does not perform an operation of pre-caching the media stream of the next video.
  • next video B is a video that the first live broadcast link of video A is adjacent to the second live broadcast bet; or, the next video B is a display interactive screen that is adjacent to or adjacent to the homepage of video A. Video.
  • Step S303 Send a request to pull A media stream
  • the terminal APP sends a request for pulling the A media stream to the media server.
  • the media stream includes a series of GOPs; the GOP is a first type of GOP.
  • Step S304 Push A media stream
  • the media server pushes A media stream to the terminal APP;
  • the A media stream includes: A video stream and A audio stream.
  • Step S305 Live A media stream
  • the terminal APP decodes the A media stream; the terminal APP broadcasts the A media stream live.
  • this embodiment it is also possible to determine whether to perform the operation of pre-caching the media stream of the next video according to the bandwidth situation of the live broadcast device. In this way, this embodiment can prevent the The action of pre-caching the media stream of the next video.
  • An embodiment of the present invention also provides a video live broadcast device.
  • the device includes: a video live broadcast module 21 and a cache module 22;
  • the video live broadcast module 21 is configured to live broadcast the first video; and is also used to stop the live broadcast of the first video when a switching instruction is detected, and use the cached video data to live broadcast the second video;
  • the buffering module 22 is configured to buffer video data of the second video when the first video is broadcast live.
  • the video live broadcast module 21 further includes: a first switching sub-module 211 and a second switching sub-module 212;
  • the first switching sub-module 211 is configured to control the live video of the first video to slide out of the display area from the first direction when the switching instruction is detected;
  • the second switching submodule 212 is configured to control a live broadcast picture of the second video to slide into the display area from a second direction of the display area;
  • the second direction is opposite to or the same as the first direction.
  • the video live broadcast module 21 further includes: a first detection sub-module 213 and a generation sub-module 214;
  • the first detection sub-module 213 is configured to detect a sliding operation acting on a display interactive screen
  • the generating sub-module 214 is configured to generate the switching instruction if the sliding operation is detected
  • the sliding direction of the sliding operation is the first direction.
  • the buffering module 22 is further configured to buffer, when the first video is broadcast live, at least one group of pictures GOP at the current moment of the second video live broadcast.
  • the cache module 22 is further configured to cache at least one first-type GOP of the second video at the current moment when the first video is broadcasted live, where the first-type GOP includes: I Frames, B frames, and P frames.
  • the cache module 22 is further configured to cache at least one second-type GOP or at least one third-type GOP when the first video is broadcast live;
  • the second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
  • the apparatus further includes: a duration detection module 23;
  • the duration detection module 23 is configured to detect whether the duration of the live broadcast of the first video exceeds a set threshold
  • the buffering of video data of the second video is stopped.
  • the apparatus further includes: a first determining module 24;
  • the first determining module 24 is configured to determine whether a cache condition is satisfied
  • the buffering module is further configured to buffer the video data of the second video when the first video is broadcast live if the buffering conditions are met.
  • the determining whether the cache condition is satisfied includes:
  • the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the cache condition is satisfied;
  • the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
  • the apparatus further includes: a second determining module 25;
  • the second determining module 25 is configured to determine the second video according to an association relationship between the videos.
  • the second determining module 25 is further configured to select a video corresponding to a second live link adjacent to the first live link of the first video according to a display position relationship of the live link on the live video selection page. Is the second video.
  • An embodiment of the present invention also discloses a terminal.
  • the terminal includes a processor 31 and a memory 32 for storing a computer program capable of running on the processor; wherein the processor is used for running
  • the computer program implements the live video processing method provided by any embodiment of the present invention.
  • the memory 32 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), and an electronic memory. Erase programmable read-only memory (EPROM, EEPROM) or flash memory.
  • the volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • Synchronous Dynamic Random Access Memory Synchronous Dynamic Random Access Memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM, DDRSDRAM enhanced synchronous dynamic random access memory
  • Enhanced SDRAM, ESDRAM synchronous connection dynamic random access memory
  • Synchronous DRAM synchronous dynamic random access memory
  • Synchlink DRAM SLDRAM
  • Direct RAMbus RAM Direct RAMbus RAM
  • the memory 32 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
  • the processor 31 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 31 or an instruction in the form of software.
  • the above-mentioned processor 31 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a ready-made programmable gate array (Field Programmable Gate Array, FPGA), or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA ready-made programmable gate array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor, or completed by using a combination of hardware and software modules in the decoding processor.
  • the software module may be located in a mature storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and the like.
  • the storage medium is located in the memory 32, and the processor 31 reads information in the memory 32 and completes the steps of the foregoing method in combination with its hardware.
  • the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSP), digital signal processing devices (DSPD), programmable Logic device (Programmable Logic Device, PLD), Field Programmable Gate Array (FPGA), general purpose processor, controller, microcontroller, microprocessor, other for performing the functions described in this application Electronic unit or combination thereof.
  • ASICs application-specific integrated circuits
  • DSP digital signal processors
  • DSPD digital signal processing devices
  • PLD programmable Logic Device
  • FPGA Field Programmable Gate Array
  • controller microcontroller
  • microprocessor other for performing the functions described in this application Electronic unit or combination thereof.
  • the techniques described herein can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described herein.
  • Software codes may be stored in a memory and executed by a processor.
  • the memory may be implemented in the processor or external to the processor.
  • An embodiment of the present invention further provides a live video processing system.
  • the system includes a terminal 41 and a media server 42.
  • the terminal 41 is configured to implement the provided by any embodiment of the present invention.
  • Video live processing method; the media server 42 is configured to send video data of a first video and / or video data of a second video to the terminal 41.
  • Another embodiment of the present invention further provides a computer storage medium.
  • the computer-readable storage medium stores an executable program.
  • the executable program is executed by the processor 31, the following steps of the picture processing and distribution method can be implemented:
  • the live broadcast of the first video is stopped, and the second video is broadcast live using the cached video data.
  • the second direction is opposite to or the same as the first direction.
  • the sliding direction of the sliding operation is the first direction.
  • At least one group of pictures GOP that is live broadcast at the current moment of the second video is buffered.
  • At least one first-type GOP of the second video being broadcast at the current moment is cached, where the first-type GOP includes: I-frame, B-frame, and P-frame.
  • the executable program when executed by the processor 31, it is further configured to implement the following steps:
  • buffer at least one second type GOP or at least one third type GOP;
  • the second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
  • the buffering of video data of the second video is stopped.
  • the buffering the video data of the second video when the first video is broadcast live includes:
  • the video data of the second video is cached when the first video is broadcast live.
  • the executable program when executed by the processor 31, it is further configured to implement at least one of the following steps:
  • the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the cache condition is satisfied;
  • the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
  • a video corresponding to a second live link adjacent to the first live link of the first video is selected as the second video.
  • the computer storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disk.
  • ROM Read Only Memory
  • RAM Random Access Memory
  • magnetic disk or an optical disk.
  • optical disk A medium on which program code can be stored.

Landscapes

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

Abstract

Disclosed is a video live-broadcast processing method. The method comprises: live-broadcasting a first video; caching video data of a second video during the live-broadcast of the first video; and when a switching instruction is detected, stopping the live-broadcast of the first video, and live-broadcasting the second video by using the cached video data. Further disclosed are a video live-broadcast processing apparatus, terminal and system.

Description

视频直播处理方法、装置及终端Video live processing method, device and terminal
本申请要求享有2018年08月06日提交的名称为“视频直播处理方法、装置、终端及存储介质”的中国专利申请CN201810887571.X的优先权,其全部内容通过引用并入本文中。This application claims priority from Chinese patent application CN201810887571.X entitled "Video Live Stream Processing Method, Device, Terminal, and Storage Medium" filed on August 6, 2018, the entire contents of which are incorporated herein by reference.
技术领域Technical field
本发明涉及多媒体技术领域,尤其涉及一种视频直播处理方法、装置及终端。The present invention relates to the field of multimedia technology, and in particular, to a method, device and terminal for processing live video.
背景技术Background technique
视频直播越来越受到视频用户的青睐,它满足了人们社交、猎奇,以及其它多种形式的互动内容的需求。随着互联网技术的发展,目前使用视频服务的用户往往在套餐流量上比较富余,每月剩余流量也比较多;并且,随着更高压缩比例的编码算法逐渐推出,流量不在是视频服务体验的关注重点。而现今视频服务体验的关注重点主要体现在:分辨率、初始缓冲时间以及卡顿率三个部分。其中,初始缓冲时间越短、卡顿率越低,用户体验越佳。然而,目前并未解决上述问题,导致视频服务体验太差。Video live broadcast is becoming more and more popular among video users, and it meets people's needs for social, adventure, and other forms of interactive content. With the development of Internet technology, users who currently use video services tend to have more surplus on package traffic and more monthly monthly traffic; and, with the introduction of higher compression encoding algorithms, traffic is no longer a service experience for video services Focus. The focus of today's video service experience is mainly reflected in three parts: resolution, initial buffer time and stall rate. Among them, the shorter the initial buffer time and the lower the stall rate, the better the user experience. However, the above problems have not been solved at present, which leads to a poor video service experience.
发明内容Summary of the invention
有鉴于此,本发明的主要目的在于提供一种视频直播处理方法、装置及终端,能够至少部分解决初始缓存时间长、卡顿率高的问题。In view of this, the main object of the present invention is to provide a method, device and terminal for processing live video, which can at least partially solve the problems of long initial cache time and high stall rate.
本发明的技术方案是这样实现的:The technical solution of the present invention is implemented as follows:
一种视频直播处理方法,所述方法包括:A live video processing method, the method includes:
直播第一视频;Broadcast the first video;
在直播所述第一视频时,缓存第二视频的视频数据;Buffering video data of the second video when the first video is live broadcasted;
在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播所述第二视频。When a switching instruction is detected, the live broadcast of the first video is stopped, and the second video is broadcast live using the cached video data.
一种视频直播处理装置,所述装置包括:A video live processing device, the device includes:
视频直播模块,用于直播第一视频;还用于在检测到切换指令时,停止所述第一视 频的直播,并利用缓存的所述视频数据直播第二视频;A video live broadcast module for live broadcast of the first video; and also for stopping the live broadcast of the first video when a switching instruction is detected, and live broadcast of the second video by using the cached video data;
缓存模块,用于在直播所述第一视频时,缓存所述第二视频的视频数据。The buffering module is configured to buffer video data of the second video when the first video is broadcast live.
本发明实施例还提供了一种终端,所述终端包括处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,所述处理器用于运行计算机程序时,实现本发明任一实施例所提供的视频直播处理方法。An embodiment of the present invention further provides a terminal, where the terminal includes a processor and a memory for storing a computer program capable of running on the processor; wherein, when the processor is used to run a computer program, any one of the present invention is implemented The live video processing method provided in the embodiment.
本发明实施例还提供了一种视频直播处理系统,所述系统包括:终端和媒体服务器;An embodiment of the present invention further provides a live video processing system, where the system includes: a terminal and a media server;
所述终端用于实现本发明任一实施例所提供的视频直播处理方法;The terminal is configured to implement a live video processing method provided by any embodiment of the present invention;
所述媒体服务器用于向所述终端发送第一视频的视频数据和/或第二视频的视频数据。The media server is configured to send video data of a first video and / or video data of a second video to the terminal.
本发明实施例提供的视频直播处理方法、装置及终端,通过在直播第一视频时,缓存第二视频的视频数据,有利于当切换到第二视频时,可以快速播放所述第二视频的视频内容。通过在检测到切换执行时,停止对所述第一视频的直播,并利用缓存的所述第二视频的视频数据直播所述第二视频,可以使得直播设备一切换到第二视频就能通过播放已预先缓存的第二视频的视频数据,从而相对于没有预先缓冲直接切换导致的没有时间来得及进行视频数据的获取导致的黑屏等播放异常状态,相比于没有预先缓存直接切换需要将近1s才能看到画面具备更短的时间,显示屏幕可以以更短的时间切换到第二视频的显示画面,视频直播的切换速率更快且切换效率更高。另外,本发明实施例提供的方法还降低非首次直播视频的首次出现画面所需的时长,降低整个直播过程的卡顿率,给用户带来更好的视频直播的体验。The method, device and terminal for processing live video provided by the embodiments of the present invention, by buffering video data of the second video during live broadcast of the first video, it is beneficial to quickly play the second video when switching to the second video Video content. By stopping the live broadcast of the first video when the switching execution is detected, and using the cached video data of the second video to broadcast the second video, the live broadcast device can pass as soon as it switches to the second video Play the pre-buffered video data of the second video. Compared with the lack of time to obtain the video data, such as the black screen caused by the direct switching without pre-buffering, it takes almost 1s to switch to the abnormal state of playback. Seeing that the picture has a shorter time, the display screen can be switched to the display picture of the second video in a shorter time, and the switching rate of the live video is faster and the switching efficiency is higher. In addition, the method provided by the embodiment of the present invention also reduces the time required for the first appearance of a non-first live video, reduces the stall rate of the entire live broadcast process, and brings a better video live experience to users.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明一实施例中缓存视频数据的流程示意图;FIG. 1 is a schematic flowchart of buffering video data according to an embodiment of the present invention;
图2为本发明视频直播处理方法实施例一、二、三、四、五的流程示意图;FIG. 2 is a schematic flow chart of Embodiments 1, 2, 3, 4, and 5 of a method for processing a live video broadcast according to the present invention; FIG.
图3为本发明视频直播处理方法实施例六的流程示意图;3 is a schematic flowchart of a sixth embodiment of a live video processing method according to the present invention;
图4为本发明视频直播处理方法实施例七的流程示意图;4 is a schematic flowchart of a seventh embodiment of a live video processing method according to the present invention;
图5为本发明视频直播处理方法实施例八的流程示意图;5 is a schematic flowchart of Embodiment 8 of a live video processing method according to the present invention;
图6为本发明视频直播处理方法实施例九的流程示意图;6 is a schematic flowchart of a ninth embodiment of a live video processing method according to the present invention;
图7为本发明视频直播处理方法实施例十的流程示意图;7 is a schematic flowchart of a tenth embodiment of a live video processing method according to the present invention;
图8为本发明视频直播处理方法实施例十一的流程示意图;8 is a schematic flowchart of Embodiment 11 of a live video processing method according to the present invention;
图9为本发明一实施例中视频直播处理装置结构示意图;9 is a schematic structural diagram of a live video processing apparatus according to an embodiment of the present invention;
图10为本发明一实施例中视频直播处理装置的硬件结构示意图;FIG. 10 is a schematic diagram of a hardware structure of a live video processing apparatus according to an embodiment of the present invention; FIG.
图11为本发明一实施例中视频直播处理系统结构示意图。FIG. 11 is a schematic structural diagram of a live video processing system according to an embodiment of the present invention.
具体实施方式detailed description
本发明实例提供的视频直播处理方法,主要应用于视频直播领域,目前视频直播的系统,包括:媒体服务器和终端,其中,终端上装有直播视频软件APP,例如,可以是映客直播软件、花椒直播软件、虎牙直播软件、斗鱼直播软件、直播吧软件、风云直播软件,等等;所述终端可以是手机、iPad、PC、或者其它电子设备。本发明的实现、功能特点及优点将结合实施例,参照附图做进一步说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。The live video processing method provided by the example of the present invention is mainly applied to the field of live video. The current live video system includes a media server and a terminal. The terminal is equipped with a live video software APP. For example, it can be Yingke live software, peppercorn. Live software, Huya live software, Douyu live software, live bar software, Fengyun live software, etc .; the terminal may be a mobile phone, iPad, PC, or other electronic devices. The implementation, functional characteristics, and advantages of the present invention will be further described with reference to the embodiments and the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
如图1所示,提供了一种预先缓存视频数据的缓存流程的方法,推流设备将视频流推到媒体服务器,媒体服务器再转发给其它媒体服务器或者直接转发给终端APP,由终端APP解码输出。对于直播平台,则有很多的直播推流设备将各主播的直播视频推到媒体服务器,终端APP用户根据个人喜好挑选喜欢的主播和内容长时间观看。过一段时间,用户可能会继续连续更换视频内容寻找更喜欢的内容。在切换过程中用户往往是通过滑动显示交互屏来更换下一个视频。As shown in FIG. 1, a method for pre-caching video data is provided. A streaming device pushes a video stream to a media server, and the media server forwards the video stream to other media servers or directly to the terminal APP, which is decoded by the terminal APP. Output. For the live broadcast platform, there are many live streaming devices that push the live broadcast videos of each anchor to the media server, and terminal APP users select favorite anchors and content to watch for a long time according to personal preferences. Over time, users may continue to change video content in search of more preferred content. During the switching process, the user often slides the interactive screen to change the next video.
在一些实施例中,视频直播是将现场的信号(例如摄像机)、电视信号(如电视节目、录像带)等实时采集编码成标准流式数据进行管理、分类等传送到服务器上由页面形式发布出去,供终端用户实时观看现场节目或电视节目。其具体的实现过程是:当用户发出直播请求时,该服务器就会根据直播信息,将该直播频道的播放地址告诉用户,用户根据该地址加入对应的组播组,即可接收到该直播频道的码流了。In some embodiments, live video is the real-time acquisition and encoding of live signals (such as cameras) and television signals (such as TV programs and videotapes) into standard streaming data for management, classification, etc. , For end users to watch live programs or TV programs in real time. The specific implementation process is: when the user sends a live broadcast request, the server will tell the user the broadcast address of the live broadcast channel according to the live broadcast information, and the user joins the corresponding multicast group according to the address to receive the live broadcast channel. Stream.
视频直播是在视频点播的基础上演变而来。Video live streaming evolved on the basis of video on demand.
视频点播是根据终端用户的要求播放节目,其具体的实现过程是:当终端用户发出点播请求时,流媒体服务器系统就会根据点播信息,将存放在片源库中的节目信息检索出来,以音频流和视频流文件,通过网络传输给用户终端以播放。Video on demand broadcasts programs according to the requirements of the end user. The specific implementation process is: When the end user sends an on demand request, the streaming media server system will retrieve the program information stored in the source library according to the on demand information. Audio stream and video stream files are transmitted to user terminals for playback through the network.
在一些实施例中,由于视频直播是实时采集流媒体以进行播放,对于视频直播的下载方式来说,其可以只需要缓存即将播放的一部分视频内容,下载视频内容时间短,保 留时间短;而由于视频点播必须要把节目下载到本地缓存中才能播放,因而往往需要大量下载需要播放的视频内容,从而往往需要大量的存储资源。In some embodiments, because the live video is collected in real time for playback, for the download mode of live video, it may only need to cache a part of the video content to be played, the download time of the video content is short, and the retention time is short; and Because video on demand must be downloaded to a local cache before it can be played, it often requires a large amount of video content to be played, which often requires a large amount of storage resources.
在一些实施例中,视频直播中的视频数据并非预先采集,而是边采集边播放的;而视频点播一般是预先采集好了视频,并存储在视频服务器中或者视频数据库中,当点播该视频时,该视频的视频数据已经完整的完成采集,播放终端可以直接获取到整个完整视频的视频数据。In some embodiments, the video data in the live video broadcast is not collected in advance, but is played while collecting; and video on demand generally collects the video in advance and stores it in a video server or a video database. When the video is on demand At this time, the video data of the video has been completely collected, and the playback terminal can directly obtain the video data of the entire video.
实施例一Example one
如图2所示,本发明实施例提供了一种直播视频处理方法,该方法包括以下步骤。As shown in FIG. 2, an embodiment of the present invention provides a live video processing method. The method includes the following steps.
步骤101,直播第一视频;Step 101: broadcast the first video;
可选地,触控终端的交互显示屏进入直播APP页面,点击进入第一视频,直播第一视频。Optionally, the interactive display screen of the touch terminal enters the live APP page, and clicks to enter the first video to live broadcast the first video.
这里,在进行直播第一视频时,终端向媒体服务器发送拉取第一视频的视频数据的请求;终端接收到第一视频的视频数据后,终端APP解码第一视频的视频数据,使第一视频的视频内容呈现在显示交互屏上。Here, when the first video is being broadcast live, the terminal sends a request to pull the video data of the first video to the media server; after the terminal receives the video data of the first video, the terminal APP decodes the video data of the first video, so that the first The video content of the video is presented on a display interactive screen.
这里,所述第一视频的视频数据具体为视频流。Here, the video data of the first video is specifically a video stream.
步骤103,在直播所述第一视频时,缓存第二视频的视频数据;Step 103: when the first video is broadcast live, buffer the video data of the second video;
可选地,终端在直播所述第一视频时,终端还向媒体服务器发送拉取第二视频的视频数据的请求,如此,媒体服务器基于该请求向终端发送所述第二视频的视频数据;终端就可以缓存所述第二视频的视频数据。Optionally, when the terminal broadcasts the first video, the terminal further sends a request for pulling the video data of the second video to the media server, so that the media server sends the video data of the second video to the terminal based on the request; The terminal may buffer the video data of the second video.
若所述第二视频是基于流媒体协议(例如,实时流媒体协议(RTP)、实时传输控制协议(RTCP))传输的,则第二视频的视频数据对应有包含有图像数据的视频流和包含有音频数据的音频流。If the second video is transmitted based on a streaming media protocol (for example, real-time streaming media protocol (RTP), real-time transmission control protocol (RTCP)), the video data of the second video corresponds to a video stream containing image data and An audio stream containing audio data.
如此,在缓存所述第二视频的视频数据时可包括:缓存所述视频流数据、或者,缓存所述视频流数据和所述音频流数据。所述视频数据可包括:图像数据和音频数据;通常一个视频帧的图像数据的数据量远远大于音频数据的数据量。在步骤103中所述缓存第二视频的视频数包括:至少缓存所述第二视频的图像数据,由于音频数据的数据量小,切换到直播第二视频时,终端也可以及时的从媒体服务器请求到音频数据进行直播。As such, the buffering of the video data of the second video may include buffering the video stream data, or buffering the video stream data and the audio stream data. The video data may include: image data and audio data; usually, the data amount of the image data of a video frame is much larger than the data amount of the audio data. In step 103, the number of videos buffering the second video includes: buffering at least the image data of the second video. Because the data volume of the audio data is small, when switching to live broadcast of the second video, the terminal can also promptly download from the media server. Request audio data for live broadcast.
在另一些实施例中,所述103中缓存第二视频的视频数据可包括:同步缓存视频数 据的图像数据和音频数据。如此,切换到直播第二视频时,直接基于已缓存的图像数据和音频数据进行直播即可。In other embodiments, the buffering the video data of the second video in step 103 may include: synchronizing the image data and the audio data of the buffered video data. In this way, when switching to live broadcast of the second video, live broadcast can be performed directly based on the cached image data and audio data.
步骤105,在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播所述第二视频。In step 105, when a switching instruction is detected, the live broadcast of the first video is stopped, and the cached video data is used to broadcast the second video.
可选地,终端在检测到切换执行时,停止对所述第一视频的直播;切换到直播所述第二视频;且在本发明实施例中,所述直播第二视频是直接利用已缓存的所述第二视频的视频数据开始第二视频的直播;而无需临时获取第二视频的视频信息,并基于视频信息开始缓冲第二视频的视频数据,在缓存到第二视频的视频数据之后才开始直播,显然提升了直播切换的效率,并减少了直播切换过程中的卡顿、黑屏等播放异常现象。Optionally, when the terminal detects the execution of the switching, the terminal stops the live broadcast of the first video; switches to live broadcast the second video; and in the embodiment of the present invention, the live broadcast second video directly utilizes the cached Video data of the second video starts the live broadcast of the second video; there is no need to temporarily obtain the video information of the second video, and start buffering the video data of the second video based on the video information, after the video data of the second video is buffered The live broadcast has only begun, which obviously improves the efficiency of live broadcast switching and reduces the anomalies such as freezes and black screens during live broadcast switching.
这里,需要说明的是,所述第一视频和所述第二视频并不只表征有两个视频,可以表征不断更换直播视频的多个直播视频;所述在检测到切换指令时,执行从一个直播视频切换到另一个直播视频,并不只表征两个直播视频之间的切换,而是表征在整个直播切换过程中,用户可能观看的多个直播视频之间的切换。Here, it should be noted that the first video and the second video are not only characterized by two videos, but may be characterized by multiple live videos that are constantly changing live videos; when a switching instruction is detected, the Switching a live video to another live video does not only signify the switching between two live videos, but also the switching between multiple live videos that a user may watch during the entire live switching process.
例如,可能是观看A主播的直播视频时,缓存下一个B主播的直播视频,过一段时间,在用户观看B主播的直播视频时,缓存下一个C主播的直播视频。For example, when watching the live video of host A, the next live broadcast of host B is cached. After a period of time, when the user watches the live video of host B, the next live broadcast of host C is cached.
又例如,可以是用户连续不断的从A主播-B主播-C主播-D主播-……的直播视频之间切换;在播放A主播的直播视频时,缓存B主播的直播视频的视频数据;当检测到切换指令时,停止A主播的直播视频的直播,并利用缓存的B主播的直播视频的视频数据进行直播,并缓存C主播的直播视频的视频数据;当检测到切换指令时,停止B主播的直播视频的直播,并利用缓存的C主播的直播视频的视频数据进行直播,并缓存D主播的直播视频的视频数据;当检测到切换执行令时,停止D主播的直播视频的视频数据……,以此类推,直到选定感兴趣的直播视频进行长时间的视频直播。For another example, it may be that the user continuously switches from A-caster-B-caster-C-caster-D-caster-. When the switch instruction is detected, stop the live broadcast of the A host's live video, and use the cached live data of the B host's live video for the live broadcast, and cache the video data of the C host's live video; when the switch instruction is detected, stop The live broadcast of the B host's live video, and the cached live data of the C host's live video is used for the live broadcast, and the D data of the live broadcast of the D host is cached; when the switching execution order is detected, the video of the live broadcast of the D host is stopped Data ... and so on, until the live video of interest is selected for a long live video broadcast.
需要说明的是,本实施例中在视频直播的过程中,用户在寻找喜欢的频道或节目时,通过在直播第一视频的时候缓存第二视频的视频数据,使得当检测到切换指令,切换到第二视频进行直播时,可以利用已经缓存的第二视频的视频数据进行直播,如此,避免了由于从随机时间点接入直播视频而带来的“黑屏”状态或者无节目状态;并且,可以实现在用户不断切换直播视频的过程时,使得用户在极短的时间内观看到切入的直播视频,降低了直播视频的首次出现画面的等待时间,实现了比秒开更好的效果;并且,由于在整个切换过程中,在播放前一个视频时会缓存下一个视频的视频数据,因而也克服了直播过程中由于不断切换给用户带来的卡顿感。It should be noted that, during the live broadcast of the video in this embodiment, when the user is looking for a favorite channel or program, the user buffers the video data of the second video when the first video is live, so that when a switch instruction is detected, the switch When the second video is live broadcasted, the cached video data of the second video can be used for live broadcast, thus avoiding the “black screen” state or no program state caused by accessing the live video from a random point in time; and, It can be realized that when the user continuously switches the process of the live video, the user can watch the cut-in live video in a very short time, reducing the waiting time of the first appearance of the live video, and achieving a better effect than the second opening; and During the entire switching process, the video data of the next video will be cached when the previous video is played, which also overcomes the feeling of stutter caused by the continuous switching to the user during the live broadcast.
实施例二Example two
基于上述实施例一,如图2所示,上述步骤105,还包括:Based on the first embodiment, as shown in FIG. 2, the above step 105 further includes:
在检测到所述切换指令时,控制所述第一视频的直播画面从第一方向滑出显示区域;When the switching instruction is detected, controlling the live video of the first video to slide out of the display area from the first direction;
控制所述第二视频的直播画面从所述显示区域的第二方向滑入所述显示区域;Controlling the live broadcast picture of the second video to slide into the display area from a second direction of the display area;
其中,所述第二方向与所述第一方向相反或相同。The second direction is opposite to or the same as the first direction.
这里,所述检测到所述切换指令,可以为:根据用户的操作,检测到接收生成的切换指令。Here, the detecting the switching instruction may be: detecting the generated switching instruction according to a user operation.
这里,可以是通过手指或者其它触控物滑动交互显示屏,以控制所述第一视频的直播画面从第一方向滑出显示区域,和/或,以控制所述第二视频的直播画面从所述显示区域的第二方向划入所述显示区域;其中,所述第一方向和第二方向可以是平行于显示区域横轴的方向,也可以是平行于显示区域纵轴的方向;还可以是任一方位的方向,只要不影响控制将第一视频的直播画面从滑出显示区域、且不影响的控制将所述第二视频的直播画面从所述显示区域滑进即可;所述第一方向与所述第二方向可以为相反的方向或相同。Here, it is possible to slide the interactive display screen with a finger or other touch object to control the live broadcast screen of the first video to slide out of the display area from the first direction, and / or to control the live broadcast screen of the second video from The second direction of the display area is drawn into the display area; wherein the first direction and the second direction may be a direction parallel to the horizontal axis of the display area or a direction parallel to the vertical axis of the display area; It can be in any direction, as long as it does not affect the control to slide the live picture of the first video from the display area, and does not affect the control to slide the live picture of the second video from the display area; The first direction and the second direction may be opposite directions or the same.
所述横轴方向可为显示屏的长边所在的方向;所述纵轴方向可为显示屏的短边所在的方向。The horizontal axis direction may be a direction in which a long side of the display screen is located; and the vertical axis direction may be a direction in which a short side of the display screen is located.
这里,在检测到所述切换指令时,根据所述切换指令,还可以是执行退出第一视频直播到直播APP的主页,滚动交互显示屏以从第一视频切换到第二视频,触控进入第二视频以直播第二视频的操作。Here, when the switching instruction is detected, according to the switching instruction, it may also be executed to exit the homepage of the first video live broadcast to the live broadcast APP, scroll the interactive display screen to switch from the first video to the second video, and touch to enter The second video broadcasts the operation of the second video.
在一些实施例中,所述切换指令可为滑动操作对应的滑动操作指令,还可以是通过语音采集的语音指令,或者,从其他电子设备接收的控制指令,例如,从鼠标或者远程控制设备接收的切换指令。In some embodiments, the switching instruction may be a sliding operation instruction corresponding to a sliding operation, or may be a voice instruction collected through voice, or a control instruction received from another electronic device, for example, received from a mouse or a remote control device. Switch instruction.
进一步地,所述步骤105,还包括:Further, the step 105 further includes:
检测作用于显示交互屏的滑动操作;Detect the sliding operation acting on the display interactive screen;
若检测到所述滑动操作,生成所述切换指令;If the sliding operation is detected, generating the switching instruction;
所述滑动操作的滑动方向为所述第一方向。The sliding direction of the sliding operation is the first direction.
可选地,终端检测用户作用于显示交互屏的滑动操作,所述滑动操作的方向可以为所述第一方向,也可以是与第一方向相反的方向;若检测到所述滑动操作,则生成切换指令。Optionally, the terminal detects a sliding operation performed by the user on the display interactive screen, and the direction of the sliding operation may be the first direction or a direction opposite to the first direction; if the sliding operation is detected, then Generate a switch instruction.
若滑动操作的方向与第一方向相同,如此,与用户的操作惯性相同,可以提升用户体验。If the direction of the sliding operation is the same as the first direction, so that the user's operating inertia is the same, and the user experience can be improved.
实施例三Example three
基于上述实施例一,如图2所示,上述步骤103,还包括:Based on the first embodiment, as shown in FIG. 2, the above step 103 further includes:
在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP。When the first video is broadcast live, at least one group of pictures GOP that is live broadcast at the current moment of the second video is buffered.
所述当前时刻可以理解为:当前时刻点。在播放第一视频的任意一个播放当前时刻点。The current time can be understood as: the current time point. Play the current moment at any one of the first videos.
这里,缓存视频数据可包括:缓存视频流的数据内容。而视频流包括视频帧的集合,以MPEG1、MPEG2、MPEG4和H.264等为例,其是包括画面组(Group of Picture,GOP)集合的视频流。Here, buffering the video data may include: buffering the data content of the video stream. The video stream includes a collection of video frames. Taking MPEG1, MPEG2, MPEG4, and H.264 as examples, it is a video stream including a group of pictures (GOP) set.
在一些实施例中,在直播第一视频时,为第二视频预先分配一个缓存空间,该缓存空间至少可以容纳第二视频的一个GOP;在一些实施例中,所述缓存空间的容量可以至少缓存两个或两个以上的GOP。In some embodiments, when the first video is broadcast live, a cache space is allocated for the second video in advance, and the cache space can accommodate at least one GOP of the second video; in some embodiments, the capacity of the cache space can be at least Cache two or more GOPs.
所述缓存第二视频当前时刻直播的至少一个GOP,可以将当前从网络侧下载的第二视频的GOP写入到所述缓存空间,若缓存空间已经写满,则直接替换距离当前时刻较远的历史时刻缓存的GOP。例如,在所述缓存空间内建立有缓存队列,该缓存队列可为先进先出队列(First In First Out,FIFO),如此,向队列尾部写入一个GOP,则在FIFO的头部先弹出一个GOP。采用这种方式进行第二视频的缓存,一方面不用占用大量的缓存空间,节省了播放终端的缓存容量;另一方面,可以及时的丢弃历史时刻缓存的GOP,减少由于切换错误,切换到直播第二视频时,进入直播选择的GOP不正确(例如,选择了历史时刻的GOP进行当前时刻的直播)的现象,且减少从历史时刻的GOP跳转到下一时刻的GOP导致的直播跳跃不连续的现象,故通过缓存空间的专门设定还提升了第二视频的直播效果。The buffering of at least one GOP of the second video live at the current moment may write the GOP of the second video currently downloaded from the network side into the cache space, and if the cache space is full, directly replace the farther from the current moment Cached GOP for historical moments. For example, a cache queue is established in the cache space, and the cache queue may be a first-in-first-out (FIFO) queue. In this way, if a GOP is written to the end of the queue, a first is popped up at the head of the FIFO. GOP. In this way, the second video is cached, on the one hand, it does not occupy a large amount of cache space, which saves the cache capacity of the playback terminal; on the other hand, it can timely discard the cached GOP at the historical moment, reducing switching to live broadcast due to switching errors In the second video, the GOP selected for entering the live broadcast is incorrect (for example, the GOP at the historical moment is selected for live broadcast at the current moment), and the live broadcast skip caused by the GOP from the historical moment to the GOP at the next moment is reduced. The continuous phenomenon, so the special setting of the cache space also improves the live broadcast effect of the second video.
请再次参考图1,在用户打开A主播的视频内容进行观看时,可以通过预先缓存下一个相邻直播视频B主播的1个GOP或者1个以上GOP集合,将其存放在终端的本地 缓存中。如果用户此时切换视频内容,终端APP可以直接读取缓存中的GOP或GOP集合进行播放,继续下载B主播的其余的视频帧,同时,预先缓存下载直播视频C主播一个或者一个以上GOP存放在本地缓存中,等待用户进行切换。Please refer to FIG. 1 again. When the user opens the video content of the anchor A for viewing, the user may pre-cache a GOP or a set of more than one GOP of the next adjacent live video B anchor and store it in the terminal's local cache. . If the user switches the video content at this time, the terminal APP can directly read the GOP or GOP set in the cache for playback, and continue to download the rest of the video frames of B anchor. At the same time, pre-cache and download the live video C anchor one or more GOPs stored in In the local cache, waiting for the user to switch.
这里,所述GOP包括:I帧、P帧、B帧;其中,Here, the GOP includes: an I frame, a P frame, and a B frame;
I帧,为关键帧,通常是每一个GOP的第一个帧,其能够保留一副完整的画面,解码时只需要本帧数据就可以完成解码;I frame is a key frame, which is usually the first frame of each GOP. It can retain a complete picture. When decoding, only the data of this frame can be used to complete the decoding.
P帧,为前向预测帧,P帧能够保留这一帧与前面一帧的差别,因此在解码时,P帧依赖前一个P帧/I帧;The P frame is a forward prediction frame. The P frame can retain the difference between this frame and the previous frame. Therefore, when decoding, the P frame depends on the previous P frame / I frame;
B帧,为双向预测帧,B帧能够保留这一帧与前后帧的差别,因此在解码时,B帧依赖前一个P帧/I帧和后一个P帧;B帧不是参考帧,不会造成解码错误的扩散。The B frame is a bidirectional prediction frame. The B frame can retain the difference between this frame and the previous and subsequent frames. Therefore, when decoding, the B frame depends on the previous P frame / I frame and the next P frame; the B frame is not a reference frame and will not Causes the proliferation of decoding errors.
在一些实施例中,对于视频点播来讲,其视频文件都是从0秒开始的,而从0秒开始的第一帧是关键帧I帧,因而当用户点击进入点播视频时,其不存在由于进入P帧或B帧而引起的“黑屏”,看到是有画面的视频内容。而对于视频直播来讲,其是在一个随机的时间点接到这个视频流进行播放,而接入的这个时间点的帧可能是I帧,也有可能是P帧或者B帧。而当这个时间点接进去的是P帧或者B帧,这会使的显示交互屏出现“黑屏”状态。因此,需等到下一个关键帧I帧到来时,才能开始出现有画面的视频内容。In some embodiments, for video on demand, the video files all start from 0 seconds, and the first frame from 0 seconds is the key frame I frame, so when the user clicks into the on-demand video, it does not exist. The "black screen" caused by entering P-frames or B-frames is seen as video content with pictures. For live video, it is received at a random point in time to play the video stream, and the frame at this point in time may be an I frame, or a P frame or a B frame. When a P frame or a B frame is connected at this time point, this will cause the display interactive screen to appear in a "black screen" state. Therefore, it is necessary to wait until the next key frame I frame arrives before the video content with pictures can start to appear.
需要说明的是,本实施例通过在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP,当切换直播第二视频时,可以避免直接从时间点P帧或者B帧进入直播视频的可能性;使得进入直播第二视频时,可以通过播放已经预先缓存的GOP,从而使得直播可以从I帧的时间点接入播放,从而使得显示交互屏不会出现“黑屏”状态或者无节目状态,从而避免了在切换过程的“黑屏”或者出现卡顿的问题。It should be noted that in this embodiment, when the first video is broadcast live, at least one frame group GOP of the second video being broadcasted at the current moment is cached. When the live broadcast of the second video is switched, P frames can be avoided directly from the time point. Or the possibility that the B frame enters the live video; when the second video of the live broadcast is entered, the pre-cached GOP can be played, so that the live broadcast can be accessed from the time of the I frame, so that the display interactive screen does not appear " "Blank screen" status or no program status, thereby avoiding the "black screen" or stutter problems during the switching process.
如此,可以使得用户在不断切换直播视频时,避免了首次出现播放画面所需的时间过长的问题;并且,如果缓存的GOP的总间隔时间超过前后关键帧I帧之间的时长,可以实现直播视频切换过程的完全无缝连接播放。In this way, users can avoid the problem that the time required for the first time to play the picture appears for the first time when the live video is continuously switched; and, if the total interval time of the buffered GOP exceeds the time period between the key frames before and after the key frame, it can be achieved Fully seamless playback of live video switching process.
实施例四Embodiment 4
基于上述实施例三,如图2所示,所述步骤103还包括:在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个第一类GOP,其中,所述第一类GOP包括:I 帧、B帧和P帧。Based on the foregoing third embodiment, as shown in FIG. 2, the step 103 further includes: buffering at least one first-type GOP of the second video at the current moment when the first video is broadcasted live, wherein the first One type of GOP includes: I-frame, B-frame, and P-frame.
这里,当终端连接的网络为WIFI或者有线网络时,或者,当用户配置为缓存第一类GOP集合时,或者对网络的流量没有限制的其它情况时,终端缓存所述第二视频当前时刻直播的至少一个第一类GOP。Here, when the network to which the terminal is connected is WIFI or a wired network, or when the user is configured to cache the first type of GOP set, or in other cases where there is no restriction on the network traffic, the terminal caches the live broadcast of the second video at the current moment. At least one first-class GOP.
如此,本实施例可以在降低用户不断切换带来的卡顿感时,还能观看到清晰的画面。In this way, in this embodiment, a clear picture can be viewed when the sense of stutter caused by the user's continuous switching is reduced.
实施例五Example 5
基于上述实施例三,如图2所示,所述步骤103还包括:在直播所述第一视频时,缓存至少一个第二类GOP或者至少一个第三类GOP;Based on the foregoing third embodiment, as shown in FIG. 2, the step 103 further includes: buffering at least one second-type GOP or at least one third-type GOP when the first video is broadcast live;
所述第二类GOP相比第一类GOP缺少B帧;所述第三类GOP相比所述第一类GOP缺少B帧和P帧。The second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
这里,缓存丢掉B帧,或者丢掉P帧和B帧的GOP,可在终端请求缓存的第二视频的GOP时,携带缓存视频流类型为主动丢帧模式的指示标识;其中,可选的丢帧类型包括:丢掉B帧,或者丢掉P帧和B帧的类型。Here, when the buffer drops B frames, or G frames of P frames and B frames, when the terminal requests the GOP of the cached second video, it can carry an indication that the buffered video stream type is an active frame loss mode. Among them, optional drop Frame types include: types of dropping B frames, or dropping P and B frames.
在一些实施例中,在基于GOP结构的视频编码标准中,每个GOP必须以一个I帧开始,其后紧随着一系列P帧和B帧。由于I帧为帧内独立解码,解码时不需要参考其它帧,就能解码出完整的画面;而P帧由于为前向预测编码,解码时需要参考位于它之前的I帧或P帧;而B帧为双向预测解码,解码时需要参考位于它前后两侧的I帧或P帧;当决定丢某个帧时,该GOP中所有直接或间接依赖于该帧的其它帧都必须被丢弃,否者会导致解码器错误或失败。In some embodiments, in a video coding standard based on the GOP structure, each GOP must start with an I frame, followed by a series of P frames and B frames. Because the I frame is decoded independently within the frame, the entire picture can be decoded without reference to other frames when decoding; while the P frame is forward predictive coding, it needs to refer to the I frame or P frame before it; The B frame is bidirectional predictive decoding. When decoding, it needs to refer to the I frame or P frame located on the front and back sides of the frame. When a frame is decided to be dropped, all other frames in the GOP that depend directly or indirectly on the frame must be discarded. Otherwise, it will cause decoder error or failure.
根据上述丢帧原则和帧间依赖关系,每个B帧都可以随机丢弃;当丢弃一个P帧时,当前GOP中按解码顺序位于该P帧之后的所有其它P帧和B帧都应该丢弃;当丢弃一个I帧时,当前GOP中所有帧的也都应该丢弃。According to the above frame dropping principles and inter-frame dependencies, each B frame can be dropped randomly; when a P frame is dropped, all other P frames and B frames in the current GOP that are located after the P frame in decoding order should be dropped; When an I frame is dropped, all frames in the current GOP should also be dropped.
因而如果丢掉B帧,只保留I帧和P帧,则画面的清晰度受到一定的影响,但是对感官的影响并不显著;如果丢掉P帧,则B帧也不能解码,所以丢掉P帧的同时,B帧也会丢掉,此时一个GOP只有I帧,如果一个GOP间隔为2S,则可以每2S看到实时的动态的图片。Therefore, if B frames are dropped and only I and P frames are retained, the sharpness of the picture is affected to some extent, but the effect on the senses is not significant; if P frames are dropped, B frames cannot be decoded, so the P frames are dropped. At the same time, B frames will also be dropped. At this time, a GOP has only I frames. If a GOP interval is 2S, you can see real-time dynamic pictures every 2S.
如此,如果丢掉B帧,则所述切换到直播第二视频时,开始播放时刻的画面清晰度 会受到一定的影响,但是,画面的完整度并没有受到影响;同时,还可以部分解决流量的问题。如果丢掉P帧和B帧,此种情况,虽然画面的清晰度也同样受到影响,但是仍然能观看到的是单个GOP时间为间隔的实时的动态的图片,如果单个GOP的时间比较足够小,小于人眼的反映时间,还是可以看到连续的视频播放画面。In this way, if the B frame is dropped, when the switching to the live broadcast second video, the picture clarity at the start of playback will be affected to some extent, but the integrity of the picture is not affected; at the same time, the traffic can be partially resolved. problem. If the P and B frames are discarded, in this case, although the sharpness of the picture is also affected, you can still watch a real-time dynamic picture with a single GOP time interval. If the time of a single GOP is relatively small, Less than the reflection time of the human eye, you can still see continuous video playback.
需要说明的是,在直播所述第一视频时,如果缓存第二视频的视频数据为不完整的GOP,比如,丢掉B帧或者丢掉P帧和B帧的GOP,在切换到直播第二视频时,不影响其重新缓存完整的其它GOP。因而,对直播第二视频时,即使在上述步骤103中是缓存的不完整的GOP的视频流,也不影响后续缓存所述第二视频的完整的GOP的视频流,从而直播所述第二视频的视频内容。并且,由于在切换到第二视频时后比较短的时间内,便即可重新缓存完整的GOP集合,因而在用户感受方面,即使一小段时间内是播放丢掉B帧或P帧和B帧的GOP的视频内容,也不影响用户观看的整个视频的直观感受。如此,可以大大节省流量,对于一些限制流量的电子设备用户,可以大大提高用户观看视频直播的体验。It should be noted that, when the first video is live broadcasted, if the video data of the cached second video is an incomplete GOP, for example, the GOP of B frame or P frame and B frame is discarded, and the second video is switched to live broadcast , It does not affect its rebuffering of other GOPs. Therefore, when the second video is broadcast live, even if the incomplete GOP video stream buffered in the above step 103 does not affect the subsequent cache of the complete GOP video stream of the second video, the second video is broadcast live. The video content of the video. In addition, since the complete GOP set can be re-buffered in a relatively short time after switching to the second video, in terms of user experience, even if B frames or P frames and B frames are dropped for a short period of time, GOP video content does not affect the intuitive feeling of the entire video viewed by the user. In this way, traffic can be greatly saved, and for some electronic device users with limited traffic, the user's experience of watching live video can be greatly improved.
实施例六Example Six
基于上述实施例三,如图3所示,所述步骤105之前,还包括步骤104:检测直播所述第一视频的时长是否超过设置的阈值;Based on the third embodiment, as shown in FIG. 3, before step 105, the method further includes step 104: detecting whether the duration of the live broadcast of the first video exceeds a set threshold;
若直播所述第一视频的时长超过所述阈值,停止所述第二视频的视频数据的缓存。If the duration of the live broadcast of the first video exceeds the threshold, the buffering of video data of the second video is stopped.
可选地,检测直播所述第一视频的时长是否超过设置的阈值,可以在直播第一视频开始时刻,设置启动一定时器,以记录直播第一视频的时长;当终端直播所述第一视频的时长超过设置的阈值时间时,则终端停止对所述第二视频的视频数据的缓存。Optionally, to detect whether the duration of the live broadcast of the first video exceeds a set threshold, a timer may be set to start at the start time of the live broadcast of the first video to record the duration of the live broadcast of the first video; When the duration of the video exceeds a set threshold time, the terminal stops buffering the video data of the second video.
这里,所述设置的阈值,可以根据用户以往浏览直播视频的历史记录,停留在直播视频的时长而设定;例如,用户停留在A主播的直播视频超过30s可认为用户对A主播的直播视频感兴趣,从而会长时间停留在A主播的直播视频的页面,如此,可所设置的阈值可以为30s;不同的用户,所设置的阈值时间可以是不同;同一用户对应不同类型的直播视频,所设置的阈值时间也可以是不同。Here, the set threshold may be set according to the history of the user ’s previous browsing of the live video and staying on the live video; for example, if the user stays on A's live broadcast for more than 30s, the user can be regarded as the user ’s live video on A ’s live broadcast. If you are interested, you will stay on the page of A's live video for a long time. In this way, the threshold that can be set can be 30s; different users can set the threshold time differently; the same user corresponds to different types of live video, The set threshold time can also be different.
这里,从一直播视频切换到直播另一直播视频时,都需重新设置定时器的阈值时间,所设置的阈值时间,可以是与上个阈值相同或者不同的阈值时长。例如,对于A主播的直播视频,设置定时器的阈值时间为30s;对于B主播的直播视频,设置的定时器的阈值时间可以为15s。当终端APP从A主播的直播视频切换到B主播的直播视频,则从 直播B主播的直播视频的开始时刻,从0开始计时,所设置的阈值时间为15s。Here, when switching from one live video to another live video, the threshold time of the timer needs to be reset. The set threshold time may be the same as or different from the previous threshold. For example, for the live video of the A host, the threshold time of the timer is set to 30s; for the live video of the B host, the threshold time of the timer can be set to 15s. When the terminal APP switches from the live video of the anchor A to the live video of the anchor B, the timing from the start time of the live broadcast of the live broadcast of the B anchor is counted from 0, and the set threshold time is 15s.
需要说明的是,本实施例中,检测直播所述第一视频的时长是否超过设置的阈值,来推断用户是否对所述第一视频的内容是否感兴趣,从而确定是否会长时间停留在所述第一视频,观看所述第一视频的视频内容。若当确定停留时间是超过设定的阈值时间时,则确定用户会长时间停留在所述第一视频,如此,短时间内不会切换到第二视频,通过停止对第二视频的视频数据的缓存,可以节省缓存空间;并且,由于不需要执行同步缓存第二视频的视频数据,还能降低终端设备电量的耗损,从而达到节省电能的目的。It should be noted that, in this embodiment, it is detected whether the duration of the live broadcast of the first video exceeds a set threshold to infer whether the user is interested in the content of the first video, so as to determine whether it will stay in the place for a long time. The first video is described, and the video content of the first video is viewed. If it is determined that the dwell time exceeds the set threshold time, it is determined that the user will stay on the first video for a long time, so that it will not switch to the second video in a short time, and by stopping the video data of the second video The cache can save the cache space; and because it does not need to perform synchronous buffering of the video data of the second video, it can also reduce the power consumption of the terminal device, thereby achieving the purpose of saving power.
实施例七Example Seven
基于上述实施例一,如图4所示,在步骤103之前,还包括步骤102,确定是否满足缓存条件;Based on the first embodiment, as shown in FIG. 4, before step 103, step 102 is further included to determine whether a cache condition is satisfied;
具体地,终端确定是否满足缓存条件。Specifically, the terminal determines whether the cache condition is satisfied.
所述步骤103包括:若满足所述缓存条件,在直播所述第一视频时缓存所述第二视频的视频数据。The step 103 includes: if the buffer condition is satisfied, buffering video data of the second video when the first video is live broadcasted.
进一步地,所述步骤102中确定是否满足缓存条件,包括以下至少之一:Further, determining whether the cache condition is satisfied in step 102 includes at least one of the following:
场景一、若检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足所述缓存条件;Scenario 1: if it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, it is determined that the cache condition is satisfied;
场景二、若检测到直播设备的当前带宽不小于接收所述第一视频和所述第二视频的视频数据所需带宽之和,确定满足所述缓存条件;Scenario 2: if it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required to receive video data of the first video and the second video, it is determined that the cache condition is satisfied;
场景三、若检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件;Scenario 3: if it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied;
场景四、若所述直播设备的配置数据指示缓存所述第二视频,确定满足所述缓存条件;Scenario 4. If the configuration data of the live broadcast device indicates that the second video is cached, it is determined that the cache condition is satisfied;
场景五、若所述直播设备的配置数据指示缓存所述第二视频且检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足缓存条件;Scenario 5. If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive the video data of the first video, it is determined that the cache condition is satisfied;
场景六、若所述直播设备的配置数据指示缓存所述第二视频且检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件。Scenario 6. If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
这里,所述直播设备为终端,可以是台式电脑、智能手机、平板电脑,或者其他电 子设备;所述直播设备为进行视频直播的电子设备。Here, the live broadcast device is a terminal, which may be a desktop computer, a smart phone, a tablet computer, or other electronic equipment; the live broadcast device is an electronic device that performs video live broadcast.
需要说明的是,对于场景一、若检测到直播设备的当前带宽大于接收第一视频的视频数据所需的带宽时,可以确定所述直播设备的带宽可以缓存第一视频的视频数据前提下,还至少有多余的一部分带宽可以进行第二视频的视频数据的缓存。It should be noted that, for scenario 1, if it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive the video data of the first video, it may be determined that the bandwidth of the live broadcast device can cache the video data of the first video, There is also at least a part of the excess bandwidth for buffering the video data of the second video.
对于场景二,若检测到所述直播设备的当前带宽不小于接收所述第一视频和所述第二视频的视频数据所需带宽之和时,可以确定所述直播设备有足够的带宽进行第一视频和第二视频的视频数据的缓存。For scenario two, if it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required to receive video data of the first video and the second video, it may be determined that the live broadcast device has sufficient bandwidth for the first time. Cache of video data for one video and second video.
对于场景三,若检测到所述直播设备当前连接的网络为预定类型网络时,确定所述直播设备有足够的带宽进行第一视频和第二视频的视频数据的缓存。For scenario three, if it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the live broadcast device has sufficient bandwidth to cache the video data of the first video and the second video.
对于场景四,若所述直播设备的配置数据指示缓存所述第二视频时,确定所述直播设备的带宽可以缓存第一视频的视频数据的前提下,还可以至少缓存第二视频的视频数据。For scenario 4, if the configuration data of the live broadcast device indicates that the second video is cached, it is determined that the bandwidth of the live broadcast device can cache the video data of the first video, and at least the video data of the second video may be cached. .
对于场景五,若所述直播设备的配置数据执行缓存所述第二视频且检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定所述直播设备的带宽可以缓存第一视频的视频数据前提下,还至少有多余的一部分带宽可以进行第二视频的视频数据的缓存。For scenario 5, if the configuration data of the live broadcast device executes buffering the second video and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive the video data of the first video, it is determined that the bandwidth of the live broadcast device may be On the premise of buffering the video data of the first video, there is still at least a part of the excess bandwidth for buffering the video data of the second video.
对于场景六,若所述直播设备的配置数据指示缓存所述第二视频且检测到所述直播设备当前连接的网络为预定类型网络,确定所述直播设备的带宽可以缓存所述第一视频的视频数据前提下,可以至少缓存第二视频的视频数据。For scenario 6, if the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the bandwidth of the live broadcast device can cache the first video. On the premise of video data, video data of at least the second video may be cached.
需要说明的是,本实施例可以根据直播设备的带宽是否满足条件的情况,实现是否对下一个直播视频的视频数据进行预先缓存。It should be noted that, in this embodiment, whether to buffer the video data of the next live video in advance may be implemented according to whether the bandwidth of the live broadcast device meets the conditions.
实施例八Example eight
基于实施例一,如图5所示,在步骤103之前,还包括步骤106,根据视频之间的关联关系,确定所述第二视频。Based on the first embodiment, as shown in FIG. 5, before step 103, step 106 is further included to determine the second video according to the association relationship between the videos.
进一步地,所述步骤106,还包括:Further, the step 106 further includes:
根据在视频直播选择页面直播链接的显示位置关系,选择与所述第一视频的第一直播链接相邻的第二直播链接对应的视频为所述第二视频。According to the display position relationship of the live link on the live video selection page, a video corresponding to a second live link adjacent to the first live link of the first video is selected as the second video.
需要说明的是,在另一个实施例中,所述根据视频之间的关联关系,确定所述第二视频,还可以是:根据交互显示屏上直播视频的主页的显示位置关系,选择与第一视频 的主页相邻或者邻近直播视频主页对应的直播视频为第二视频。It should be noted that, in another embodiment, the determining the second video according to the association relationship between the videos may further be: selecting the first video according to the display position relationship of the homepage of the live video on the interactive display screen. The live video corresponding to the homepage of a video adjacent to or adjacent to the homepage of the live video is the second video.
在另一实施例中,所述根据视频之间的关联关系,确定所述第二视频,还可以是:根据在视频直播选择页面直播链接的显示位置关系,选择与所述第一视频的第一直播连接相隔一个或一个以上的直播链接的第三直播链接对应的视频为所述第二视频。In another embodiment, the determining the second video according to the association relationship between the videos may further be: selecting a first connection with the first video according to a display position relationship of the live link on the live video selection page. The video corresponding to the third live link of one live link separated by one or more live links is the second video.
实施例九Example Nine
为了进一步解释说明,本发明还提出了一种视频直播处理方法,所述方法主要是针对终端接收第一类GOP的情景;所述第一类GOP为完整的GOP,所述第一类GOP包括:I帧、P帧和B帧;如图6所示,所述方法包括以下步骤。In order to further explain, the present invention also proposes a live video processing method. The method is mainly directed to a scenario where a terminal receives a first type of GOP; the first type of GOP is a complete GOP, and the first type of GOP includes : I frame, P frame, and B frame; as shown in FIG. 6, the method includes the following steps.
步骤S001:选取直播视频A;并设置定时器T1;Step S001: Select live video A; and set timer T1;
可选地,启动终端设备;点击进入终端APP页面;点击选择终端APP中直播视频类别中的某一个直播视频A;在终端APP设置定时器,所述定时器设置为从终端APP直播A的开始时刻开始计时,设置的阈值时间为T1;其中,所述终端APP为进行视频直播的应用程序,例如可以是映客直播软件、花椒直播软件、虎牙直播软件、斗鱼直播软件,等等Optionally, start the terminal device; click to enter the terminal APP page; click to select a certain live video A in the live video category in the terminal APP; set a timer in the terminal APP, and the timer is set to start from the live broadcast A of the terminal APP The timing starts at the moment, and the set threshold time is T1; wherein the terminal APP is an application program for live video broadcasting, for example, it can be Yingke live software, pepper pepper live software, Huya live software, Douyu live software, etc.
这里,通过设置定时器的阈值时间,可以根据终端APP后续在A视频上直播停留的时长,来判断用户是否可能长时间直播视频A。Here, by setting the threshold time of the timer, it is possible to determine whether the user may broadcast video A for a long time according to the duration of the terminal APP's subsequent live broadcast on video A.
步骤S002:发送拉取A媒体流的请求;Step S002: Send a request to pull A media stream;
可选地,终端APP向媒体服务器发送拉取A媒体流的请求。Optionally, the terminal APP sends a request for pulling the A media stream to the media server.
步骤S003:推送A媒体流;Step S003: Push A media stream;
可选地,媒体服务器向终端APP推送A媒体流;所述媒体流可以理解为上述实施例一中的视频数据,所述媒体流包括:视频流和音频流。Optionally, the media server pushes A media stream to the terminal APP; the media stream may be understood as the video data in the first embodiment, and the media stream includes a video stream and an audio stream.
步骤S004:直播A媒体流;Step S004: Live A media stream;
可选地,终端APP接收到媒体服务器发送的A媒体流后,终端APP解码A媒体流。Optionally, after the terminal APP receives the A media stream sent by the media server, the terminal APP decodes the A media stream.
步骤S005:发送拉取相邻B媒体流的请求;Step S005: Send a request to pull a neighboring B media stream;
可选地,在终端APP正常播放A媒体流的同时,终端APP向媒体服务器发送拉取与视频A的直播链接相邻的第二直播连接对应的视频B的媒体流的请求;终端APP检测到当前接入的网络为WIFI或者有线网络,或者,用户配置为预先缓存第一类GOP时,则 向媒体服务器发送拉取包括第一类GOP的媒体流的请求。Optionally, while the terminal APP normally plays the A stream, the terminal APP sends a request to the media server to pull the media stream of the video B corresponding to the second live connection adjacent to the live link of the video A; the terminal APP detects that When the currently accessed network is WIFI or a wired network, or when the user is configured to pre-cache the first type of GOP, a request to pull a media stream including the first type of GOP to the media server is sent.
这里,所述第一类GOP,包括:I帧、B帧和P帧。Here, the first type of GOP includes: I frame, B frame, and P frame.
步骤S006:推送B媒体流;Step S006: Push the B media stream;
可选地,媒体服务器接收终端APP发送的请求后,媒体服务器向终端APP推送B媒体流;所述B媒体流包括:B视频流和B音频流。Optionally, after the media server receives the request sent by the terminal APP, the media server pushes the B media stream to the terminal APP; the B media stream includes: a B video stream and a B audio stream.
这里,推送的媒体流中的GOP为第一类GOP。Here, the GOP in the pushed media stream is the first type of GOP.
步骤S007:保存B媒体流的1个或N个GOP;Step S007: Save 1 or N GOPs of the B media stream;
可选地,将B媒体流中的1个或N个第一类GOP缓存在终端的本地缓存中;其中,所述N为大于1的自然数。Optionally, one or N first-type GOPs in the B media stream are buffered in a local cache of the terminal; where N is a natural number greater than 1.
步骤S008:接收切换指令,控制直播B媒体流;并重设T1定时器;Step S008: receiving a switching instruction to control the live B media stream; and resetting the T1 timer;
可选地,终端检测直播A媒体流的时长;若在直播A媒体流的时长小于T1之前,终端接收到切换指令,则终端APP根据切换指令,控制直播B媒体流;并且,终端重新设置定时器的时间;所述定时器设置为从直播B媒体流的开始时刻开始计时,阈值时间为T1。Optionally, the terminal detects the duration of the live A media stream; if the terminal receives a switching instruction before the duration of the live A media stream is less than T1, the terminal APP controls the live B media stream according to the switching instruction; and the terminal resets the timing The timer is set to start counting from the start time of the live B media stream, and the threshold time is T1.
这里,所述根据切换指令以控制直播B媒体流,可以是通过在终端APP的直播显示区域执行滑动操作,切换到视频B以直播B媒体流;或者,可以是执行其它操作以切换到视频B直播B媒体流。Here, according to the switching instruction to control the live B media stream, it may be performed by performing a sliding operation in the live broadcast display area of the terminal APP to switch to video B to live the B media stream; or it may be performed other operations to switch to video B Live B media stream.
这里,重新设置定时器的时间可以与T1不同。Here, the time for resetting the timer may be different from T1.
步骤S009:播放缓存的B媒体流的1个或者N个GOP;Step S009: playing one or N GOPs of the buffered B media stream;
可选地,终端判断本地缓存空间中是否存在B媒体流;如果存在,终端APP播放本地缓存空间中缓存的B媒体流;具体地,播放缓存的B媒体流的1个第一类GOP或N个第一类GOP集合。Optionally, the terminal determines whether a B media stream exists in the local cache space; if so, the terminal APP plays the B media stream cached in the local cache space; specifically, plays a first-type GOP or N of the cached B media stream GOP of the first kind.
步骤S010:发送继续拉取B媒体流的请求;Step S010: Send a request to continue pulling the B media stream;
可选地,终端APP向媒体服务器发送继续拉取B媒体流的请求;其中,可以是发送未缓存的B媒体流的第一类GOP的请求;或者,发送未缓存的B媒体流的第一类GOP以及发送已缓存在本地缓存空间但未开始播放的B媒体流的第一类GOP。Optionally, the terminal APP sends a request to the media server to continue to pull the B media stream; wherein, it may be a request to send the first type of GOP of the unbuffered B media stream; or the first request to send the unbuffered B media stream GOP-like and GOP of the first type that sends a B media stream that has been buffered in the local cache space but has not started to play.
步骤S011:继续推送B媒体流;Step S011: continue to push the B media stream;
可选地,媒体服务器向终端APP继续推送B媒体流;终端APP接收到B媒体流后, 解码B媒体流;将解码后的B被媒体流正常显示以进行视频B的正常直播;所述B媒体流包括:B视频流和B音频流,所述B媒体流包括第一类GOP集合。Optionally, the media server continues to push the B media stream to the terminal APP; after the terminal APP receives the B media stream, it decodes the B media stream; the decoded B is normally displayed by the media stream for the normal live broadcast of the video B; said B The media stream includes: a B video stream and a B audio stream, and the B media stream includes a first type GOP set.
步骤S012:发送拉取相邻C媒体流的请求;Step S012: Send a request to pull a neighboring C media stream;
可选地,在正常播放B媒体流的同时,终端APP向媒体服务器发送拉取与视频B的直播链接相邻的第三直播连接对应的视频C的媒体流的请求;终端APP检测到当前接入的网络为WIFI或者有线网络,或者,用户配置为预先缓存第一类GOP时,则向媒体服务器发送拉取第一类GOP的请求。Optionally, while the B media stream is normally played, the terminal APP sends a request to the media server to pull the media stream of the video C corresponding to the third live connection adjacent to the live link of the video B; the terminal APP detects the current connection The incoming network is WIFI or a wired network, or when the user is configured to pre-cache the first type of GOP, a request to pull the first type of GOP is sent to the media server.
这里,所述第一类GOP包括:I帧、B帧和P帧。Here, the first type of GOP includes: an I frame, a B frame, and a P frame.
步骤S013:推送C媒体流;Step S013: Push the C media stream;
可选地,媒体服务器接收终端APP发送的请求后,媒体服务器向终端APP推送C媒体流;所述C媒体流包括:C视频流和C音频流,所述C视频流为包括1个或N个第一类GOP的视频流。Optionally, after the media server receives the request sent by the terminal APP, the media server pushes a C media stream to the terminal APP; the C media stream includes a C video stream and a C audio stream, and the C video stream includes one or N A first type of GOP video stream.
步骤S014:保存C媒体流的1个或N个GOP;Step S014: save 1 or N GOPs of the C media stream;
可选地,将C视频流的1个第一类GOP或N个第一类GOP集合缓存在本地缓存中;其中,所述N为大于1的自然数。Optionally, one first-type GOP or N first-type GOP sets of the C video stream is cached in a local cache; where N is a natural number greater than 1.
步骤S015:不再更换视频;Step S015: no longer change the video;
可选地,终端APP持续直播B媒体流。Optionally, the terminal APP continuously broadcasts the B media stream.
这里,终端APP持续直播B媒体流,说明终端用户对视频B感兴趣。Here, the terminal APP continuously broadcasts the B media stream, indicating that the end user is interested in video B.
步骤S016:检测到T1时间超时;Step S016: T1 timeout is detected;
可选地,终端检测到终端APP持续直播B媒体流的时长超过定时器的阈值时间T1。Optionally, the terminal detects that the duration of the terminal APP's continuous live broadcast of the B media stream exceeds the threshold time T1 of the timer.
步骤S017,发送停止推送C的媒体流的请求,并断开连接;Step S017: Send a request to stop pushing the media stream of C, and disconnect the connection;
可选地,当终端APP直播B媒体流的时长超过时间T1,终端APP向媒体服务发送停止推送C媒体流的请求;并通过断开终端APP与媒体服务器之间的传输协议来停止接收C媒体流。Optionally, when the duration of the live broadcast of the B media stream of the terminal APP exceeds the time T1, the terminal APP sends a request to the media service to stop pushing the C media stream; and stops receiving the C media by disconnecting the transmission protocol between the terminal APP and the media server. flow.
步骤S018,清除C的媒体流的缓存。Step S018: Clear the cache of the media stream of C.
可选地,终端将缓存空间中C媒体流清除。Optionally, the terminal clears the C media stream in the buffer space.
需要说明的是,本实施例中在视频直播的过程中,用户在寻找喜欢的频道或者节目时,可通过滑动连续不断的切换直播视频;通过在播放A视频时预先缓存B视频的媒体 流的一个GOP或N个GOP集合,通过播放B视频的媒体流时预先缓存C视频的媒体流的一个GOP或N个GOP集合,可以避免由于切换而引起的“黑屏”状态或者无节目状态,可以实现在除了首个直播的视频A外,其它直播的视频的首次出现画面的等待时间短,实现比秒开的时间短。It should be noted that, in this embodiment, during the live broadcast of the video, the user can continuously switch the live video by sliding when searching for a favorite channel or program; by pre-buffering the media stream of the B video during the playback of the A video One GOP or N GOP set. By playing a GOP or N GOP set of the C video media stream in advance when playing the B video media stream, the "black screen" state or no program state caused by switching can be avoided, which can be achieved. In addition to the first live video A, the waiting time for the first appearance of other live videos is short, which is shorter than the second open time.
如此,本实施例极大的降低了卡顿率,使得整个直播过程都能呈现有画面的状态,极大提高了用户的满意度。In this way, this embodiment greatly reduces the stall rate, so that the entire live broadcast process can present a picture state, which greatly improves user satisfaction.
需要说明的是,本实施例中在播放一个直播视频的同时,缓存下一个直播视频时都是缓存的第一类GOP,由于第一类GOP为完整的帧集合,包括I帧、B帧和P帧,因而在直播切换直播视频时,可以使得用户观看到完整帧率的视频内容,因而能观看到非常清晰的画面,更加增加了用户的满意度。It should be noted that, in this embodiment, when a live video is played, the first type of GOP is cached when the next live video is cached. Since the first type of GOP is a complete frame set, including I frames, B frames, and P-frame, so when switching live video, users can watch the video content at the full frame rate, so they can watch very clear pictures and increase user satisfaction.
实施例十Example 10
为了进一步解释说明,本发明还提出了一种视频直播处理方法,所述方法主要是针对终端接收第二类GOP/第三类GOP的情景;所述第二类GOP相比第一类GOP丢弃B帧,所述第二类GOP相比第一类GOP丢弃B帧和P帧;如图7所示,所述方法包括以下步骤。In order to further explain, the present invention also proposes a live video processing method. The method is mainly for a scenario in which a terminal receives a second type of GOP / a third type of GOP; the second type of GOP is discarded compared to the first type of GOP. B frame, the second type of GOP discards B frame and P frame compared to the first type of GOP; as shown in FIG. 7, the method includes the following steps.
步骤S201:选取直播视频A;并设置定时器T1;Step S201: Select live video A; and set timer T1;
可选地,启动终端设备;点击进入终端APP页面;点击选择终端APP中直播视频类别中的某一个直播视频A;在终端APP设置定时器,所述定时器设置为从终端APP直播A的开始时刻开始计时,设置的阈值时间为T1;其中,所述终端APP为进行视频直播的应用程序,例如可以是陌陌直播软件、花椒直播软件、虎牙直播软件、斗鱼直播软件、直播吧软件,等等Optionally, start the terminal device; click to enter the terminal APP page; click to select a certain live video A in the live video category in the terminal APP; set a timer in the terminal APP, and the timer is set to start from the live broadcast A of the terminal APP The timing starts at the moment, and the set threshold time is T1. Among them, the terminal APP is an application program for performing live video streaming, such as Momo Live Streaming Software, Zanthoxy Live Streaming Software, Huya Live Streaming Software, Douyu Live Streaming Software, and Live Bar Software. and many more
这里,通过设置定时器的阈值时间,可以根据终端APP后续在A视频上直播停留的时长,来判断用户是否可能长时间直播视频A。Here, by setting the threshold time of the timer, it is possible to determine whether the user may broadcast video A for a long time according to the duration of the terminal APP's subsequent live broadcast on video A.
步骤S202:发送拉取A媒体流的请求;Step S202: Send a request to pull A media stream;
可选地,终端APP向媒体服务器发送拉取A媒体流的请求。Optionally, the terminal APP sends a request for pulling the A media stream to the media server.
步骤S203:推送A媒体流;Step S203: Push A media stream;
可选地,媒体服务器向终端APP推送A媒体流;所述A媒体流包括:A视频流和A音频流。Optionally, the media server pushes A media stream to the terminal APP; the A media stream includes: A video stream and A audio stream.
步骤S204:直播A媒体流;Step S204: Live A media stream;
可选地,终端APP接收到媒体服务器发送的A媒体流后,终端APP解码A媒体流。Optionally, after the terminal APP receives the A media stream sent by the media server, the terminal APP decodes the A media stream.
步骤S205:发送拉取相邻B媒体流的请求;所述请求中携带丢帧的指示标识;Step S205: sending a request for pulling the neighboring B media stream; the request carries an indication of frame loss;
可选地,在终端APP正常播放A媒体流的同时,终端APP向媒体服务器发送拉取与视频A的直播链接相邻的第二直播连接对应的视频B的媒体流的请求;并在所述请求中携带丢帧的指示标识,所述丢帧的指示标识为:丢掉B帧的指示标识,或者,丢掉B帧和P帧的指示标识。Optionally, while the terminal APP normally plays the A stream, the terminal APP sends a request to the media server to pull the media stream of the video B corresponding to the second live connection adjacent to the live link of the video A; and The request carries an indication of dropped frames, and the indication of dropped frames is: the indication of dropped B frames, or the indication of dropped B and P frames.
这里,需要说明的是,所述请求中携带丢帧的指示标识,实际上,请求的是拉取不完整的GOP;例如,在一实施例中,携带丢掉B帧的指示标识的请求,则为拉取第二类GOP;在另一实施例中,携带丢掉B帧和P帧的指示标识的请求,则为拉取第三类GOP;其中,所述第二类GOP包括:P帧和I帧;所述第三类GOP包括:I帧。Here, it should be noted that the request carries the indication identifier of the dropped frame. In fact, the request is to pull an incomplete GOP. For example, in one embodiment, the request carries the indication identifier of the dropped B frame. In order to pull the second type of GOP, in another embodiment, the request carrying the indication identifiers of the dropped B and P frames is to pull the third type of GOP; wherein the second type of GOP includes: P frame and I frame; the third type of GOP includes: I frame.
在另一实施例中,所述请求中可携带丢掉B帧的指示标识,和丢掉P帧和B帧的指示标识。例如,在所述拉取相邻B媒体流的请求中携带当前时刻最近的第1个GOP为丢掉B帧的指示标识,和携带当前时刻最近的第2个至第5个GOP为丢掉B帧和P帧的指示标识。In another embodiment, the request may carry an indication identifier for dropping a B frame and an indication identifier for dropping a P frame and a B frame. For example, the request to pull adjacent B media streams carries the indication that the most recent GOP at the current moment is the discarded B frame, and the carrying the most recent 2 to 5 GOPs at the current moment is the discarded B frame And the indication identifier of the P frame.
在另一实施例中,还可以是,在所述拉取相邻B媒体流的请求中携带当前时刻最近第1个至第3个GOP为丢掉B帧和P帧的指示标识,和携带当前时刻最近的第4个GOP为丢掉B帧的指示标识,和携带当前时刻最近的第5个GOP为完整的GOP的指示标识。In another embodiment, the request for pulling the adjacent B media stream may also carry an indication identifier that the most recent first to third GOPs at the current moment are the dropped B frame and P frame, and carry the current The fourth GOP with the most recent moment is the indication that the B frame is dropped, and the indication that the fifth GOP with the most recent moment is the complete GOP.
步骤S206:推送B媒体流;Step S206: Push the B media stream;
可选地,媒体服务器接收终端APP发送的请求后,媒体服务器向终端APP推送B媒体流;所述B媒体流包括:B视频流和B音频流;所述B视频流为包括1个第二类/第三类GOP或N个第二类/第三类GOP集合的视频流。Optionally, after the media server receives the request sent by the terminal APP, the media server pushes the B media stream to the terminal APP; the B media stream includes: a B video stream and a B audio stream; and the B video stream includes a second Class / Third GOP or N Second / Third GOP Set Video Streams.
这里,需要说明的是,虽然推送B视频流为不完整的GOP,比如第二类GOP或第三类GOP;但是,所述B视频流对应的音频流并不丢帧,推送的给终端APP的音频流不变。Here, it should be noted that although the push B video stream is an incomplete GOP, such as a second type GOP or a third type GOP; however, the audio stream corresponding to the B video stream does not drop frames and is pushed to the terminal APP The audio stream is unchanged.
这里,需要说明是,可以控制推送B视频流为第二类GOP和第三类GOP的集合;对应地,所述请求中可携带丢掉B帧指示,和丢掉P帧和B帧的指示。Here, it needs to be explained that the push B video stream can be controlled to be a set of the second type of GOP and the third type of GOP; correspondingly, the request may carry an instruction for dropping B frames and an instruction for dropping P frames and B frames.
步骤S207:保存B媒体流的1个或N个GOP;Step S207: Save one or N GOPs of the B media stream;
可选地,将B媒体流的1个或N个第二类/第三类GOP缓存在终端的本地缓存中; 其中,所述N为大于1的自然数。Optionally, one or N second-type / third-type GOPs of the B media stream are buffered in a local cache of the terminal; where N is a natural number greater than 1.
步骤S208:接收切换指令,控制直播B媒体流;并重设T1定时器;Step S208: receiving a switching instruction, controlling the live B media stream; and resetting the T1 timer;
可选地,终端检测直播A媒体流的时长;若在直播A媒体流的时长小于T1之前,终端接收到切换指令,则终端APP根据切换指令,控制直播B媒体流;并且,终端重新设置定时器的时间;所述定时器设置为从直播B媒体流的开始时刻开始计时,阈值时间为T1。Optionally, the terminal detects the duration of the live A media stream; if the terminal receives a switching instruction before the duration of the live A media stream is less than T1, the terminal APP controls the live B media stream according to the switching instruction; and the terminal resets the timing The timer is set to start counting from the start time of the live B media stream, and the threshold time is T1.
这里,所述根据切换指令以控制直播B媒体流,可以是通过在终端APP的直播显示区域执行滑动操作,切换到视频B以直播B媒体流;或者,可以是执行其它操作以切换到视频B直播B媒体流。Here, according to the switching instruction to control the live B media stream, it may be performed by performing a sliding operation in the live broadcast display area of the terminal APP to switch to video B to live the B media stream; or it may be performed other operations to switch to video B Live B media stream.
这里,重新设置定时器的时间可以与T1不同。Here, the time for resetting the timer may be different from T1.
步骤S209:播放缓存的B媒体流的1个或N个GOP;Step S209: play one or N GOPs of the buffered B media stream;
可选地,终端判断本地缓存空间中是否存在B媒体流;如果存在,终端APP播放本地缓存空间中缓存的B媒体流;具体地,播放缓存的B媒体流的1个或N个GOP;所述播放缓存的B媒体流的1个或N个GOP的GOP类型为第二类/第三类GOP。Optionally, the terminal determines whether a B media stream exists in the local cache space; if so, the terminal APP plays the B media stream cached in the local cache space; specifically, plays one or N GOPs of the cached B media stream; The GOP type for playing one or N GOPs of the buffered B media stream is described as the second type / third type GOP.
步骤S210:发送继续拉取B媒体流的请求;Step S210: Send a request to continue to pull the B media stream;
可选地,终端APP向媒体服务器发送继续拉取B媒体流的请求;其中,可以是发送未缓存的B媒体流的第一类GOP的请求;或者,发送未缓存的B媒体流的第一类GOP和发送已缓存在本地缓存空间但未开始播放的B媒体流的第一GOP。Optionally, the terminal APP sends a request to the media server to continue to pull the B media stream; wherein, it may be a request to send the first type of GOP of the unbuffered B media stream; or the first request to send the unbuffered B media stream GOP-like and the first GOP that sends a B media stream that has been buffered in the local cache space but has not started playing.
需要说明的是,如此,在所述步骤S210中,由于此时已经开始直播B视频流,因而可拉取B媒体流第一类GOP或N个GOP集合,可正常播放B媒体流,使得视频画面更加清晰;并且,还可以将之前缓存的但并未播放的第二类/第三类GOP清除,拉取缓存第一类GOP。It should be noted that, in step S210, since the B video stream has already been broadcast live at this time, the first type GOP or N GOP set of the B media stream can be pulled, and the B media stream can be played normally, so that the video The picture is clearer; moreover, it is also possible to clear the second type / third type GOP that was previously cached but not played, and pull the first type GOP to be cached.
步骤S211:继续推送B媒体流;Step S211: Continue to push the B media stream;
可选地,媒体服务器向终端APP继续推送B媒体流;终端APP接收到B媒体流后,解码B媒体流;将解码后的B被媒体流正常显示以进行视频B的正常直播;所述B媒体流包括:B视频流和B音频流,所述B视频流为包括第一类GOP集合的视频流。Optionally, the media server continues to push the B media stream to the terminal APP; after the terminal APP receives the B media stream, the B media stream is decoded; the decoded B is normally displayed by the media stream for the normal live broadcast of the video B; said B The media stream includes a B video stream and a B audio stream. The B video stream is a video stream including a first type of GOP set.
步骤S212:发送拉取相邻C媒体流的请求;所述请求中携带丢帧的指示标识;Step S212: Send a request to pull the adjacent C media stream; the request carries an indication of frame loss;
可选地,在正常播放B媒体流的同时,终端APP向媒体服务器发送拉取与视频B的直播链接相邻的第三直播连接对应的视频C的媒体流的请求;并在所述请求中携带丢帧 的指示标识,所述丢帧的指示标识为:丢掉B帧的指示标识,或者,丢掉B帧和P帧的指示标识。Optionally, while the B media stream is normally played, the terminal APP sends a request to the media server to pull the media stream of the video C corresponding to the third live link adjacent to the live link of the video B; and in the request, It carries an indication identifier of dropped frames, where the indication identifier of dropped frames is: the indication identifier of dropped B frames, or the indication identifier of dropped B frames and P frames.
这里,需要说明的是,所述请求中所述请求中携带丢帧的指示标识,实际上,请求的是拉取不完整的GOP;例如,在一实施例中,携带丢掉B帧的指示标识的请求,则为拉取第二类GOP;在另一实施例中,携带丢掉B帧和P帧的指示标识的请求,则为拉取第三类GOP;其中,所述第二类GOP包括:P帧和I帧;所述第三类GOP包括:I帧。Here, it should be noted that the request in the request carries an indication identifier of a dropped frame. In fact, the request is to pull an incomplete GOP; for example, in one embodiment, the indication identifier of a dropped B frame is carried. Request for pulling the second type of GOP; in another embodiment, the request carrying the indication identifiers of discarded B and P frames is pulling the third type of GOP; wherein the second type of GOP includes : P frame and I frame; the third type of GOP includes: I frame.
步骤S213:推送C媒体流;Step S213: Push the C media stream;
可选地,媒体服务器接收终端APP发送的请求后,媒体服务器向终端APP推送C媒体流;所述C媒体流包括:C视频流和C音频流,所述C视频流为包括1个第二类/第三类GOP或N个第二类/第三类GOP集合的视频流。Optionally, after the media server receives the request sent by the terminal APP, the media server pushes the C media stream to the terminal APP; the C media stream includes a C video stream and a C audio stream, and the C video stream includes a second Class / Third GOP or N Second / Third GOP Set Video Streams.
这里,需要说明的是,所述推送C媒体流中的C音频流给终端APP时并不丢帧。Here, it should be noted that the C audio stream in the C media stream is not dropped when the terminal APP is pushed.
步骤S214:保存C媒体流的1个或N个GOP;Step S214: Save 1 or N GOPs of the C media stream;
可选地,将C媒体流的1个第二类/第三类GOP或N个第二类/第三类GOP集合缓存在本地缓存中;其中,所述N为大于1的自然数。Optionally, a second type / third type GOP or N second type / third type GOP set of the C media stream is cached in a local cache; wherein, N is a natural number greater than 1.
步骤S215:不再更换视频;Step S215: no longer change the video;
可选地,终端APP持续直播B媒体流。Optionally, the terminal APP continuously broadcasts the B media stream.
这里,终端APP持续直播B媒体流,说明终端用户对视频B感兴趣。Here, the terminal APP continuously broadcasts the B media stream, indicating that the end user is interested in video B.
步骤S216:检测到T1时间超时;Step S216: T1 timeout is detected;
可选地,终端检测到终端APP持续直播B媒体流的时长超过定时器的阈值时间T1。Optionally, the terminal detects that the duration of the terminal APP's continuous live broadcast of the B media stream exceeds the threshold time T1 of the timer.
步骤S217,发送停止推送C的媒体流的请求,并断开连接;Step S217: Send a request to stop pushing the media stream of C, and disconnect the connection;
可选地,当终端APP直播B媒体流的时长超过时间T1,终端APP向媒体服务发送停止推送C媒体流的请求;并通过断开终端APP与媒体服务器之间的传输协议来停止接收C媒体流。Optionally, when the duration of the live broadcast of the B media stream of the terminal APP exceeds the time T1, the terminal APP sends a request to the media service to stop pushing the C media stream; and stops receiving the C media by disconnecting the transmission protocol between the terminal APP and the media server. flow.
步骤S218,清除C的媒体流的缓存。Step S218: Clear the buffer of C's media stream.
可选地,终端将缓存空间中C媒体流清除。Optionally, the terminal clears the C media stream in the buffer space.
需要说明的是,本实施例中在视频直播的过程中,用户在寻找喜欢的频道或者节目时,可通过滑动连续不断的切换直播视频;通过在播放A视频时预先缓存B视频的媒体流的一个或N个GOP,通过播放B视频的媒体流时预先缓存C视频的媒体流的一个或N 个GOP,可以避免由于切换而引起的“黑屏”状态或者无节目状态,可以实现在除了首个直播的视频A外,其它直播的视频的首次出现画面的等待时间短,实现比秒开的时间短。如此,本实施例极大的降低了卡顿率,使得整个直播过程都能呈现有画面的状态,极大提高了用户的满意度。It should be noted that, in this embodiment, during the live broadcast of the video, the user can continuously switch the live video by sliding when searching for a favorite channel or program; by pre-buffering the media stream of the B video during the playback of the A video One or N GOPs. By playing one or N GOPs of the C video media stream before playing the B video media stream, the "black screen" state or no program state caused by switching can be avoided. Except for the live video A, the waiting time for the first appearance of other live videos is short, and the time to achieve the opening is shorter than the second opening time. In this way, this embodiment greatly reduces the stall rate, so that the entire live broadcast process can present a picture state, which greatly improves user satisfaction.
需要说明的是,本实施例中,通过音视频预先缓存链接相邻的视频流的第二类/第三类GOP,以达到切换过程的快速播放;当用户切换到链接相邻的下一个直播视频时,可以根据不同的网络条件,使用户观看到低帧率的视频内容,使得可以以牺牲画面的清晰度换取节省流量;等到播放连接相邻的下一个直播视频的一段时间后,可以再次观看完整帧率的视频内容,画面清晰度得到恢复。如此,本实施例中,可以根据终端设备的流量套餐情况,设定独特的预先缓存下一个直播视频的媒体流的场景,可以丢掉B帧或者P、B帧以达到视频切换时的视频快速播放。It should be noted that in this embodiment, the second / third type of GOP linking adjacent video streams is pre-cached by audio and video to achieve fast playback of the switching process; when the user switches to the next live broadcast linking adjacent During video, users can watch low frame rate video content according to different network conditions, making it possible to sacrifice the sharpness of the screen in exchange for saving traffic; after playing for a period of time connected to the next live video, it can be played again. Watch the full frame rate of video content and the picture clarity is restored. Thus, in this embodiment, according to the traffic package of the terminal device, a unique scenario for pre-caching the media stream of the next live video can be set, and B frames or P and B frames can be dropped to achieve fast video playback during video switching. .
实施例十一Example 11
为了进一步解释说明,本发明还提出了一种视频直播处理方法,所述方法主要针对通过判断直播设备的带宽不满足预先缓存条件时,不进行预先缓存的情景。如图8所示,所述方法包括以下步骤。In order to further explain, the present invention also proposes a live video processing method. The method is mainly directed to a scenario in which pre-cache is not performed when the bandwidth of the live broadcast device does not meet the pre-cache conditions. As shown in FIG. 8, the method includes the following steps.
步骤S301:选取直播视频A;Step S301: selecting a live video A;
可选地,启动终端设备;点击进入终端APP页面;点击选择终端APP中直播视频类别中的某一个直播视频A;其中,所述终端APP为进行视频直播的应用程序,例如可以是熊猫直播、CC直播、触手、龙珠直播,等等Optionally, start a terminal device; click to enter the terminal APP page; click to select a live video A in the live video category of the terminal APP; wherein the terminal APP is an application program for performing live video, such as Panda Live, CC Live, Tentacle, Dragon Ball Live, etc.
步骤S302:判断带宽不足,不进行预先缓存下一个视频的媒体流;Step S302: determine that the bandwidth is insufficient, and do not pre-cache the media stream of the next video;
可选地,检测到直播设备的当前带宽小于接收所述A视频的媒体流和一下个视频B的媒体流所需的带宽,或者,终端检测到直播设备的配置数据指示不预先缓存下一个视频的媒体流时,终端不进行预先缓存下一个视频的媒体流的操作。Optionally, it is detected that the current bandwidth of the live broadcast device is less than the bandwidth required to receive the media stream of the A video and the media stream of the next video B, or the terminal detects that the configuration data of the live broadcast device indicates that the next video is not pre-cached When a media stream is generated, the terminal does not perform an operation of pre-caching the media stream of the next video.
这里,所述下一个视频B为视频A的第一直播链接相邻的第二直播连接赌赢的视频;或者,所述下一个视频B为显示交互屏上与视频A的主页相邻或者邻近的视频。Here, the next video B is a video that the first live broadcast link of video A is adjacent to the second live broadcast bet; or, the next video B is a display interactive screen that is adjacent to or adjacent to the homepage of video A. Video.
步骤S303:发送拉取A媒体流的请求;Step S303: Send a request to pull A media stream;
可选地,终端APP向媒体服务器发送拉取A媒体流的请求。Optionally, the terminal APP sends a request for pulling the A media stream to the media server.
这里,所述媒体流包括一系列GOP;所述GOP为第一类GOP。Here, the media stream includes a series of GOPs; the GOP is a first type of GOP.
步骤S304:推送A媒体流;Step S304: Push A media stream;
可选地,媒体服务器向终端APP推送A媒体流;所述A媒体流包括:A视频流和A音频流。Optionally, the media server pushes A media stream to the terminal APP; the A media stream includes: A video stream and A audio stream.
步骤S305:直播A媒体流;Step S305: Live A media stream;
可选地,终端APP接收到媒体服务器发送的A媒体流后,终端APP解码A媒体流;终端APP直播A媒体流。Optionally, after the terminal APP receives the A media stream sent by the media server, the terminal APP decodes the A media stream; the terminal APP broadcasts the A media stream live.
需要说明的是,本实施例中,还可以根据直播设备的带宽情况,判断是否执行预先缓存下一个视频的媒体流的操作,如此,本实施例可以使得当直播设备的带宽不足时,不进行预先缓存下一个视频的媒体流的操作。It should be noted that in this embodiment, it is also possible to determine whether to perform the operation of pre-caching the media stream of the next video according to the bandwidth situation of the live broadcast device. In this way, this embodiment can prevent the The action of pre-caching the media stream of the next video.
这里需要指出的是:以下视频直播处理装置项的描述,与上述视频直播处理方法描述是类似的,同方法的有益效果描述,不做赘述。对于本发明视频直播处理装置实施例中未披露的技术细节,请参照本发明视频直播控制方法实施例的描述。It should be noted here that the description of the following live video processing device items is similar to the description of the live video processing method described above, and the beneficial effects of the same method are described without further description. For technical details not disclosed in the embodiment of the live video processing apparatus of the present invention, please refer to the description of the embodiment of the live video control method of the present invention.
本发明实施例还提出了一种视频直播装置,请参阅图9,所述装置包括:视频直播模块21和缓存模块22;其中,An embodiment of the present invention also provides a video live broadcast device. Referring to FIG. 9, the device includes: a video live broadcast module 21 and a cache module 22;
所述视频直播模块21,用于直播第一视频;还用于在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播第二视频;The video live broadcast module 21 is configured to live broadcast the first video; and is also used to stop the live broadcast of the first video when a switching instruction is detected, and use the cached video data to live broadcast the second video;
所述缓存模块22,用于在直播所述第一视频时,缓存所述第二视频的视频数据。The buffering module 22 is configured to buffer video data of the second video when the first video is broadcast live.
可选地,所述视频直播模块21,还包括:第一切换子模块211和第二切换子模块212;其中,Optionally, the video live broadcast module 21 further includes: a first switching sub-module 211 and a second switching sub-module 212;
所述第一切换子模块211,用于在检测到所述切换指令时,控制所述第一视频的直播画面从第一方向滑出显示区域;The first switching sub-module 211 is configured to control the live video of the first video to slide out of the display area from the first direction when the switching instruction is detected;
所述第二切换子模块212,用于控制所述第二视频的直播画面从所述显示区域的第二方向滑入所述显示区域;The second switching submodule 212 is configured to control a live broadcast picture of the second video to slide into the display area from a second direction of the display area;
其中,所述第二方向与所述第一方向相反或相同。The second direction is opposite to or the same as the first direction.
可选地,所述视频直播模块21,还包括:第一检测子模块213和生成子模块214;其中,Optionally, the video live broadcast module 21 further includes: a first detection sub-module 213 and a generation sub-module 214;
所述第一检测子模块213,用于检测作用于显示交互屏的滑动操作;The first detection sub-module 213 is configured to detect a sliding operation acting on a display interactive screen;
所述生成子模块214,用于若检测到所述滑动操作,生成所述切换指令;The generating sub-module 214 is configured to generate the switching instruction if the sliding operation is detected;
所述滑动操作的滑动方向为所述第一方向。The sliding direction of the sliding operation is the first direction.
可选地,所述缓存模块22,还用于在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP。Optionally, the buffering module 22 is further configured to buffer, when the first video is broadcast live, at least one group of pictures GOP at the current moment of the second video live broadcast.
可选地,所述缓存模块22,还用于在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个第一类GOP,其中,所述第一类GOP包括:I帧、B帧和P帧。Optionally, the cache module 22 is further configured to cache at least one first-type GOP of the second video at the current moment when the first video is broadcasted live, where the first-type GOP includes: I Frames, B frames, and P frames.
可选地,所述缓存模块22,还用于在直播所述第一视频时,缓存至少一个第二类GOP或者至少一个第三类GOP;Optionally, the cache module 22 is further configured to cache at least one second-type GOP or at least one third-type GOP when the first video is broadcast live;
所述第二类GOP相比第一类GOP缺少B帧;所述第三类GOP相比所述第一类GOP缺少B帧和P帧。The second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
可选地,所述装置还包括:时长检测模块23;其中,Optionally, the apparatus further includes: a duration detection module 23;
所述时长检测模块23,用于检测直播所述第一视频的时长是否超过设置的阈值;The duration detection module 23 is configured to detect whether the duration of the live broadcast of the first video exceeds a set threshold;
若直播所述第一视频的时长超过所述阈值,停止所述第二视频的视频数据的缓存。If the duration of the live broadcast of the first video exceeds the threshold, the buffering of video data of the second video is stopped.
可选地,所述装置还包括:第一确定模块24;其中,Optionally, the apparatus further includes: a first determining module 24;
所述第一确定模块24,用于确定是否满足缓存条件;The first determining module 24 is configured to determine whether a cache condition is satisfied;
所述缓存模块,还用于若满足所述缓存条件,在直播所述第一视频时缓存所述第二视频的视频数据。The buffering module is further configured to buffer the video data of the second video when the first video is broadcast live if the buffering conditions are met.
可选地,所述确定是否满足缓存条件,包括:Optionally, the determining whether the cache condition is satisfied includes:
若检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the buffer condition is satisfied;
若检测到直播设备的当前带宽不小于接收所述第一视频和所述第二视频的视频数据所需带宽之和,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required for receiving the video data of the first video and the second video, determining that the cache condition is satisfied;
若检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件;If it is detected that the network currently connected to the live broadcast device is a predetermined type of network, determine that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频,确定满足所述缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached, determining that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频且检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频且检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件。If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
可选地,所述装置还包括:第二确定模块25;其中,Optionally, the apparatus further includes: a second determining module 25;
所述第二确定模块25,用于根据视频之间的关联关系,确定所述第二视频。The second determining module 25 is configured to determine the second video according to an association relationship between the videos.
可选地,所述第二确定模块25,还用于根据在视频直播选择页面直播链接的显示位置关系,选择与所述第一视频的第一直播链接相邻的第二直播链接对应的视频为所述第二视频。Optionally, the second determining module 25 is further configured to select a video corresponding to a second live link adjacent to the first live link of the first video according to a display position relationship of the live link on the live video selection page. Is the second video.
本发明一实施例还公开了一种终端,如图10所示,所述终端包括处理器31和用于存储能够在处理器上运行的计算机程序的存储器32;其中,所述处理器用于运行计算机程序时,实现本发明任一实施例所提供的视频直播处理方法。An embodiment of the present invention also discloses a terminal. As shown in FIG. 10, the terminal includes a processor 31 and a memory 32 for storing a computer program capable of running on the processor; wherein the processor is used for running The computer program implements the live video processing method provided by any embodiment of the present invention.
在一些实施例中,本发明实施例中的存储器32可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本文描述的系统和方法的存储器32旨在包括但不限于这些和任意其它适合类型的存储器。In some embodiments, the memory 32 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), and an electronic memory. Erase programmable read-only memory (EPROM, EEPROM) or flash memory. The volatile memory may be Random Access Memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (Synchlink DRAM, SLDRAM) And direct memory bus random access memory (Direct RAMbus RAM, DRRAM). The memory 32 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
而处理器31可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器31中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器31可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处 理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器32,处理器31读取存储器32中的信息,结合其硬件完成上述方法的步骤。The processor 31 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 31 or an instruction in the form of software. The above-mentioned processor 31 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a ready-made programmable gate array (Field Programmable Gate Array, FPGA), or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or executed. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor, or completed by using a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and the like. The storage medium is located in the memory 32, and the processor 31 reads information in the memory 32 and completes the steps of the foregoing method in combination with its hardware.
在一些实施例中,本文描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。In some embodiments, the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSP), digital signal processing devices (DSPD), programmable Logic device (Programmable Logic Device, PLD), Field Programmable Gate Array (FPGA), general purpose processor, controller, microcontroller, microprocessor, other for performing the functions described in this application Electronic unit or combination thereof.
对于软件实现,可通过执行本文所述功能的模块(例如过程、函数等)来实现本文所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。For software implementation, the techniques described herein can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described herein. Software codes may be stored in a memory and executed by a processor. The memory may be implemented in the processor or external to the processor.
本发明实施例还提供了一种视频直播处理系统,所述系统如图11所示,包括:终端41和媒体服务器42;其中,所述终端41用于实现本发明任一实施例所提供的视频直播处理方法;所述媒体服务器42用于向所述终端41发送第一视频的视频数据和/或第二视频的视频数据。An embodiment of the present invention further provides a live video processing system. As shown in FIG. 11, the system includes a terminal 41 and a media server 42. The terminal 41 is configured to implement the provided by any embodiment of the present invention. Video live processing method; the media server 42 is configured to send video data of a first video and / or video data of a second video to the terminal 41.
本发明又一实施例还提供了一种计算机存储介质,该计算机可读存储介质存储有可执行程序,所述可执行程序被处理器31执行时,可实现图片处理配方法的以下步骤:Another embodiment of the present invention further provides a computer storage medium. The computer-readable storage medium stores an executable program. When the executable program is executed by the processor 31, the following steps of the picture processing and distribution method can be implemented:
直播第一视频;Broadcast the first video;
在直播所述第一视频时,缓存第二视频的视频数据;Buffering video data of the second video when the first video is live broadcasted;
在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播所述第二视频。When a switching instruction is detected, the live broadcast of the first video is stopped, and the second video is broadcast live using the cached video data.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
在检测到所述切换指令时,控制所述第一视频的直播画面从第一方向滑出显示区域;When the switching instruction is detected, controlling the live video of the first video to slide out of the display area from the first direction;
控制所述第二视频的直播画面从所述显示区域的第二方向滑入所述显示区域;Controlling the live broadcast picture of the second video to slide into the display area from a second direction of the display area;
其中,所述第二方向与所述第一方向相反或相同。The second direction is opposite to or the same as the first direction.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
检测作用于显示交互屏的滑动操作;Detect the sliding operation acting on the display interactive screen;
若检测到所述滑动操作,生成所述切换指令;If the sliding operation is detected, generating the switching instruction;
所述滑动操作的滑动方向为所述第一方向。The sliding direction of the sliding operation is the first direction.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP。When the first video is broadcast live, at least one group of pictures GOP that is live broadcast at the current moment of the second video is buffered.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个第一类GOP,其中,所述第一类GOP包括:I帧、B帧和P帧。可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:When the first video is broadcast live, at least one first-type GOP of the second video being broadcast at the current moment is cached, where the first-type GOP includes: I-frame, B-frame, and P-frame. Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
在直播所述第一视频时,缓存至少一个第二类GOP或者至少一个第三类GOP;When the first video is broadcast live, buffer at least one second type GOP or at least one third type GOP;
所述第二类GOP相比第一类GOP缺少B帧;所述第三类GOP相比所述第一类GOP缺少B帧和P帧。The second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
检测直播所述第一视频的时长是否超过设置的阈值;Detecting whether the duration of the live broadcast of the first video exceeds a set threshold;
若直播所述第一视频的时长超过所述阈值,停止所述第二视频的视频数据的缓存。If the duration of the live broadcast of the first video exceeds the threshold, the buffering of video data of the second video is stopped.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
确定是否满足缓存条件;Determine whether the cache conditions are met;
所述在直播所述第一视频时,缓存第二视频的视频数据,包括:The buffering the video data of the second video when the first video is broadcast live includes:
若满足所述缓存条件,在直播所述第一视频时缓存所述第二视频的视频数据。If the cache condition is satisfied, the video data of the second video is cached when the first video is broadcast live.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤至少之一:Optionally, when the executable program is executed by the processor 31, it is further configured to implement at least one of the following steps:
若检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the buffer condition is satisfied;
若检测到直播设备的当前带宽不小于接收所述第一视频和所述第二视频的视频数据所需带宽之和,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required for receiving the video data of the first video and the second video, determining that the cache condition is satisfied;
若检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件;If it is detected that the network currently connected to the live broadcast device is a predetermined type of network, determine that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频,确定满足所述缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached, determining that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频且检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the cache condition is satisfied;
若所述直播设备的配置数据指示缓存所述第二视频且检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件。If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
根据视频之间的关联关系,确定所述第二视频。Determining the second video according to the association relationship between the videos.
可选地,所述可执行程序被处理器31执行时,还用以实现以下步骤:Optionally, when the executable program is executed by the processor 31, it is further configured to implement the following steps:
根据在视频直播选择页面直播链接的显示位置关系,选择与所述第一视频的第一直播链接相邻的第二直播链接对应的视频为所述第二视频。According to the display position relationship of the live link on the live video selection page, a video corresponding to a second live link adjacent to the first live link of the first video is selected as the second video.
在一些实施例中,所述计算机存储介质可以包括:U盘、移动硬盘、只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In some embodiments, the computer storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disk. A medium on which program code can be stored.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present invention. It should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (13)

  1. 一种视频直播处理方法,其中,所述方法包括:A method for processing live video, wherein the method includes:
    直播第一视频;Broadcast the first video;
    在直播所述第一视频时,缓存第二视频的视频数据;Buffering video data of the second video when the first video is live broadcasted;
    在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播所述第二视频。When a switching instruction is detected, the live broadcast of the first video is stopped, and the second video is broadcast live using the cached video data.
  2. 根据权利要求1所述的方法,其中,所述在检测到切换指令时,停止所述第一视频的直播,并利用缓存的所述视频数据直播所述第二视频,包括:The method according to claim 1, wherein when the switching instruction is detected, stopping the live broadcast of the first video and using the cached video data to live broadcast the second video comprises:
    在检测到所述切换指令时,控制所述第一视频的直播画面从第一方向滑出显示区域;When the switching instruction is detected, controlling the live video of the first video to slide out of the display area from the first direction;
    控制所述第二视频的直播画面从所述显示区域的第二方向滑入所述显示区域;Controlling the live broadcast picture of the second video to slide into the display area from a second direction of the display area;
    其中,所述第二方向与所述第一方向相反或相同。The second direction is opposite to or the same as the first direction.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    检测作用于显示交互屏的滑动操作;Detect the sliding operation acting on the display interactive screen;
    若检测到所述滑动操作,生成所述切换指令;If the sliding operation is detected, generating the switching instruction;
    所述滑动操作的滑动方向为所述第一方向。The sliding direction of the sliding operation is the first direction.
  4. 根据权利要求1所述的方法,其中,所述在直播所述第一视频时,缓存第二视频的视频数据,包括:The method according to claim 1, wherein, when the first video is broadcast live, buffering video data of a second video comprises:
    在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP。When the first video is broadcast live, at least one group of pictures GOP that is live broadcast at the current moment of the second video is buffered.
  5. 根据权利要求4所述的方法,其中,所述在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP,包括:The method according to claim 4, wherein, when the first video is broadcast live, buffering at least one group of pictures GOP at the current moment of the second video comprises:
    在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个第一类GOP,其中,所述第一类GOP包括:I帧、B帧和P帧。When the first video is broadcast live, at least one first-type GOP of the second video being broadcast at the current moment is cached, where the first-type GOP includes: I-frame, B-frame, and P-frame.
  6. 根据权利要求4所述的方法,其中,所述在直播所述第一视频时,缓存所述第二视频当前时刻直播的至少一个画面组GOP,还包括:The method according to claim 4, wherein, when the first video is live broadcasted, buffering at least one group of pictures GOP of the second video live broadcast at the current moment, further comprising:
    在直播所述第一视频时,缓存至少一个第二类GOP或者至少一个第三类GOP;When the first video is broadcast live, buffer at least one second type GOP or at least one third type GOP;
    所述第二类GOP相比第一类GOP缺少B帧;所述第三类GOP相比所述第一类GOP缺少B帧和P帧。The second type of GOP lacks B frames compared to the first type of GOPs; the third type of GOP lacks B frames and P frames compared to the first type of GOPs.
  7. 根据权利要求1所述的方法,其中,所述在检测到切换指令之前,还包括:The method according to claim 1, wherein before the switching instruction is detected, further comprising:
    检测直播所述第一视频的时长是否超过设置的阈值;Detecting whether the duration of the live broadcast of the first video exceeds a set threshold;
    若直播所述第一视频的时长超过所述阈值,停止所述第二视频的视频数据的缓存。If the duration of the live broadcast of the first video exceeds the threshold, the buffering of video data of the second video is stopped.
  8. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, further comprising:
    确定是否满足缓存条件;Determine whether the cache conditions are met;
    所述在直播所述第一视频时,缓存第二视频的视频数据,包括:The buffering the video data of the second video when the first video is broadcast live includes:
    若满足所述缓存条件,在直播所述第一视频时缓存所述第二视频的视频数据。If the cache condition is satisfied, the video data of the second video is cached when the first video is broadcast live.
  9. 根据权利要求8所述的方法,其中,所述确定是否满足缓存条件,包括以下至少之一:The method according to claim 8, wherein the determining whether the cache condition is satisfied comprises at least one of the following:
    若检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the buffer condition is satisfied;
    若检测到直播设备的当前带宽不小于接收所述第一视频和所述第二视频的视频数据所需带宽之和,确定满足所述缓存条件;If it is detected that the current bandwidth of the live broadcast device is not less than the sum of the bandwidth required for receiving the video data of the first video and the second video, determining that the cache condition is satisfied;
    若检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件;If it is detected that the network currently connected to the live broadcast device is a predetermined type of network, determine that the cache condition is satisfied;
    若所述直播设备的配置数据指示缓存所述第二视频,确定满足所述缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached, determining that the cache condition is satisfied;
    若所述直播设备的配置数据指示缓存所述第二视频且检测到直播设备的当前带宽大于接收所述第一视频的视频数据所需的带宽,确定满足缓存条件;If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the current bandwidth of the live broadcast device is greater than the bandwidth required to receive video data of the first video, determining that the cache condition is satisfied;
    若所述直播设备的配置数据指示缓存所述第二视频且检测到所述直播设备当前连接的网络为预定类型网络,确定满足所述缓存条件。If the configuration data of the live broadcast device indicates that the second video is cached and it is detected that the network currently connected to the live broadcast device is a predetermined type of network, it is determined that the cache condition is satisfied.
  10. 根据权利要求1所述的方法,其中,所述缓存第二视频的视频数据之前,还包括:The method according to claim 1, wherein before the buffering the video data of the second video, further comprising:
    根据视频之间的关联关系,确定所述第二视频。Determining the second video according to the association relationship between the videos.
  11. 根据权利要求10所述的方法,其中,所述根据视频之间的关联关系,确定所述第二视频,包括:The method according to claim 10, wherein determining the second video according to an association relationship between videos comprises:
    根据在视频直播选择页面直播链接的显示位置关系,选择与所述第一视频的第一直播链接相邻的第二直播链接对应的视频为所述第二视频。According to the display position relationship of the live link on the live video selection page, a video corresponding to a second live link adjacent to the first live link of the first video is selected as the second video.
  12. 一种视频直播处理装置,其中,所述装置包括:A video live broadcast processing device, wherein the device includes:
    视频直播模块,用于直播第一视频;还用于在检测到切换指令时,停止所述第一视 频的直播,并利用缓存的所述视频数据直播第二视频;A video live broadcast module for live broadcast of the first video; and also for stopping the live broadcast of the first video when a switching instruction is detected, and live broadcast of the second video by using the cached video data;
    缓存模块,用于在直播所述第一视频时,缓存所述第二视频的视频数据。The buffering module is configured to buffer video data of the second video when the first video is broadcast live.
  13. 一种终端,其中,所述终端包括处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,所述处理器用于运行计算机程序时,实现权利要求1-11任一项所述视频直播处理方法。A terminal, wherein the terminal includes a processor and a memory for storing a computer program capable of running on the processor; wherein when the processor is used to run a computer program, the device according to any one of claims 1-11 is implemented The video live broadcast processing method is described.
PCT/CN2019/099343 2018-08-06 2019-08-06 Video live-broadcast processing method, apparatus and terminal WO2020029935A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810887571.X 2018-08-06
CN201810887571.XA CN110809168A (en) 2018-08-06 2018-08-06 Video live broadcast processing method and device, terminal and storage medium

Publications (1)

Publication Number Publication Date
WO2020029935A1 true WO2020029935A1 (en) 2020-02-13

Family

ID=69413400

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/099343 WO2020029935A1 (en) 2018-08-06 2019-08-06 Video live-broadcast processing method, apparatus and terminal

Country Status (2)

Country Link
CN (1) CN110809168A (en)
WO (1) WO2020029935A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113382196B (en) * 2020-02-25 2022-06-03 杭州海康消防科技有限公司 Scene switching method, system and device and video comprehensive processing platform
CN111866433B (en) * 2020-07-31 2021-06-29 腾讯科技(深圳)有限公司 Video source switching method, video source playing method, video source switching device, video source playing device, video source equipment and storage medium
CN111935507A (en) * 2020-08-19 2020-11-13 上海连尚网络科技有限公司 Video switching method and device
CN112822505B (en) * 2020-12-31 2023-03-03 杭州星犀科技有限公司 Audio and video frame loss method, device, system, storage medium and computer equipment
CN115499697B (en) * 2021-06-17 2023-07-07 福建省天奕网络科技有限公司 Video carousel switching method and terminal
CN113727172B (en) * 2021-09-01 2023-02-28 北京字跳网络技术有限公司 Video cache playing method and device, electronic equipment and storage medium
CN114173183B (en) * 2021-09-26 2023-01-24 荣耀终端有限公司 Screen projection method and electronic equipment
CN113973233A (en) * 2021-10-22 2022-01-25 深圳小湃科技有限公司 Method, device and equipment for optimizing switching playing of multi-platform film and storage medium
CN114615540A (en) * 2022-05-11 2022-06-10 北京搜狐新动力信息技术有限公司 Video resolution switching method and device, storage medium and equipment
CN114866787B (en) * 2022-07-04 2022-09-23 深圳市必提教育科技有限公司 Live broadcast implementation method and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104378685A (en) * 2014-11-17 2015-02-25 天脉聚源(北京)传媒科技有限公司 Video switching method and device
CN106375836A (en) * 2016-09-27 2017-02-01 广东小天才科技有限公司 Resolution switching method and device of video
CN106658162A (en) * 2015-11-03 2017-05-10 中兴通讯股份有限公司 Channel changing method, channel changing device and set-top box
CN106658155A (en) * 2016-12-29 2017-05-10 深圳Tcl数字技术有限公司 Method and device for switching and playing of player
CN106792120A (en) * 2017-02-07 2017-05-31 青岛海信电器股份有限公司 The display methods of video pictures, device and terminal
CN107547940A (en) * 2017-09-13 2018-01-05 广州酷狗计算机科技有限公司 Video playback processing method, equipment and computer-readable recording medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100518311C (en) * 2006-03-27 2009-07-22 中兴通讯股份有限公司 Method for reducing response time of direct broadcast band switchover
CN101132521A (en) * 2007-09-25 2008-02-27 华为技术有限公司 Method and device for switching IPTV channels
CN101909160A (en) * 2009-12-17 2010-12-08 新奥特(北京)视频技术有限公司 Broadcast control switching method and device in network video live broadcast
CN105472443A (en) * 2016-01-13 2016-04-06 杭州当贝网络科技有限公司 Direct broadcast source control method and system
CN107645671A (en) * 2016-07-22 2018-01-30 南京中兴新软件有限责任公司 Program switching method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104378685A (en) * 2014-11-17 2015-02-25 天脉聚源(北京)传媒科技有限公司 Video switching method and device
CN106658162A (en) * 2015-11-03 2017-05-10 中兴通讯股份有限公司 Channel changing method, channel changing device and set-top box
CN106375836A (en) * 2016-09-27 2017-02-01 广东小天才科技有限公司 Resolution switching method and device of video
CN106658155A (en) * 2016-12-29 2017-05-10 深圳Tcl数字技术有限公司 Method and device for switching and playing of player
CN106792120A (en) * 2017-02-07 2017-05-31 青岛海信电器股份有限公司 The display methods of video pictures, device and terminal
CN107547940A (en) * 2017-09-13 2018-01-05 广州酷狗计算机科技有限公司 Video playback processing method, equipment and computer-readable recording medium

Also Published As

Publication number Publication date
CN110809168A (en) 2020-02-18

Similar Documents

Publication Publication Date Title
WO2020029935A1 (en) Video live-broadcast processing method, apparatus and terminal
CN110248204B (en) Processing method, device, equipment and storage medium for live broadcast cache
WO2023024834A9 (en) Game data processing method and apparatus, and storage medium
JP7110234B2 (en) Video playback methods, devices and systems
WO2016131223A1 (en) Frame loss method for video frame and video sending apparatus
CN110636346B (en) Code rate self-adaptive switching method and device, electronic equipment and storage medium
WO2015062521A1 (en) Code rate switching method and device for smart television
US8542705B2 (en) Key frame detection and synchronization
US20100211690A1 (en) Block partitioning for a data stream
EP3560205B1 (en) Synchronizing processing between streams
CA2758763C (en) Method and device for fast pushing unicast stream in fast channel change
CN110582012B (en) Video switching method, video processing device and storage medium
WO2019062050A1 (en) Live broadcast control method, apparatus, and electronic device
US20070147517A1 (en) Video processing system capable of error resilience and video processing method for same
CN111601136B (en) Video data processing method and device, computer equipment and storage medium
CN107566918A (en) A kind of low delay under video distribution scene takes the neutrel extraction of root
US20200296470A1 (en) Video playback method, terminal apparatus, and storage medium
WO2014183674A1 (en) Media play method and device, and set top box
CN111726657A (en) Live video playing processing method and device and server
CN105187895A (en) Data-caching method and system for playing videos on mobile platform by means of hardware acceleration
WO2012088922A1 (en) Resource configuration method for streaming media service, user service terminal and head end system
US20210400334A1 (en) Method and apparatus for loop-playing video content
WO2020227328A1 (en) Soft server push in video streaming
WO2018171567A1 (en) Method, server, and terminal for playing back media stream
CN110113641B (en) Video data transmission method, device, edge service node and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19848315

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19848315

Country of ref document: EP

Kind code of ref document: A1