CN109246462B - Seamless switching method and device for video stream - Google Patents

Seamless switching method and device for video stream Download PDF

Info

Publication number
CN109246462B
CN109246462B CN201811181905.8A CN201811181905A CN109246462B CN 109246462 B CN109246462 B CN 109246462B CN 201811181905 A CN201811181905 A CN 201811181905A CN 109246462 B CN109246462 B CN 109246462B
Authority
CN
China
Prior art keywords
video stream
switching
new video
time point
new
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811181905.8A
Other languages
Chinese (zh)
Other versions
CN109246462A (en
Inventor
周小军
雷云
张伟
方亮
雷震
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suning Group Co ltd
Original Assignee
Suning Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suning Group Co ltd filed Critical Suning Group Co ltd
Priority to CN201811181905.8A priority Critical patent/CN109246462B/en
Publication of CN109246462A publication Critical patent/CN109246462A/en
Application granted granted Critical
Publication of CN109246462B publication Critical patent/CN109246462B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/426Internal components of the client ; Characteristics thereof
    • H04N21/42607Internal components of the client ; Characteristics thereof for processing the incoming bitstream
    • 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/4402Processing 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 reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440218Processing 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 reformatting operations of video signals for household redistribution, storage or real-time display by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4
    • 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/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44204Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Security & Cryptography (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a seamless switching method and device for video streams, and belongs to the technical field of streaming media real-time processing. The method comprises the following steps: when playing an old video stream, according to a switching request of a new video stream, carrying out switching preparation and opening operation of the corresponding new video stream, wherein the switching preparation comprises the step of determining the switching condition of the new video stream; after the new video stream is opened, continuously acquiring the playing related data of the old video stream and the new video stream; resetting a decoder to obtain the media data of the new video stream; and performing seamless switching at the corresponding switching time point of the new video stream. The method and the device realize smooth seamless switching, greatly improve the playing experience of the user compared with the traditional code stream switching scheme, and have wide application prospect.

Description

Seamless switching method and device for video stream
Technical Field
The present invention relates to the field of streaming media real-time processing technologies, and in particular, to a method and an apparatus for seamless switching of video streams.
Background
Currently, in mainstream video app applications, realization of seamless switching is mostly realized by using dual players. The method includes that a current player plays a code stream with original definition, after a user clicks switching, an app background additionally starts a player instance to load the code stream with new definition, and in the playing process, a proper switching point is selected to splice two players according to a switching strategy (such as switching according to a frame number and switching of key frames of a current time point) so as to achieve the effect of seamless switching.
In the online video live broadcasting application, the streaming media server can push media streams with corresponding specifications according to the request of an app user, for example, the user requests a blue-ray code stream, the back-end system pushes the code stream of blue-ray image quality to the app end, the user requests an ultra-clear code stream, and the back-end system pushes the ultra-clear code stream to the app end. However, as the operating environment of the app user changes, for example, the user network switches from the cellular mobile network to the wifi network, the system load of the app terminal changes, and the like, the user may switch up or down the code streams with different definitions at any time during the viewing process. The common way for processing such a scene in the mainstream video app before is to close the playing of the original code stream before, and then restart the playing of the code stream of the new specification. The traditional method has the defects that short-time black screen of a playing page is inevitably caused in the process of closing an original code stream and loading a new code stream, the whole process is executed in series, the loading of the new code stream can cause blocking, the probability of waiting again by a user is increased, and therefore the impression experience presented to an app user is poor.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for seamless switching of video streams, which enable smooth seamless switching, and greatly improve the playing experience of a user compared with a conventional code stream switching scheme. The technical scheme is as follows:
in a first aspect, a method for seamless switching of video streams is provided, where the method is implemented based on a transport layer of a P2P playback mechanism, and the method includes:
when playing an old video stream, according to a switching request of a new video stream, carrying out switching preparation and opening operation of the corresponding new video stream, wherein the switching preparation comprises the step of determining the switching condition of the new video stream; after the new video stream is opened, continuously acquiring the playing related data of the old video stream and the new video stream; resetting a decoder to obtain the media data of the new video stream; performing seamless switching at the corresponding switching time point of the new video stream; the method includes the steps of setting current playing time of an old video stream as t0, setting player buffering time as d, searching a first key frame after the time point in the current video stream through t0+ d to obtain time t1, synchronously and asynchronously opening a new video stream, setting a switching time point as t1 at first, searching a first key frame after t0+ d on the new video stream to obtain time t2, and if the new video stream is opened before the old video stream is read to t1, if abs (t1-t2) is less than 1000ms, performing seamless switching at a corresponding switching time point of the new video stream, wherein the method includes the following steps:
if t1< t2, the modified switching time point is t2, and switching is performed at the time point of t 2;
if t1> t2, if the time point of reading the new video stream is less than t2, correcting the switching time point to be t2, and switching at the time point of t 2; if the time point of reading the new video stream is greater than t2, the switching time point is set to t1 and switching is performed at a time point of t 1.
With reference to the first aspect, in a first possible implementation manner, media data of new and old video streams are obtained through a P2P downloading manner; a switching request according to a new video stream transmitted through a transport layer; decapsulating the media data of the new and old video streams, and performing streaming encapsulation according to a play request; and demultiplexing the media data, and decoding and displaying.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the preparing for switching the new video stream includes determining a switching condition of the new video stream, and specifically includes: calculating a switching time point of a new video stream according to a new video stream switching request, wherein the switching time point of the new video stream is a next key frame of media data of the old video stream; and/or, the opening operation of the new video stream comprises: opening the new video stream according to the received corresponding definition parameter; and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, the handover request includes resolution consistency and/or a session ID of handover transmission is valid.
With reference to the first aspect and any one of the first to third possible implementation manners of the first aspect, in fourth to seventh possible implementation manners, performing seamless switching at a corresponding switching time point of the new video stream, further includes: if the new video stream is opened after the time point t1 when the old video stream is read, after the new video stream is successfully opened, the playing data of the new video stream is sent from the first key frame t2 after t0+ d, and switching is performed when the next key frame of the new video stream is acquired.
In a second aspect, an apparatus for seamless switching of video streams is provided, including: the switching preparation module further comprises a switching preparation module and an opening operation module, the switching preparation module and the opening operation module are used for performing switching preparation and opening operation of corresponding new video streams according to switching requests meeting the switching conditions of the new video streams, and the switching preparation comprises the step of determining the switching conditions of the new video streams; the acquisition module is used for continuously acquiring the playing related data of the old video stream and the new video stream after the new video stream is opened; the decoding module is used for resetting a decoder and acquiring the media data of the new video stream; a switching module, configured to perform seamless switching at a corresponding switching time point of the new video stream, where a current playing time of the old video stream is set as t0, a player buffering time is d, a first key frame after the current video stream is searched for a time t1 through t0+ d, and the new video stream is asynchronously opened, and initially set the switching time point as t1, and a first key frame after t0+ d is searched for a time t2 on the new video stream, where when the new video stream is opened before the old video stream reads t1, if abs (t1-t2) <1000ms, the seamless switching is performed at the corresponding switching time point of the new video stream, including:
if t1< t2, the modified switching time point is t2, and switching is performed at the time point of t 2;
if t1> t2, if the time point of reading the new video stream is less than t2, correcting the switching time point to be t2, and switching at the time point of t 2; if the time point of reading the new video stream is greater than t2, the switching time point is set to t1 and switching is performed at a time point of t 1.
With reference to the second aspect, in a first possible implementation manner, a playback flow architecture of the apparatus is composed of a P2P download layer, a transport layer, a playback layer, and a decoding display layer, where the P2P download layer is configured to provide a media data source through local download, local proxy, and/or self server call, the transport layer is configured to obtain media data from the P2P download layer, decapsulate the media data, then perform corresponding streaming encapsulation according to a data request of the playback layer, and the playback layer is configured to obtain the media data, perform demultiplexing, and finally perform decoding display through the decoding display layer.
With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner, the switching preparation module further includes a calculating sub-module, where the calculating sub-module is configured to determine a switching condition of the new video stream, and the calculating sub-module is specifically configured to: calculating a switching time point of a new video stream according to a new video stream switching request, wherein the switching time point of the new video stream is a next key frame of media data of the old video stream; and/or the opening operation module further comprises a new video stream opening submodule and a result feedback submodule, wherein the new video stream opening submodule is used for: opening the new video stream according to the received corresponding definition parameter; the result feedback submodule is used for: and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
With reference to the second possible implementation manner of the second aspect, in a third possible implementation manner, the handover request includes resolution consistency and/or a session ID of handover transmission is valid.
With reference to the second aspect and any one of the first to three possible implementation manners of the second aspect, in fourth to seven possible implementation manners, the switching module is further configured to: if the new video stream is opened after the time point t1 when the old video stream is read, after the new video stream is successfully opened, the playing data of the new video stream is sent from the first key frame t2 after t0+ d, and switching is performed when the next key frame of the new video stream is acquired.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
1. the switching time point of the new video stream is calculated and obtained simultaneously when the old video of the streaming media is played, the new video stream is opened in the background, and the real-time playing related data of the old video stream and the new video stream are continuously obtained, so that the switching of the new video stream and the old video stream is fully prepared in advance, and finally the switching of the new video stream and the old video stream is carried out at the corresponding switching time point of the new video stream;
2. seamless switching is realized based on a transmission layer, the scheme of using a multi-player is avoided, and a strategy of adopting single-path transmission or double-path transmission is flexibly adopted according to the actual operation state of a terminal (in the actual operation condition, most of the operation can be realized only by adopting single-path transmission, and a small part of the operation can be downloaded by adopting double-path transmission simultaneously);
3. compared with the traditional code stream switching scheme, the method greatly improves the playing experience of users and has wide application prospect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a video stream seamless switching method according to an embodiment of the present invention;
fig. 2 is a flowchart of a video stream seamless switching method according to a preferred embodiment of the present invention;
fig. 3 is a playback flow architecture based on the P2P mechanism according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a seamless switching apparatus for video streams according to a second embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The video stream seamless switching method and the device provided by the embodiment of the invention calculate and obtain the switching time point of the new video stream at the same time when the old video of the streaming media is played, open the new video stream in the background, and continuously obtain the real-time playing related data of the old video stream and the new video stream, thereby fully preparing for the switching of the new video stream and the old video stream in advance, then reset the decoder, obtain the media data of the new video stream, and finally switch the new video stream and the old video stream at the corresponding switching time point of the new video stream, because the key frames of the film sources with different definition are not uniformly distributed, the scheme fully considers the timeliness and the fluency of the switching, through the internal measurement and the feedback on each end line, the occurrence probability of the switching overlapping is less than one percent, the switching timeliness is less than 8s, the switching effect is already approved by the user, the smoother seamless switching is realized, compared with the traditional code stream switching scheme, the playing experience of the user is greatly improved, and the method has a wide application prospect.
The following describes a video stream seamless switching method and apparatus according to an embodiment of the present invention in detail with reference to the specific embodiment and the accompanying drawings.
Example one
Fig. 1 is a flowchart of a video stream seamless switching method according to an embodiment of the present invention. Fig. 2 is a flowchart of a video stream seamless switching method according to a preferred embodiment of the present invention.
As shown in fig. 1 and fig. 2, a method for seamlessly switching video streams according to an embodiment of the present invention includes the following steps:
101. when playing an old video stream, according to a switching request of a new video stream, switching preparation and opening operation of the corresponding new video stream are carried out, wherein the switching preparation comprises the step of determining the switching condition of the new video stream.
Specifically, whether a switching request triggered by a user meets a switching condition including whether the definition is consistent and/or whether the session ID of switching transmission is still valid is judged, if so, switching preparation and opening operation of the corresponding new video stream are carried out according to the switching request meeting the switching condition of the new video stream, if not, the reason of switching failure is recalled, and in the process, the old video stream is continuously played. Whether the definition in the switching condition is consistent or not refers to whether the definition of a new video stream to be switched is consistent with the definition of an old video stream or not, whether a session ID for switching transmission is still valid or not, each playing instance is a session, each session can be represented by an ID, and whether the session is valid or not refers to whether the session is not closed or not, similar to an ID (identity) card. It should be noted that, in addition to the above-mentioned two conditions, the switching condition herein may include any possible switching environment condition in the prior art, and may be set differently according to actual needs without departing from the concept of the present subject matter, and the embodiment of the present invention is not limited thereto.
Preparation for switching of new video streams, comprising: and calculating the switching time point of the new video stream according to the switching request meeting the switching condition of the new video stream, and determining the next key frame of the media data of the old video stream as the switching time point of the new video stream.
An opening operation of a new video stream, comprising: opening a new video stream by a background according to the received corresponding definition parameters; and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
It should be noted that, the process of step 101 may be implemented in other ways besides the way described in the above steps, and the embodiment of the present invention does not limit the specific way.
102. And after the new video stream is opened, continuously acquiring the play related data of the old video stream and the new video stream.
Specifically, after the new flow is opened successfully, seek operates to the time point of switching, and data is prepared. Meanwhile, the playing layer also acquires the playing related data of the old video stream and the new video stream all the time, and when the playing layer waits for acquiring the next key frame, the data of the new stream can be seamlessly transmitted to the playing layer.
103. And resetting the decoder to acquire the media data of the new video stream.
Specifically, when the playback layer acquires data of a new stream, the decoder needs to be reset to acquire media information of the new stream. The specific implementation details are that if the API mode is adopted, the first frame data of the new stream can be asked to question by setting a marking position, and the media format of the playing layer is told to change; in the case of the HLS protocol, because each TS packet carries media information, the mixed transmission of multiple formats is supported naturally, and this problem does not exist.
104. And performing seamless switching at the corresponding switching time point of the new video stream.
Specifically, let the current playing time of the old video stream be t0Player buffer time is d, passing t0+ d the time t is obtained by searching the first key frame after the time point in the current video stream1At the same time, asynchronously opening new video stream, firstly setting the switching time point as t1And searching for t on the new video stream0The first key frame after + d gets time t2Then, the following two operation paths are included:
first, read on old video stream t1A new video stream is previously opened up and,
if abs (t)1-t2)<Switching is carried out when the timestamp changes by no more than 1s as 1000 ms;
if t is1<t2The corrected switching time point is t2And at t2Switching at the time point of (a);
if t is1>t2If the time point of reading is less than t2Then the corrected switching time point is t2And at t2Is switched, in this caseThe timestamps are also consecutive; if the time point of reading is larger than t2Then t may be caused2-t1With the switching time point set to t1And at t1Switching at the time point of (a);
second, at the time point t of reading of the old video stream1Then opening a new video stream, and after the new video stream is successfully opened, starting from t0+The first key frame t after d2And starting to send the playing data of the new video stream, and switching when the next key frame is acquired.
It should be noted that, preferably, in the implementation process of the video stream seamless switching method provided by the embodiment of the present invention, media data of new and old video streams are acquired in a P2P downloading manner; a switching request according to a new video stream transmitted through a transport layer; decapsulating the media data of the new and old video streams, and performing streaming encapsulation according to a play request; and demultiplexing the media data, and decoding and displaying.
Fig. 3 is a playback flow architecture based on the P2P mechanism according to an embodiment of the present invention. As shown in fig. 3, the method for seamlessly switching video streams provided in the embodiment of the present invention may be implemented by a play flow architecture based on a P2P mechanism, where the play flow architecture is composed of a P2P download layer, a transport layer, a play layer, and a decoding display layer, the P2P download layer is used to provide a media data source through local download, local proxy, and/or self server call, the transport layer is used to obtain media data from the P2P download layer, decapsulate the media data, perform corresponding streaming encapsulation according to a data request of the play layer, and the play layer is used to obtain the media data, perform demultiplexing, and finally perform decoding display through the decoding display layer.
In the playback flow architecture, the playback layer media data is derived from the transport layer, which is different from the architecture in which the stream is pulled from the player directly to the server in the alternative playback architecture. The advantage of this architecture is that the P2P download layer mainly provides a basic media data download service for the transport layer, and P2P transmission can be performed at the app terminal, so that resources such as a broadband server can be effectively saved at the back end. The playing layer can be directly connected with HLS service and RTSP service of the transmission layer to obtain audio and video stream, and can also be integrated with API interface of the transmission layer to obtain audio and video stream. The transport layer mainly functions to acquire media data from the P2P layer, decapsulate the data, and perform encapsulation streaming according to the request of the playback layer, such as slice file in TS format of HLS protocol or RTP packet format based on RSTP protocol, and frame data in API mode.
In addition, in the implementation process of the above seamless switching method for video streams, a new stream may be opened too slowly or overtime, and at this time, the processing policy may be flexibly handled, for example, when a switching point arrives, the new stream is not opened yet, data of an old stream may be continuously transmitted, an upper layer switching failure may be recalled, and a play layer may wait until the new stream is opened or an error occurs. Under the condition that the operation environment of some users is severe, in order to avoid simultaneously starting two paths of code streams, the transmission of the original code stream can be suspended according to whether the buffering time of the transmission layer comprises the next key frame or not during switching, and if the buffering time comprises the next key frame, only one path of code stream is transmitted at one playing terminal, so that the resource consumption of the terminal system is reduced.
In summary, the seamless switching method for video streams provided in the embodiments of the present invention has the following advantages, compared with the prior art:
1. the switching time point of the new video stream is calculated and obtained simultaneously when the old video of the streaming media is played, the new video stream is opened in the background, and the real-time playing related data of the old video stream and the new video stream are continuously obtained, so that the switching of the new video stream and the old video stream is fully prepared in advance, and finally the switching of the new video stream and the old video stream is carried out at the corresponding switching time point of the new video stream;
2. seamless switching is realized based on a transmission layer, the scheme of using a multi-player is avoided, and a strategy of adopting single-path transmission or double-path transmission is flexibly adopted according to the actual operation state of a terminal (in the actual operation condition, most of the operation can be realized only by adopting single-path transmission, and a small part of the operation can be downloaded by adopting double-path transmission simultaneously);
3. compared with the traditional code stream switching scheme, the method greatly improves the playing experience of users and has wide application prospect.
Example two
Fig. 4 is a video stream seamless switching apparatus according to a second embodiment of the present invention, and as shown in fig. 4, the video stream seamless switching apparatus according to the second embodiment of the present invention includes a switching preparation module 1, an obtaining module 2, a decoding module 3, and a switching module 4.
Specifically, the handover preparation module 1 is configured to: and judging whether the switching request triggered by the user meets the switching condition including whether the definition is consistent and/or whether the session ID transmitted by switching is still valid, if so, performing switching preparation and opening operation of the corresponding new video stream according to the switching request meeting the switching condition of the new video stream, and if not, recalling the reason of the switching failure.
The switching preparation module 1 further comprises a switching preparation module 11 and an opening operation module 12, the switching preparation module 11 and the opening operation module 12 are configured to perform switching preparation and opening operation of the corresponding new video stream according to a switching request satisfying a switching condition of the new video stream, and the switching preparation includes determining the switching condition of the new video stream. Preferably, the switching preparation module 1 further includes a switching judgment module 13, and the switching judgment module 13 is configured to judge whether the switching request meets a switching condition of the new video stream when the old video stream is played.
The handover preparation module 11 further comprises a calculation submodule 111, the calculation submodule 111 being configured to:
calculating a switching time point of the new video stream according to the switching request meeting the switching condition of the new video stream, wherein the switching time point of the new video stream is the next key frame of the media data of the old video stream; and/or the presence of a gas in the gas,
the open operation module 12 further comprises a new video stream open submodule 121 and a result feedback submodule 122, the new video stream open submodule 21 being configured to: opening a new video stream by a background according to the received corresponding definition parameters; the result feedback sub-module 122 is configured to: and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
The acquisition module 2 is used for continuously acquiring the playing related data of the old video stream and the new video stream after the new video stream is opened;
the decoding module 3 is used for resetting the decoder and acquiring the media data of the new video stream;
and the switching module 4 is used for performing seamless switching at the corresponding switching time point of the new video stream. Specifically, the switching module 4 is configured to perform the following operations:
let the current playing time of the old video stream be t0Player buffer time is d, passing t0+ d the time t is obtained by searching the first key frame after the time point in the current video stream1At the same time, asynchronously opening new video stream, firstly setting the switching time point as t1And searching for t on the new video stream0The first key frame after + d gets time t2Then, the following two operation paths are included:
first, read on old video stream t1A new video stream is previously opened up and,
if abs (t)1-t2)<Switching is carried out when the timestamp changes by no more than 1s as 1000 ms;
if t is1<t2The corrected switching time point is t2And at t2Switching at the time point of (a);
if t is1>t2If the time point of reading is less than t2Then the corrected switching time point is t2And at t2The time point of (2) is switched, in which case the time stamps are also continuous; if the time point of reading is larger than t2Then t may be caused2-t1With the switching time point set to t1And at t1Switching at the time point of (a);
second, at the time point t of reading of the old video stream1Then opening a new video stream, and after the new video stream is successfully opened, starting from t0+The first key frame t after d2And starting to send the playing data of the new video stream, and switching when the next key frame is acquired.
Referring back to fig. 3, the seamless video stream switching apparatus according to the embodiment of the present invention is preferably implemented by a P2P-based playback flow architecture, where the playback flow architecture is composed of a P2P download layer, a transport layer, a playback layer, and a decoding display layer, the P2P download layer is used to provide a media data source through local download, local proxy, and/or self server call, the transport layer is used to obtain media data from the P2P download layer, decapsulate the media data, perform corresponding streaming encapsulation according to a data request of the playback layer, and the playback layer is used to obtain the media data, perform demultiplexing, and finally perform decoding display through the decoding display layer.
It should be noted that: the video stream seamless switching apparatus provided in the foregoing embodiment is only illustrated by dividing the functional modules when triggering a video stream seamless switching service, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the video stream seamless switching apparatus provided in the foregoing embodiment and the video stream seamless switching method embodiment belong to the same concept, and specific implementation processes thereof are described in the method embodiment and are not described herein again.
All the above-mentioned optional technical solutions can be combined arbitrarily to form the optional embodiments of the present invention, and are not described herein again.
In summary, the seamless switching method for video streams provided in the embodiments of the present invention has the following advantages, compared with the prior art:
1. the switching time point of the new video stream is calculated and obtained simultaneously when the old video of the streaming media is played, the new video stream is opened in the background, and the real-time playing related data of the old video stream and the new video stream are continuously obtained, so that the switching of the new video stream and the old video stream is fully prepared in advance, and finally the switching of the new video stream and the old video stream is carried out at the corresponding switching time point of the new video stream;
2. seamless switching is realized based on a transmission layer, the scheme of using a multi-player is avoided, and a strategy of adopting single-path transmission or double-path transmission is flexibly adopted according to the actual operation state of a terminal (in the actual operation condition, most of the operation can be realized only by adopting single-path transmission, and a small part of the operation can be downloaded by adopting double-path transmission simultaneously);
3. compared with the traditional code stream switching scheme, the method greatly improves the playing experience of users and has wide application prospect.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true scope of the embodiments of the present application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A seamless switching method for video streams, which is implemented based on a transport layer of a P2P playing mechanism, the method comprising:
when playing an old video stream, according to a switching request of a new video stream, carrying out switching preparation and opening operation of the corresponding new video stream, wherein the switching preparation comprises the step of determining the switching condition of the new video stream;
after the new video stream is opened, continuously acquiring the playing related data of the old video stream and the new video stream;
resetting a decoder to obtain the media data of the new video stream;
performing seamless switching at the corresponding switching time point of the new video stream; setting the current playing time of an old video stream as t0, setting the player buffering time as d, searching a first key frame after the time point in the current video stream through t0+ d to obtain time t1, synchronously and asynchronously opening a new video stream, initially setting a switching time point as t1, searching a first key frame after t0+ d on the new video stream to obtain time t2, and if the new video stream is opened before the old video stream reads t1, if abs (t1-t2) is less than 1000ms, performing seamless switching at the corresponding switching time point of the new video stream, including:
if t1< t2, the modified switching time point is t2, and switching is performed at the time point of t 2;
if t1> t2, if the time point of reading the new video stream is less than t2, correcting the switching time point to be t2, and switching at the time point of t 2; if the time point of reading the new video stream is greater than t2, the switching time point is set to t1 and switching is performed at a time point of t 1.
2. The method according to claim 1, wherein the media data of the new and old video streams are obtained by means of P2P downloading; a switching request according to a new video stream transmitted through a transport layer; decapsulating the media data of the new and old video streams, and performing streaming encapsulation according to a play request; and demultiplexing the media data, and decoding and displaying.
3. The method of claim 2,
the opening operation of the new video stream comprises the following steps:
opening the new video stream according to the received corresponding definition parameter;
and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
4. The method of claim 3,
the handover request includes a resolution match and/or a session ID valid for handover transmission.
5. The method according to any one of claims 1 to 4, further comprising:
if at the time point t of reading of the old video stream1Then opening a new video stream, and after the new video stream is successfully opened, starting from t0The first key frame t after + d2And starting to send the playing data of the new video stream, and switching when the next key frame of the new video stream is acquired.
6. A seamless switching apparatus for video streams, comprising:
the switching preparation module further comprises a switching preparation module and an opening operation module, the switching preparation module and the opening operation module are used for performing switching preparation and opening operation of corresponding new video streams according to switching requests meeting the switching conditions of the new video streams, and the switching preparation comprises the step of determining the switching conditions of the new video streams;
the acquisition module is used for continuously acquiring the playing related data of the old video stream and the new video stream after the new video stream is opened;
the decoding module is used for resetting a decoder and acquiring the media data of the new video stream;
the switching module is used for carrying out seamless switching at the corresponding switching time point of the new video stream; when the new video stream is opened before the old video stream is read to t1, if abs (t1-t2) <1000ms, the corresponding switching time point of the new video stream is seamless, including:
if t1< t2, the modified switching time point is t2, and switching is performed at the time point of t 2;
if t1> t2, if the time point of reading the new video stream is less than t2, correcting the switching time point to be t2, and switching at the time point of t 2; if the time point of reading the new video stream is greater than t2, the switching time point is set to t1 and switching is performed at a time point of t 1.
7. The apparatus of claim 6, wherein the playback flow architecture of the apparatus is composed of a P2P download layer, a transport layer, a playback layer, and a decoding display layer, the P2P download layer is configured to provide a media data source through local download, local proxy and/or self server call, the transport layer is configured to obtain media data from the P2P download layer, decapsulate the media data, perform corresponding streaming encapsulation according to a data request of the playback layer, and the playback layer is configured to obtain the media data, perform demultiplexing, and perform decoding display through the decoding display layer.
8. The apparatus of claim 7,
the open operation module further comprises a new video stream open submodule and a result feedback submodule,
the new video stream opening sub-module is used for:
opening the new video stream according to the received corresponding definition parameter;
the result feedback submodule is used for:
and if the new video stream fails to be opened, feeding back the result and continuously playing the old video stream.
9. The apparatus of claim 8, wherein the handover request comprises a resolution match and/or a session ID of handover transmission is valid.
10. The apparatus of any one of claims 6 to 9, wherein the switching module is further configured to:
if at the time point t of reading of the old video stream1Then opening a new video stream, and after the new video stream is successfully opened, starting from t0The first key frame t after + d2And starting to send the playing data of the new video stream, and switching when the next key frame of the new video stream is acquired.
CN201811181905.8A 2018-10-11 2018-10-11 Seamless switching method and device for video stream Active CN109246462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811181905.8A CN109246462B (en) 2018-10-11 2018-10-11 Seamless switching method and device for video stream

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811181905.8A CN109246462B (en) 2018-10-11 2018-10-11 Seamless switching method and device for video stream

