The present application claims priority of Chinese patent application No. 201910061516.X, filed on Jan. 23, 2019. The entire disclosure of the above-identified application is hereby incorporated by reference herein and made a part of this specification.
The embodiments of the present invention relate to a field of the Internet technology, more particularly to a field of network video technology, and specifically to refer to a pseudo seamless switching method, a device and a computer-readable media for Web playing between different video sources.
Video Website is a popular content Website at present. Web browser is one of the main ways to visit video Websites. At present, there are three kinds of video source formats commonly used in the network: DASH (Dynamic Adaptive Streaming over HTTP) format, fly format and mp4 format. The best user experience is the DASH format, followed by the fly format and the mp4 format. Because of level of support of different browser platforms for video source format, usability of some browsers is just the opposite, for example, the mp4 format is better than the fly format, and the DASH format is the most unsupported.
During the actual use, according to different network states or users' viewing needs, the resolution usually needs to be switched, and different resolutions often need to switch the video source format. When gop (group of picture) is not aligned, different video source formats can not be switched directly, only the DASH format itself can be switched seamlessly. The DASH format switch thread is shown in
Therefore, how to provide a seamless switching method between various video sources, to avoid blocking during playback, and improve user experience become an urgent problem in the field.
The purpose of the present invention is to overcome above disadvantages of the prior art, and provide a pseudo seamless switching method, device and computer-readable medium for Web playing different video sources, which can realize seamless switching between various video sources, avoid blocking during playback, and improve user experience.
In order to realize the above purpose, the pseudo seamless switching method for Web playing different video sources in this present invention includes the following steps:
(1) a Web browser playing a first video source of a video;
(2) the Web browser receiving a switching video source instruction;
(3) the Web browser establishing a second video source playback instance of the video;
(4) the Web browser determining synchronization time according to a playing state of the first video source and a running state of the second video source playback instance;
(5) after the synchronization time, the Web browser switching to the second video source playback instance, and stopping playing the first video source.
In the pseudo seamless switching method for Web playing different video sources, the first video source and the second video source are any of DASH format, fly format and mp4 format.
In the pseudo seamless switching method for Web playing different video sources, the step (4) specifically comprises the following steps:
(41) determining whether a bandwidth of the Web browser is sufficient according to the following formula, and a remaining buffer length of the first video source is long,
B
2/8×L/S×N+T≤F
wherein, B2 is a total average code rate of the second video source; L is a length of data required for the second video source to acquire video data to be able to play; S is a speed of the Web browser to acquire the data; N is a speed safety value of acquiring data; T is time required for the Web browser to start acquiring data; F is the remaining buffer length of the first video source;
if yes, determining that the synchronization time is: B2/8×L/S×N+T;
if not, step (42) is executed;
(42) determining whether the bandwidth of the Web browser is sufficient according to the following formula, and the remaining buffer length of the first video source is short,
B
2/8×L/S×N+T>F
and
(B2+B1)/8≤S/N2
wherein, B1 is a total average code rate of the first video source, N2 is a speed safety value of data of two video sources obtained by the Web browser;
if yes, determining that the synchronization time is: (B2+B1)/8×L/S×N+T; if not, step (43) is executed;
(43) determining that the synchronization time is: B2/8×L/S×N+T.
In the pseudo seamless switching method for Web playing different video sources, the step (2) specifically comprises:
the Web browser the playing state of the first video source in real time, and automatically generating the switching video source instruction according to a detection result.
In the pseudo seamless switching method for Web playing different video sources, the step (2) specifically comprises:
generating a corresponding switching video source instruction by a user operation received by the Web browser.
The present invention further provides a pseudo seamless switching method for Web playing different video sources, the method includes the following steps:
(A) a Web browser obtaining a first video source of a video from a server, and playing;
(B) the Web browser receiving a switching video source instruction;
(C) the Web browser obtaining a second video source of the video from the server, and establishing a second video source playback instance;
(D) the Web browser determining synchronization time according to a playing state of the first video source and a network state between the Web browser and the server;
(E) after the synchronization time, the Web browser switching to the second video source playback instance, and stopping playing the first video source.
In the pseudo seamless switching method for Web playing different video sources, the first video source and the second video source are any of DASH format, fly format and mp4 format.
In the pseudo seamless switching method for Web playing different video sources, the step (D) specifically comprises the following steps:
(D1) determining whether a network speed between the Web browser and the server is sufficient according to the following formula, and a remaining buffer length of the first video source is long,
B
2/8×L/S×N+TS
if yes, determining that the synchronization time is: B2/8×L/S×N+T;
if not, step (D2) is executed;
(D2) determining whether the network speed between the Web browser and the server is sufficient according to the following formula, and the remaining buffer length of the first video source is short,
B
2/8×L/S×N+T>F
and
(B2+B1)/8S/N2
wherein, B1 is a total average code rate of the first video source, N2 is a speed safety value of data of two video sources obtained by the Web browser;
if yes, determining that the synchronization time is: (B2+B1)/8×L/S×N+T;
if not, step (D3) is executed;
(D3) determining that the synchronization time is: B2/8×L/S×N+T.
This present invention further provides a computer-readable storage medium, storing computer programs executed by a processor, when the computer programs are executed by a processor, the pseudo seamless switching method for Web playing different video sources is realized.
This present invention further provides a pseudo seamless switching device for Web playing different video sources, which comprises a processor and a memory, wherein the memory stores computer programs, when the computer programs are executed by the processor, the pseudo seamless switching method for Web playing different video sources is realized.
The pseudo seamless switching method, device and computer-readable medium for Web playing different video sources are adopted. In this method, when it is necessary to switch a video source, the web browser first establishes a target video source playback instance, and determines the synchronization time of the two according to the playing state of the original video source and network state of the Web browser; after the synchronization time, the Web browser switches to the target video source playback instance, to achieve seamless switching between various video sources, so as to effectively avoid blocking during playback and greatly improve user experience. And the pseudo seamless switching method, device and computer-readable medium for Web playing different video sources of the present invention have the advantages of simple implementation, low application cost and wide application range.
In order to be able to understand the technical content of the present invention more clearly, the following embodiments are particularly described.
Please refer to
In one embodiment, the pseudo seamless switching method for Web playing different video sources includes the following steps:
(1) a Web browser playing a first video source of a video;
(2) the Web browser receiving a switching video source instruction;
(3) the Web browser establishing a second video source playback instance of the video;
(4) the Web browser determining synchronization time according to a playing state of the first video source and a running state of the second video source playback instance;
(5) after the synchronization time, the Web browser switching to the second video source playback instance, and stopping playing the first video source.
The first video source and the second video source are any of DASH format, fly format and mp4 format.
In one preferred embodiment, the step (4) specifically includes the following steps:
(41) determining whether a bandwidth of the Web browser is sufficient according to the following formula, and a remaining buffer length of the first video source is long,
B
2/8×L/S×N+T≤F
wherein, B2 is a total average code rate of the second video source; L is a length of data required for the second video source to acquire video data to be able to play; S is a speed of the Web browser to acquire the data; N is a speed safety value of acquiring data; T is time required for the Web browser to start acquiring data; F is the remaining buffer length of the first video source;
if yes, determining that the synchronization time is: B2/8×L/S×N+T;
if not, step (42) is executed;
(42) determining whether the bandwidth of the Web browser is sufficient according to the following formula, and the remaining buffer length of the first video source is short,
B
2/8×L/S×N+T>F
and
(B2+B1)/8≤S/N2
wherein, B1 is a total average code rate of the first video source, N2 is a speed safety value of data of two video sources obtained by the Web browser;
if yes, determining that the synchronization time is: (B2+B1)/8×L/S×N+T;
if not, step (43) is executed;
(43) determining that the synchronization time is: B2/8×L/S×N+T.
In a more selective embodiment, the step (2) may be:
the Web browser the playing state of the first video source in real time, and automatically generating the switching video source instruction according to a detection result. To realize automatic switching of the video source (resolution).
Or, the step (2) may also be:
generating a corresponding switching video source instruction by a user operation received by the Web browser. To realize manual switching of the video source (resolution).
The present invention also provides a pseudo seamless switching method for Web playing different video sources, in one embodiment, as shown in
(A) a Web browser obtaining a first video source of a video from a server, and playing;
(B) the Web browser receiving a switching video source instruction:
(C) the Web browser obtaining a second video source of the video from the server, and establishing a second video source playback instance;
(D) the Web browser determining synchronization time according to a playing state of the first video source and a network state between the Web browser and the server;
(E) after the synchronization time, the Web browser switching to the second video source playback instance, and stopping playing the first video source.
Wherein, the first video source and the second video source are any of DASH format, fly format and mp4 format.
In one preferred embodiment, the step (D) specifically includes the following steps:
(D1) determining whether a network speed between the Web browser and the server is sufficient according to the following formula, and a remaining buffer length of the first video source is long,
B
2/8×L/S×N+T≤F
wherein, B2 is a total average code rate of the second video source; L is a length of data required for the second video source to acquire video data to be able to play; S is a speed of the Web browser to acquire the data; N is a speed safety value of acquiring data; T is time required for the Web browser to start acquiring data; F is the remaining buffer length of the first video source;
if yes, determining that the synchronization time is: B2/8×L/S×N+T;
if not, step (D2) is executed:
(D2) determining whether the network speed between the Web browser and the server is sufficient according to the following formula, and the remaining buffer length of the first video source is short,
B
2/8×L/S×N+T>F
and
(B2+B1)/8≤S/N2
wherein, B1 is a total average code rate of the first video source, N2 is a speed safety value of data of two video sources obtained by the Web browser;
if yes, determining that the synchronization time is: (B2+B2)/8×L/S×N+T;
if not, step (D3) is executed;
(D3) determining that the synchronization time is: B2/8×L/S×N+T.
The present invention also provides a pseudo seamless switching device for Web playing different video sources and a computer-readable storage medium, the device includes a processor and a memory. The memory is the computer-readable storage medium, storing computer programs. When the computer programs are executed by the processor, the pseudo seamless switching method for Web playing different video sources described in the above embodiment is realized.
In actual applications, the pseudo seamless switching method for Web playing different video sources of the present invention is described by the following embodiment.
User's network speed supports seamless switching, and remaining of the first video source supports the user to pull stream a new video source (download target video source data) to playing-enough data and then play (that is, just new video source data needs to be downloaded).
That is, the user's network speed is sufficient, and a remaining buffer length of original video is long enough.
Then B2/8×L/S×N+T≤F, switch time is B2/8×L/S×N+T.
Take the user switches a resolution from 1080P to 720P as an example,
1. a total average code rate of the original video (audio+video) B1 (kbps)=2000
2. a total average code rate of a new video (audio+video) B2 (kbps)=4000
3. a remaining buffer length of the original video F(s)=5
4. an average download speed of users S(k/s)=600
5. average time for users to establish a connection T(s)=0.2
6. safety value (an average value set for preventing the network speed from not reaching the average download speed) N=1.5
7. a new video stream is pulled to a enough data length for play L(s)=2
B
2/8×L/S×N+T≤F
4000/8×2/600×1.5+0.2=2.6<5, the above requirements are met.
A seamless switching thread is shown in
In this state, the user's network speed is sufficient, and the remaining buffer length of the original video is large, at this time, the seamless switching is supported, and the remaining part of the original video supports the user to pull the new stream to enough data for play and then play.
The user's network speed supports seamless switching, but a period of time may need to be prepared, that is, seamless switching of two streams needs to be pulled at the same time (original video source data and target video source data need to be downloaded at the same time).
The common scene is that the user's network speed is sufficient, and two channels of similar definition switch to each other, but the remaining buffer length of the original video is very small. Then it meets conditions B2/8×L/S×N+T>F and (B2+B2)/8≤S/N2, the synchronization time is: (B2+B1)/8×L/S×N+T;
Take the user switches a resolution from 720P to 1080P as an example, the network speed is sufficient, but the buffer of original video source is insufficient.
1. a total average code rate of the original video (audio+video) B1 (kbps)=1000
2. a total average code rate of a new video (audio+video) B2 (kbps)=4000
3. a remaining buffer length of the original video F(s)=1
4. an average download speed of users S(k/s)=1000
5. average time for users to establish a connection T(s)=0.2
6. download safety value (an average value set for preventing the network speed from not reaching the average download speed) N=1.5
7. safety value of two-channel pull streams (in some cases, the speed is enough to pull two-channel streams, but it may be very slow, and it also needs to be controlled) N2=1.2
8. a new video stream is pulled to a data length to play enough L(s)=2
B
2/8×L/S×N+T>F
4000/8×2/1000×1.5+0.2=1.7>1
and (B2+B1)/8≤S/N2
(4000+1000)/8=625<833
then the seamless switching time is:
(B2+B1)/8×L/S×N+T
(4000+1000)/8×2/1000×1.5+0.2=2.075
A seamless switching thread is shown in
In this state, the user's network speed is sufficient, two channels of similar definition switch to each other, but the remaining buffer length of the original video is very small, so the seamless switching can be supported, but it may take a period of time to prepare (seamless switching of pulling two streams at the same time).
The user's network speed does not support seamless switching, that is, the seamless switching is impossible.
The common scene is switching a definition from low definition to high definition, but the user's download speed and the remaining buffer length are not enough to support conditions of the seamless switching, at this time, the seamless switching can not be adopted.
The conditions of the seamless switching is B2/8×L/S×N+T>F and (B2+B1)/8>S/N2, blocking switching time is B2/8×L/S×N+T
Take the user switches a definition from a fluent definition to 1080P as an example,
1. a total average code rate of the original video (audio+video) B1 (kbps)=400
2. a total average code rate of a new video (audio+video) B2 (kbps)=4000
3. a remaining buffer length of the original vide F(s)=2
4. an average download speed of users S(k/s)=200
5. average time for users to establish a connection T(s)=0.2
6. safety value (an average value set for preventing the network speed from not reaching the average download speed) N=1.5
7. safety value of two-channel pull streams (in some cases, the speed is enough to pull two-channel streams, but it may be very slow, and it also needs to be controlled) N2=1.2
8. a new video stream is pulled to an enough data length to play L(s)=2
B
2/8×L/S×N+T>F
4000/8*2/200*1.5+0.2=7.7>2
(B2+B1)/8>S/N2
(4000+400)/8=550>200/1.2=166
Buffer switching time is B2/8×L/S×N+T=7.7 s, then a seamless switching thread is shown in
In this state, the user's network speed does not support seamless switching. The common scene is to switch the definition from low definition to high definition, but the user's download speed and the remaining buffer length are not enough to support conditions of the seamless switching, at this time, the seamless switching can not be adopted, and a pull stream with low definition stops and waits until a high definition stream is completed.
During the actual use, it is necessary to determine whether the above embodiments are satisfied in turn, that is, conditions of embodiment 1 is satisfied as far as possible, and only the target video source data technology needs to be switched seamlessly next week.
The pseudo seamless switching method, device and computer-readable medium for Web playing different video sources are adopted. In this method, when it is necessary to switch a video source, the web browser first establishes a target video source playback instance, and determines the synchronization time of the two according to the playing state of the original video source and network state; after the synchronization time, the Web browser switches to the target video source playback instance, to achieve seamless switching between various video sources, so as to effectively avoid blocking during playback and greatly improve user experience. And the pseudo seamless switching method, device and computer-readable medium for Web playing different video sources of the present invention have the advantages of simple implementation, low application cost and wide application range.
In this specification, the present invention has been described with reference to its specific embodiments. However, it is clear that various modifications and changes can still be made without departing from the spirit and scope of the present invention. Therefore, the specification and drawings shall be considered as illustrative rather than restrictive.
Number | Date | Country | Kind |
---|---|---|---|
201910061516.X | Jan 2019 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2019/125523 | 12/16/2019 | WO | 00 |