The present application is a national phase application of PCT international patent application No. PCT/CN2019/125521, filed on Dec. 16, 2019, which claims priority to Chinese patent application No. 201910061657.1, 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 present invention relates to a field of the Internet technology, more particularly to a field of network video technology, and specifically refers to a seamless switching method, a device and a computer-readable storage medium of software and hardware decoding resolution.
The existing mobile player usually provides two video decoding schemes: software decoding and hardware decoding. Generally, the hardware decoding is preferred by a player client, because the hardware decoding takes up less system resources and computing performance of the player client using the hardware decoding is higher.
DASH (Dynamic Adaptive Streaming over HTTP) video is a common network video format, during playing a DASH video, a switching of a video definition involves a change of video coding, a video decoder needs to adapt to the switching between H.264 and H.265. Since an initialization of the video decoder takes a certain time, it is easy to get stuck when switching the video definition, the video playback is not smooth, and user's viewing experience is poor.
How to provide a seamless switching method of hardware decoding resolution suitable for the DASH video, to avoid sticking during playback, and improve the user experience, has become an urgent problem in the field.
The purpose of the present invention is to overcome disadvantages of the prior art, and provide a seamless switching method, device and computer-readable storage medium of software and hardware decoding resolution, which when a resolution is switched, firstly, initializes a soft decoder, uses the soft decoder to perform a corresponding second decoder decoding operation, and starts hard decoding using the second hard decoder at the same time, when a decoding progress of the second hard decoder catches up with a decoding progress of the soft decoder, then switches to the hard decoding, so as to realize the seamless switching between resolutions. In order to realize the above purpose, the seamless switching method of software and hardware decoding resolution in this present invention includes the following steps:
In the seamless switching method of software and hardware decoding resolution, the packaged video is a DASH format video.
In the seamless switching method of software and hardware decoding resolution, the first encoded format is any one of an H.264 encoded format and an H.265 encoded format, and the second encoded format is the other of the two encoded formats except the first encoded format; the first hard decoder is a hardware decoder corresponding to the first encoded format, and the second hard decoder is a hardware decoder corresponding to the second encoded format.
In the seamless switching method of software and hardware decoding resolution, the first encoded format is the same as the second encoded format.
In the seamless switching method of software and hardware decoding resolution, the step (5) specifically comprises the following steps:
In the seamless switching method of software and hardware decoding resolution, the step (7) specifically comprises the following steps:
In the seamless switching method of software and hardware decoding resolution, the step (3) specifically comprises:
In the seamless switching method of software and hardware decoding resolution, the step (3) specifically comprises:
In the seamless switching method of software and hardware decoding resolution, the step (2) specifically comprises the following steps:
In the seamless switching method of software and hardware decoding resolution, the player is an iOS video player, the decoder is a VideoToolbox hardware decoder.
In the seamless switching method of software and hardware decoding resolution, the player is an Android video player, the decoder is a MediaCodec hardware decoder.
This present invention further provides a computer-readable storage medium, storing computer programs, when the computer programs are executed by a processor, the seamless switching method of software and hardware decoding resolution is realized.
This present invention further provides a seamless switching device of software and hardware decoding resolution, which comprises a processor and a memory, wherein the memory stores computer programs, when the computer programs are executed by the processor, the seamless switching method of software and hardware decoding resolution is realized.
The method, device and computer-readable medium of the present invention comprise, during playing a DASH video, initializing a software decoder according to a video stream in a target encoded format received by an original decoder when it needs to switch to another resolution, at the same time the original decoder continuing to decode the video stream in an original encoded format existing in a buffer, decoding the video stream in the target encoded format using the software decoder after the video stream in the original encoded format is decoded, at the same time initializing a second hardware decoder corresponding to the target encoded format, switching to the second hardware decoder and stopping software decoding when a decoding progress of the second hardware decoder catches up with a decoding progress of the software decoder, so as to realize the seamless switch between the resolutions, avoid sticking in the process of playing the video, and improve user experience. And the seamless switching method, device and computer-readable storage medium of software and hardware decoding resolution of the present invention have the advantages of simple implementation, low application cost and wide application range.
In order to understand the technical content of the present invention more clearly, the following embodiments are particularly described.
Please refer to
In one embodiment, the seamless switching method of software and hardware decoding resolution includes the following steps:
Wherein, the packaged video can be a DASH format video. The first encoded format is an H.264 encoded format, and the second encoded format is an H.265 encoded format, and it is feasible for adverseness. The first hard decoder is a decoder corresponding to the first encoded format, the second hard decoder is a decoder corresponding to the second encoded format. In addition, the first encoded format is the same as the second encoded format, i.e. both of the first encoded format and the second encoded format are H.264 encoded formats, or both of the first encoded format and the second encoded format are h.265 encoded formats, but they have different resolutions, for example, both of the first encoded format and the second encoded format are H.264 encoded formats, with resolutions of 480p and 720p respectively.
In a preferred embodiment, the step (5) specifically comprises the following steps:
In a further preferred embodiment, the step (7) specifically comprises the following steps:
In another preferred embodiment, the step (3) can specifically comprise:
Or the step (3) can specifically comprise:
In a further preferred embodiment, the step (2) specifically comprises the following steps:
In the embodiment, a first frame can be achieved quickly, waiting time of the user can be saved, and the use experience can be improved.
In a further preferred embodiment, the player can also be an Android video player, correspondingly, the decoder is a MediaCodec hardware decoder.
The present invention also provides a seamless switching device and computer-readable storage medium of software and hardware decoding resolution, 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 seamless switching method of software and hardware decoding resolution is realized.
In the practical application, the flow of the seamless switching method of software and hardware decoding resolution of the present invention is shown in
A user uses a mobile terminal, such as a mobile phone, to play a DASH video, and the mobile terminal is set to hardware decoding. A playback resolution set at this time is 480P. The DASH video begins to unpack to get a corresponding video stream of the H.264 encoded format. A H.264 hard decoder is initialized, and a video stream of the H.264 encoded format is decoded into frames, then, the video can be played at a resolution of 480P. When the user switches the resolution from 480P to 720P manually, a flow diagram of switching is shown in
In the DASH video, the resolution of 1080P and 720P are encoded in H.265, and the resolution of 480p and 360p are encoded in H.264. Therefore, resolution switching from 360p to 1080p is the same as the above process. When the resolution is switched from 720p to 480p, the conversion from H.265 decoder to H.264 decoder is similar to the above process.
The mobile terminal can be an Android device, then the player is an Android video player, correspondingly, the decoder is a MediaCodec hardware decoder.
When the embodiment is used for picture quality switching (definition switching, for example, 480p to 720p), during the switching process, the decoder needs to be restarted, at this time, soft decoding is started to make up for the situation that the hard decoding restart process cannot output frames, so that video pictures look smoother.
Difference between the embodiment 2 and the embodiment 1 is that the mobile terminal such as the mobile phone used by the user can detect a bandwidth of a network. During the DASH video playback, after a change of the bandwidth is detected, whether the resolution needs to be adjusted can be determined automatically. When the resolution needs to be adjusted, the switching is completed automatically according to a current resolution and a target resolution with the switching process which is described in the embodiment 1. The automatic switching mode can adapt to the bandwidth to the greatest extent, avoid the sticking, and ensure the viewing experience of users.
At the beginning of the DASH video playback, a method of soft decoding first and then converting to hard decoding can also be adopted. Specifically, when the player is set to adopt 480P resolution, the video stream with the H.264 encoded format is decoded by a soft decoder first, and the video is played at 480p resolution; then the player decodes the video stream with the H.264 encoded format using the first hard decoder; when a decoding progress of the first hard decoder catches up with a decoding progress of the soft decoder, the video at 480P resolution decoded by the first hard decoder is played, and the soft decoder is stopped. In this way, soft decoding and hard decoding can be created at the same time during the start-up playing process, output speed of frames of the soft decoding is faster, so as to make up for the slow first frame of the hard decoding, after the hard decoding catches up with the soft decoding, switching to the hard decoding, the hard decoding saves power, consumes less CPU and is more fluent.
In the seamless switching method, device and computer-readable storage medium of software and hardware decoding resolution, during playing a DASH video, when it is necessary to switch a resolution, initializing a soft decoder according to a video stream of a target encoded format received by an original decoder, at the same time, the original decoder continuing to decode the video stream of an original encoded format existing in the cache in an original format, after the video stream of the original encoded format is decoded, decoding the video stream of the target encoded format using the soft decoder, and initializing a second hard decoder corresponding to the target encoded format at the same time and decoding, when a decoding progress of the second hard decoder catches up with a decoding progress of the soft decoder, switching to the second hard decoder and stopping soft decoding, so as to realize the seamless switching between resolutions, avoid sticking in the process of playing, and improve the user experience. And the seamless switching method, device and computer-readable storage medium of software and hardware decoding resolution 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 |
---|---|---|---|
201910061657.1 | Jan 2019 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2019/125521 | 12/16/2019 | WO |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2020/151397 | 7/30/2020 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
8868999 | Varnica et al. | Oct 2014 | B1 |
9251855 | Graves et al. | Feb 2016 | B2 |
20130128989 | Kyakuno | May 2013 | A1 |
20160156959 | Lee | Jun 2016 | A1 |
20170127074 | Wu et al. | May 2017 | A1 |
20180007362 | Krishnan | Jan 2018 | A1 |
20190327480 | Morishige | Oct 2019 | A1 |
Number | Date | Country |
---|---|---|
101778259 | Jul 2010 | CN |
105992056 | Oct 2016 | CN |
107249144 | Oct 2017 | CN |
107396123 | Nov 2017 | CN |
107707976 | Feb 2018 | CN |
107786890 | Mar 2018 | CN |
109168078 | Jan 2019 | CN |
2716337 | Aug 2014 | EP |
WO 2017007659 | Jan 2017 | WO |
Entry |
---|
International Patent Application No. PCT/CN2019/125521; Int'l Search Report; dated Mar. 18, 2020; 2 pages. |
Number | Date | Country | |
---|---|---|---|
20220124403 A1 | Apr 2022 | US |