Publications (2)

Publication Number Publication Date
CN109246462A CN109246462A (en) 2019-01-18
CN109246462B true CN109246462B (en) 2021-08-06

Family

ID=65052071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811181905.8A Active CN109246462B (en) 2018-10-11 2018-10-11 Seamless switching method and device for video stream

Country Status (1)

Country Link
CN (1) CN109246462B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111479171B (en) * 2019-01-23 2022-05-20 上海哔哩哔哩科技有限公司 Pseudo seamless switching method, device and medium among different video sources played by Web
CN111954068B (en) * 2019-05-14 2023-01-24 阿里巴巴集团控股有限公司 Method and device for video definition switching and electronic device
CN110139148B (en) * 2019-05-22 2021-05-28 武汉瓯越网视有限公司 Video switching definition method and related device
CN110213659B (en) * 2019-07-01 2021-06-08 杭州当虹科技股份有限公司 Method for realizing fast switching player between different video streams
CN110636338B (en) * 2019-09-17 2024-05-14 北京百度网讯科技有限公司 Video definition switching method and device, electronic equipment and storage medium
CN110933506B (en) * 2019-11-14 2021-10-22 武汉兴图新科电子股份有限公司 Method and system for seamless switching of encoding and decoding
CN112995649B (en) * 2019-12-13 2024-04-16 青岛海信宽带多媒体技术有限公司 Network terminal and network terminal evaluating method
CN113225585A (en) * 2020-01-21 2021-08-06 腾讯科技(深圳)有限公司 Video definition switching method and device, electronic equipment and storage medium
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
CN112087646B (en) * 2020-08-26 2023-01-17 深圳市雅阅科技有限公司 Video playing method and device, computer equipment and storage medium
CN112291611A (en) * 2020-10-27 2021-01-29 重庆虚拟实境科技有限公司 Video playing method, computer device and readable storage medium
CN115225955A (en) * 2021-04-16 2022-10-21 海信视像科技股份有限公司 Display device, video switching method, video switching device and storage medium
CN113973233A (en) * 2021-10-22 2022-01-25 深圳小湃科技有限公司 Method, device and equipment for optimizing switching playing of multi-platform film and storage medium
CN117156223B (en) * 2023-10-31 2024-03-15 中央广播电视总台 Real-time stream switching method, device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101098470A (en) * 2006-06-28 2008-01-02 腾讯科技(深圳)有限公司 P2P technique based stream media program broadcasting/receiving method and apparatus
CN102905188A (en) * 2012-11-01 2013-01-30 北京奇艺世纪科技有限公司 Video code stream switching method and device
CN103997680A (en) * 2014-06-06 2014-08-20 北京奇艺世纪科技有限公司 Switching method and device of video bitstream
CN104822084A (en) * 2015-04-30 2015-08-05 华南理工大学 Concurrent-stream-based rapid channel switching method of P2P real-time playing system
CN106210863A (en) * 2015-05-28 2016-12-07 因佛卡斯公司 The system and method for smooth conversion between compression video flowing
CN108174280A (en) * 2018-01-18 2018-06-15 湖南快乐阳光互动娱乐传媒有限公司 A kind of online playback method of audio and video and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7174085B2 (en) * 2001-08-20 2007-02-06 Broadcom Corporation Apparatus and method of seamless switching between a live DTV decoding and a PVR playback
US20140368737A1 (en) * 2013-06-17 2014-12-18 Spotify Ab System and method for playing media during navigation between media streams

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101098470A (en) * 2006-06-28 2008-01-02 腾讯科技(深圳)有限公司 P2P technique based stream media program broadcasting/receiving method and apparatus
CN102905188A (en) * 2012-11-01 2013-01-30 北京奇艺世纪科技有限公司 Video code stream switching method and device
CN103997680A (en) * 2014-06-06 2014-08-20 北京奇艺世纪科技有限公司 Switching method and device of video bitstream
CN104822084A (en) * 2015-04-30 2015-08-05 华南理工大学 Concurrent-stream-based rapid channel switching method of P2P real-time playing system
CN106210863A (en) * 2015-05-28 2016-12-07 因佛卡斯公司 The system and method for smooth conversion between compression video flowing
CN108174280A (en) * 2018-01-18 2018-06-15 湖南快乐阳光互动娱乐传媒有限公司 A kind of online playback method of audio and video and system

