A SEAMLESS SWITCHING METHOD, DEVICE AND STORAGE MEDIUM OF HARDWARE DECODING DYNAMIC RESOLUTION
20220124281 ยท 2022-04-21
Inventors
Cpc classification
H04N21/440218
ELECTRICITY
H04N21/440263
ELECTRICITY
H04N21/44209
ELECTRICITY
H04N7/0117
ELECTRICITY
International classification
H04N7/01
ELECTRICITY
H04N19/169
ELECTRICITY
H04N21/4402
ELECTRICITY
Abstract
The present invention provides a method, device and computer-readable medium of a seamless and dynamic switch between resolutions based on hardware decoding and belongs to a field of the internet technology. According to the method, device and computer-readable medium of the present invention, during a DASH video playback, when it needs to switch to another resolution, the original decoder continues to decode the video stream in the original encoded format that already stores in a buffer, while the video stream in the original encoded format is decoded, a second decoder corresponding to a target encoded format is initialized based on a video stream in the target encoded format received by the original decoder, and the video stream of the target encoded format is decoded by the second decoder, so as to realize the seamless switch between resolutions, avoid a jam in the process of playing the video, and improve the user experience.
Claims
1. A method of a seamless and dynamic switch between resolutions based on hardware decoding, comprising: in response to receiving packaged video data associated with a video, performing an unpacking operation on the packaged data to obtain a video stream of the video in a first encoded format by the player; decoding the video stream in the first encoded format using a first decoder, and playing the video at a first resolution by the player; receiving an instruction of switching to a second resolution of the video; performing the unpacking operation on the packaged video data to obtain a video stream of the video in a second encoded format by the player; receiving at least one portion of the video stream in the second encoded format by the first decoder; initializing a second decoder based on the at least one portion of the video stream in the second encoded format received by the first decoder while decoding data associated with the video stream in the first encoded format stored in a buffer by the first decoder; and decoding the video stream in the second encoded format using the second decoder and playing the video at the second resolution.
2. The method of claim 1, wherein the packaged video data are in a DASH (Dynamic Adaptive Streaming over HTTP) format.
3. The method of claim 1, wherein the first encoded format is one of an H.264 (MPEG-4 Advanced Video Coding) encoded format or an H.265 (High Efficiency Video Coding) encoded format, the second encoded format is another of the two encoded formats, and the second encoded format is different from the first encoded format; and wherein the first decoder is a decoder corresponding to the first encoded format, and the second decoder is a decoder corresponding to the second encoded format.
4. The method of claim 1, further comprising: ending the first decoder when the decoding the data associated with the video stream in the first decoded format and stored in the buffer is completed by the first decoder.
5. The method of claim 1, further comprising: initializing the second decoder based on information indicative of the second encoded format, wherein the information indicative of the second encoded format is carried in a first frame of the video stream in the second encoded format.
6. The method of claim 1, further comprising: automatically generating, by the player, the instruction of switching to the second resolution of the video based on detecting a bandwidth associated with receiving the video data in real time.
7. The method of claim 1, further comprising: generating, by the player, the instruction of switching to the second resolution of the video based on user input received by the player.
8. (canceled)
9. (canceled)
10. A non-transitory computer-readable storage medium, storing computer programs, when the computer programs are executed by a processor, the computer programs cause the processor to perform operations comprising: in response to receiving packaged video data associated with a video, performing an unpacking operation on the packaged data to obtain a video stream of the video in a first encoded format by the player; decoding the video stream in the first encoded format using a first decoder, and playing the video at a first resolution by the player; receiving an instruction of switching to a second resolution of the video; performing the unpacking operation on the packaged video data to obtain a video stream of the video in a second encoded format by the player; receiving at least one portion of the video stream in the second encoded format by the first decoder; initializing a second decoder based on the at least one portion of the video stream in the second encoded format received by the first decoder while decoding data associated with the video stream in the first encoded format stored in a buffer by the first decoder; and decoding the video stream in the second encoded format using the second decoder and playing the video at the second resolution.
11. A device of a seamless and dynamic switch between resolutions based on hardware decoding, which comprises a processor and a memory, wherein the memory stores computer programs, when the computer programs are executed by the processor the computer programs cause the processor to perform operations comprising: in response to receiving packaged video data associated with a video, performing an unpacking operation on the packaged data to obtain a video stream of the video in a first encoded format by the player; decoding the video stream in the first encoded format using a first decoder, and playing the video at a first resolution by the player; receiving an instruction of switching to a second resolution of the video; performing the unpacking operation on the packaged video data to obtain a video stream of the video in a second encoded format by the player; receiving at least one portion of the video stream in the second encoded format by the first decoder; initializing a second decoder based on the at least one portion of the video stream in the second encoded format received by the first decoder while decoding data associated with the video stream in the first encoded format stored in a buffer by the first decoder; and decoding the video stream in the second encoded format using the second decoder and playing the video at the second resolution.
12. The non-transitory computer-readable storage medium of claim 10, wherein the packaged video data are in a DASH (Dynamic Adaptive Streaming over HTTP) format.
13. The non-transitory computer-readable storage medium of claim 10, wherein the first encoded format is one of an H.264 (MPEG-4 Advanced Video Coding) encoded format or an H.265 (High Efficiency Video Coding) encoded format, the second encoded format is another one of the two encoded formats, and the second encoded format is different from the first encoded format; and wherein the first decoder is a decoder corresponding to the first encoded format, and the second decoder is a decoder corresponding to the second encoded format.
14. The non-transitory computer-readable storage medium of claim 10, the operations further comprising: ending the first decoder when the decoding the data associated with the video stream in the first decoded format and stored in the buffer is completed by the first decoder.
15. The non-transitory computer-readable storage medium of claim 10, the operations further comprising: initializing the second decoder based on information indicative of the second encoded format, wherein the information indicative of the second encoded format is carried in a first frame of the video stream in the second encoded format.
16. The non-transitory computer-readable storage medium of claim 10, the operations further comprising: automatically generating, by the player, the instruction of switching to the second resolution of the video based on detecting a bandwidth associated with receiving the video data in real time.
17. The device of claim 11, wherein the packaged video data are in a DASH (Dynamic Adaptive Streaming over HTTP) format.
18. The device of claim 11, wherein the first encoded format is one of an H.264 (MPEG-4 Advanced Video Coding) encoded format or an H.265 (High Efficiency Video Coding) encoded format, the second encoded format is another one of the two encoded formats, and the second encoded format is different from the first encoded format; and wherein the first decoder is a decoder corresponding to the first encoded format, and the second decoder is a decoder corresponding to the second encoded format.
19. The device of claim 11, the operations further comprising: ending the first decoder when the decoding the data associated with the video stream in the first decoded format and stored in the buffer is completed by the first decoder.
20. The device of claim 11, the operations further comprising: initializing the second decoder based on information indicative of the second encoded format, wherein the information indicative of the second encoded format is carried in a first frame of the video stream in the second encoded format.
21. The device of claim 11, the operations further comprising: automatically generating, by the player, the instruction of switching to the second resolution of the video based on detecting a bandwidth associated with receiving the video data in real time.
22. The device of claim 11, the operations further comprising: generating the instruction of switching to the second resolution of the video based on user input received by the player.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0033]
[0034]
DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS
[0035] In order to be able to understand the technical content of the present invention more clearly, the following embodiments are particularly described.
[0036] Please refer to
[0037] In one embodiment, the flowchart of steps of a seamless switching method of hardware decoding dynamic resolution includes the following steps: [0038] (1) after receiving packaged video data, a player performing an unpacking operation on the packaged video data to obtain a video stream with a first encoded format, video frames obtained after the unpacking operation carries encoding information (H.264 or H.265) for decoder identification;
[0039] (2) the player decoding the video stream with the first encoded format using a first decoder, and playing a video at a first resolution;
[0040] (3) the player receiving an instruction of switching to another resolution of the video; (4) the player performing the unpacking operation on the packaged video data to obtain a video stream in a second encoded format; wherein a first frame of the video stream in the second encoded format carries extra-data (codec encoding information), the codec encoding information indicative of the second encoded format is used for initializing a second decoder;
[0041] (5) the player decoding the video stream in the second encoded format using the second decoder and playing video at a second resolution.
[0042] Wherein, the packaged video is a DASH format video. The first encoded format is H.264 encoded format, and the second encoded format is H.265 encoded format, and vice versa. The first decoder is a decoder corresponding to the first encoded format, and the second decoder is a decoder corresponding to the second encoded format.
[0043] In a preferred embodiment, the step (5) specifically comprises the following steps: [0044] (51) the first decoder receiving the video stream in the second encoded format; [0045] (52) after the video stream in the first decoding format is decoded by the first decoder completely, stopping the first decoder; [0046] (53) initializing the second decoder; [0047] (54) the second decoder decoding the video stream with the second encoded format and outputting the video at the second resolution.
[0048] In a further preferred embodiment, in the step (4), the obtain the video stream with the second encoded format specifically comprises: [0049] obtaining the video stream with the second encoded format, wherein encoding information of the second encoded format is carried in a first frame of the video stream with the second encoded format; [0050] the step (53) specifically comprises: [0051] initializing the second decoder according to the encoding information of the second encoded format.
[0052] In another preferred embodiment, the step (3) specifically comprises: the player detecting a bandwidth of a network for receiving the packaged video in real time, and generating the switching separation rate instruction according to a detection result automatically. Or the step (3) specifically comprises: generating a corresponding switching separation rate instruction by a user operation received by the player.
[0053] In a further preferred embodiment, the player can be an iOS video player, correspondingly, the decoder is a VideoToolbox hardware decoder. The player can also be an Android video player, correspondingly, the decoder is a MediaCodec hardware decoder.
[0054] The present invention also provides a seamless switching device and computer-readable storage medium of hardware decoding dynamic 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 hardware decoding dynamic resolution is realized.
[0055] In a practical application, the flow of the seamless switching method of hardware decoding dynamic resolution of the present invention is shown in
Embodiment 1
[0056] 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 480 P. The DASH video begins to unpack to get a corresponding video stream of H.264 encoded format. The H.264 hard decoder is initialized, and the video stream of H.264 encoded format is decoded into frames, then, the video can be played at a resolution of 480 P. When the user switches the picture quality from 480P to 720 P manually, the video encoded output after the DASH video is unpacked becomes H.265 format. A changed first frame needs to carry extra data initialized by codec to initialize the data of the decoder. After the decoder detects the encoded format is changed, the H.264 hard decoder continues to decode and complete all the data in a buffer while the H.264 hard decoder initiates the H2.65 decoder at the same time. Then the H.265 hard decoder starts to decode the H.265 format encoded video stream and outputs the frame to complete the resolution switching.
[0057] In the DASH video, the resolution of 1080 P and 720 P of the DASH video are encoded in H.265, and the resolution of 480 p and 360 p of the DASH video are encoded in H.264. Therefore, resolution switching from 360 p to 1080 p is the same as the above process. When the resolution is switched from 720 p to 480 p, the conversion from H.265 decoder to H.264 decoder is similar to the above process
[0058] The mobile terminal can be an iOS device, then the player is an iOS video player, correspondingly, the decoder is a VideoToolbox hardware decoder. The mobile terminal can be an Android device, then the player is an Android video player, correspondingly, the decoder is a MediaCodec hardware decoder.
Embodiment 2
[0059] 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 of the switching process which described in the embodiment 1. The automatic switching mode can adapt to the bandwidth to the greatest extent, avoid the jam, and ensure the users' viewing experience.
[0060] The seamless switching method, device and computer-readable storage medium of hardware decoding dynamic resolution are adopted. In this method, during DASH video playback, when it is necessary to switch a resolution, an original decoder continues to decode a video stream of an original encoded format in a cache in an original format, after the video stream of the original encoded format is decoded, a second decoder corresponding to a target encoded format is initialized according to a video stream of the target encoded format received by the original decoder, and the video stream of the target encoded format is decoded by the second decoder, so as to realize the seamless switching between resolutions, avoid the jam in the process of playing, and improve the user experience. And the seamless switching method, device and computer-readable storage medium of hardware decoding dynamic resolution of the present invention have the advantages of simple implementation, low application cost and wide application range.
[0061] 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.