Also Published As

Publication number Publication date
CN109246462A (en) 2019-01-18

Similar Documents

Publication Publication Date Title
CN109246462B (en) Seamless switching method and device for video stream
US10743038B2 (en) Live broadcast processing method, apparatus, device, and storage medium
CN103200461B (en) A kind of multiple stage playback terminal synchronous playing system and player method
US10638180B1 (en) Media timeline management
KR102469142B1 (en) Dynamic playback of transition frames while transitioning between media stream playbacks
CN111836059B (en) Media stream sending method, device and equipment
KR20170074866A (en) Receiving device, transmitting device, and data processing method
US10225319B2 (en) System and method of a link surfed http live streaming broadcasting system
CN108174280B (en) Audio and video online playing method and system
WO2020228482A1 (en) Video processing method, apparatus and system
US20220385989A1 (en) Video playing control method and system
CN110545457A (en) Video playing method, video playing system, terminal equipment and storage medium
CN108965997A (en) Stream media live broadcasting method and device based on mobile vulnerable network environment
WO2019149066A1 (en) Video playback method, terminal apparatus, and storage medium
CN103281566B (en) A kind of method and device of video switching
CN113727199A (en) HLS slice rapid playing starting method
CN108574883A (en) The method for realizing multiple CDN Parallel downloads video segments
WO2020216277A1 (en) Media stream sending method, apparatus, device and system
US8887225B2 (en) Method and apparatus for reproducing broadcast content, and method and apparatus for providing broadcast content
CN112714341B (en) Information acquisition method, cloud set top box system, entity set top box and storage medium
US20230217047A1 (en) Method, system, and computer-readable recording medium for implementing fast-switching mode between channels in multi-live transmission environment
JP5997500B2 (en) Broadcast communication cooperative receiver
WO2018171567A1 (en) Method, server, and terminal for playing back media stream
KR101538114B1 (en) Video processing apparatus and method for seamless video playing in a mobile smart device based on multi-codec
WO2018139283A1 (en) Image processing device, method and program

Legal Events

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