CN109862409B - Video decoding method, video playing method, device, system, terminal and storage medium - Google Patents

Video decoding method, video playing method, device, system, terminal and storage medium Download PDF

Info

Publication number
CN109862409B
CN109862409B CN201910204733.XA CN201910204733A CN109862409B CN 109862409 B CN109862409 B CN 109862409B CN 201910204733 A CN201910204733 A CN 201910204733A CN 109862409 B CN109862409 B CN 109862409B
Authority
CN
China
Prior art keywords
video
decoder
hard decoder
hard
decoding
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
CN201910204733.XA
Other languages
Chinese (zh)
Other versions
CN109862409A (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.)
Guangzhou Wangxing Information Technology Co Ltd
Original Assignee
Guangzhou Wangxing Information Technology 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 Guangzhou Wangxing Information Technology Co Ltd filed Critical Guangzhou Wangxing Information Technology Co Ltd
Priority to CN201910204733.XA priority Critical patent/CN109862409B/en
Publication of CN109862409A publication Critical patent/CN109862409A/en
Application granted granted Critical
Publication of CN109862409B publication Critical patent/CN109862409B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention discloses a video decoding and playing method, device, system, terminal and storage medium. The video decoding method includes: calling a soft decoder to decode the video and acquiring a hard decoder; if the hard decoder is acquired, initializing the hard decoder; and if the initialization of the hard decoder is finished, calling the hard decoder to continue decoding the video. By the technical scheme, the video is firstly soft-decoded, the situation that the video cannot be decoded and watched due to the fact that the hard decoder is waited for initialization is avoided, the hard decoder is initialized after the hard decoder is obtained, the hard decoder is called to continue decoding the video after the hard decoder is initialized, the overall decoding efficiency of the video is improved, the video decoding delay can be reduced even under the condition that the video is frequently switched, and the watching experience of a user is improved.

Description

Video decoding method, video playing method, device, system, terminal and storage medium
Technical Field
The embodiment of the invention relates to the technical field of video processing, in particular to a video decoding and playing method, device, system, terminal and storage medium.
Background
In the current mobile internet era, the application of network video live broadcast is more and more extensive, and people can see the live video of the live broadcast at the far end through the network, such as events, meetings, teaching, operations and the like. The network video live broadcasting mode is that video signals are compressed (coded) to form code streams, the code streams are transmitted to a client through a network, and when a user watches the live broadcasting from the client, the received code streams are decoded and then images or videos are output.
At the client, in order to increase the decoding speed and reduce the consumption of a Central Processing Unit (CPU) of the client, a hardware decoder is used for decoding, wherein the hardware decoder is generally referred to as a Graphics Processing Unit (GPU). Under the conditions of just entering a live broadcast or switching live broadcast video and the like, the process of acquiring the hard decoder and re-initializing the hard decoder is slow, so that the decoding of the first frame of video is easy to consume too long time and delay is too high, and particularly when a user frequently switches the live broadcast video, the decoding of the hardware decoder can cause the delay or pause of a picture, thereby seriously influencing the watching.
Disclosure of Invention
The invention provides a video decoding and playing method, device, system, terminal and storage medium. The decoding efficiency of the video is improved.
In a first aspect, an embodiment of the present invention provides a video decoding method, including:
calling a soft decoder to decode the video and acquiring a hard decoder;
if the hard decoder is acquired, initializing the hard decoder;
and if the initialization of the hard decoder is finished, calling the hard decoder to continue decoding the video.
In a second aspect, an embodiment of the present invention provides a video playing method, including:
receiving a video;
decoding video by the video decoding method according to the first aspect;
and playing the decoded video.
In a third aspect, an embodiment of the present invention provides a video decoding control apparatus, including:
the calling module is used for calling the soft decoder to decode the video;
an obtaining module for obtaining a hard decoder;
the initialization module is used for initializing the hard decoder if the hard decoder is obtained;
the calling module is further configured to call the hard decoder to continue decoding the video after the initialization of the hard decoder is completed.
In a fourth aspect, an embodiment of the present invention provides a video decoding apparatus, including:
a control module, a hard decoder and a soft decoder, wherein the control module is respectively connected with the hard decoder and the soft decoder, and the control module is provided with the video decoding control device according to the third aspect.
In a fifth aspect, an embodiment of the present invention provides a video playing system, including:
the video decoding device is configured to decode the video received by the video receiving module and send the decoded video to the video playing module for playing.
In a sixth aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the video decoding method according to the first aspect or the video playing method according to the second aspect.
In a seventh aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the video decoding method according to the first aspect or the video playing method according to the second aspect.
The embodiment of the invention provides a video decoding and playing method, a device, a system, a terminal and a storage medium. By the technical scheme, the video is firstly soft-decoded, the situation that the video cannot be decoded and watched due to the fact that the hard decoder is waited for initialization is avoided, the hard decoder is initialized after the hard decoder is obtained, and the hard decoder is called to continue decoding after the hard decoder is initialized, so that the overall decoding efficiency of the video is improved, the video decoding delay can be reduced even under the condition that the video is frequently switched, and the watching experience of a user is improved.
Drawings
Fig. 1 is a flowchart of a video decoding method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating an application of a video decoding method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a main thread in an application of a video decoding method according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a sub-thread applied in a video decoding method according to an embodiment of the present invention;
fig. 5 is a flowchart of a video playing method according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of a video decoding control apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of a video decoding apparatus according to a fourth embodiment of the present invention;
fig. 8 is a schematic structural diagram of a video playing system according to a fifth embodiment of the present invention;
fig. 9 is a schematic diagram of a hardware structure of a terminal according to a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. In addition, the embodiments and features of the embodiments in the present invention may be combined with each other without conflict. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a video decoding method according to an embodiment of the present invention. The present embodiment is applicable to the case of decoding various types of live videos. In particular, the video decoding method may be performed by a video decoding apparatus, which may be implemented in software and/or hardware and integrated in a terminal. Further, the terminal includes, but is not limited to: the intelligent terminal comprises intelligent terminals such as a smart phone, a desktop computer, a notebook computer and a tablet computer.
Specifically, referring to fig. 1, the method specifically includes the following steps:
and S110, calling a soft decoder to decode the video.
When a user watches the live video through the terminal, the video can be selected to be subjected to hard decoding or soft decoding according to the CPU or GPU performance of the terminal. The hard decoding refers to decoding high-definition video by a graphics card core GPU, and is characterized by high decoding speed and low CPU occupancy rate, but the initialization time consumption of a hard decoder is high, for example, when the video just enters a live broadcasting room, the code stream information of the video changes, the hard decoder needs to be waited for reacquiring or initializing the hard decoder, the video cannot be decoded in the process, the decoding time of the first frame of video is too long, and the delay is high. The soft decoding is performed by a CPU, and a plurality of soft decoders can exist in the terminal at the same time. In the embodiment, when the video is decoded, the soft decoder is called by default to decode the video, so that the problem that the video cannot be decoded and watched due to waiting for the initialization of the hard decoder is avoided, and the decoding efficiency is improved.
And S120, acquiring a hard decoder.
Specifically, an attempt is made to acquire a hard decoder while invoking a soft decoder to decode the video. Only one hard decoder is usually arranged in the terminal, and if the hard decoder is held by other threads or background application programs, the current video decoding thread cannot acquire the hard decoder and continues to keep soft decoding; if the holding state of the hard decoder is idle, the hard decoder may be acquired and held.
S130, whether a hard decoder is acquired or not is judged, and if yes, the step S140 is executed; if not, step S120 is executed to continue to acquire the hard decoder.
And S140, initializing the hard decoder.
Specifically, when the soft decoder is called to decode the video, after the hard decoder is acquired, the related interface is called, the code stream information of the video is transmitted to the hard decoder, and the running environment of the hard decoder is detected, so as to initialize the hard decoder.
S150, whether the initialization of the hard decoder is finished or not is judged, and if yes, the step S160 is executed; if not, step S140 is executed until the initialization of the hard decoder is completed.
And S160, calling the hard decoder to continuously decode the video.
Specifically, when the terminal cannot use the hard decoder to decode the video, the soft decoder is called to decode the video, and when the initialization of the hard decoder is detected to be completed, the soft decoder is switched to the hard decoder to continue decoding the video, so that a higher decoding speed is provided for subsequent decoding, the decoding efficiency of the whole video is improved, and the occupation of a CPU is reduced.
Further, the invoking of the soft decoder to decode the video comprises: when the video enters a live broadcast room for the first time, a soft decoder is called to decode the video; or, switching the live broadcast room, and calling a soft decoder to decode the video; alternatively, the video parameters are switched in the live broadcast, and then a soft decoder is called to decode the video.
Fig. 2 is a flowchart illustrating an application of a video decoding method according to an embodiment of the present invention. Referring to fig. 2, taking the IOS system as an example, when a user first enters a live broadcast room (for example, the user selects the live broadcast room 2 in the live broadcast platform and clicks a button for entering the live broadcast room), switches the live broadcast room (the user switches from the live broadcast room where the user is currently located to another live broadcast room), or changes a video parameter in the live broadcast room (for example, the user changes a video parameter such as definition, a picture size, or a switching window or a view angle), the above situation may cause the video decoding parameter to change, in this case, a soft decoder is invoked to decode a video, and an attempt to acquire and initialize a hard decoder is made. The video decoding parameters refer to Sequence Parameter Set (SPS)/Picture Parameter Set (PPS) in the h.264 video compressed code stream, and the SPS/PPS are two types of data compression headers for specifying high and wide parameter information of video coding. Whether the SPS/PPS is changed or not is detected, whether a hard decoder is obtained or not is determined, after the hard decoder is obtained, the hard decoder is initialized, and after initialization of the hard decoder is completed, the hard decoder is called to replace a soft decoder to continue decoding videos.
Further, the initializing the hard decoder includes:
the main thread sends an instruction for initializing a hard decoder;
and the sub thread initializes the hard decoder according to the instruction for initializing the hard decoder.
Specifically, the main thread is configured to execute code stream information of a received video, determine a decoding mode, perform soft decoding on a first frame of video, acquire a hard decoder, and communicate with the hard decoder in the sub thread (for example, send an instruction to initialize the hard decoder, update a reset flag of the hard decoder, detect whether the hard decoder is acquired, whether initialization is completed, or the like); the sub-thread is used for creating a hard decoder according to the instruction of the main thread, calling an internal interface of the terminal according to the reset flag bit parameter of the hard decoder, and transmitting video decoding parameters to the hard decoder so as to complete initialization of the hard decoder.
Further, before initializing the hard decoder, the method further includes: and setting the reset flag bit parameter of the hard decoder as a flag to be initialized.
Specifically, taking the IOS system as an example, after the hard decoder is acquired, the main thread sends an instruction for initializing the hard decoder to the sub-thread, and sets a parameter of a reset flag bit of the hard decoder as a flag to be initialized. In this embodiment, optionally, the flag to be initialized is true, and after the child thread recognizes that the reset flag bit is the flag to be initialized, the child thread may call the relevant interface to transfer the changed SPS/PPS into the hard decoder, so as to complete initialization of the hard decoder.
Further, the obtaining a hard decoder includes: the holding state of the hard decoder is idle, the hard decoder is held. If the holding state of the hard decoder is idle, namely the hard decoder is not held by other threads or background application programs, the main thread can acquire the hard decoder, otherwise, the hard decoder cannot be acquired, and the soft decoder is continuously called to decode the video.
Fig. 3 is a flowchart illustrating a main thread in an application of a video decoding method according to an embodiment of the present invention. On the basis of the above embodiments, the following describes in detail the flows of the main thread and the sub thread in the specific application process of the video decoding method.
It should be noted that, when a user enters a live broadcast room through a terminal to watch live broadcast, a server sends, to the terminal, code stream information corresponding to a live broadcast video, where the code stream information includes a video decoding parameter, for example, the video decoding parameter is SPS/PPS in an h.264 video compression code stream. The code stream information further includes a Group of Pictures (GOP), the GOP is composed of I/P/B frames, the start point of one GOP is an I frame, and the end point is a P frame or a B frame before the next I frame, where the I/P/B frames are 3 common frame types of video, the I frame is also called an intra (intra) frame, and represents a key frame, the I frame includes complete data of a picture corresponding to the frame, and the data in the I frame may be decoded during decoding. The P frame is a difference frame, which indicates the difference between the P frame and a previous key frame (or P frame), and does not contain complete data, and when decoding the P frame, the difference data contained in the P frame needs to be superimposed on the data of the previous frame to generate a corresponding picture. The B frame is a bidirectional difference frame, i.e. the B frame records the difference between the current frame and the previous and next frames. P-frames and B-frames are also called inter (inter) frames.
Further, the states of the hard decoder include: blank state, initial state, unacquired state, held state, and released state. Wherein:
a blank state, indicating that no hard decoder is present in the main thread of video decoding.
The initial state refers to that before the hard decoder is created, the main thread sends a use request of the hard decoder to the sub-thread, namely, an instruction for calling the hard decoder.
The not acquired state, refers to the hard decoder having been created but not acquired by any system thread.
The held state means that the master process acquires and holds the hard decoder after creating the hard decoder.
The release state means that hard decoding is not performed any more, and the hard decoder is released and is not held by the video decoding related thread any more. In the hard decoder release state, the hard decoder is destroyed, i.e. the blank state can be recovered, i.e. the hard decoder does not exist in the main thread of video decoding.
As shown in fig. 3, in this embodiment, an example of a GOP including an I frame, a P frame, and a B frame is described, and the implementation process of the main thread is as follows:
s1, receiving the first GOP in the code stream information, and when processing the I frame in the first GOP, setting the SPS/PPS update bit parameter as updated (for example, the flag of updated is true). It should be noted that the first GOP received in this embodiment refers to the first GOP in the code stream information when the live broadcast room is entered for the first time, and the live broadcast room is switched, and at this time, the SPS/PPS changes, and the SPS/PPS update bit parameter is set to have been updated. For the case that the SPS/PPS is not changed (e.g. the same type of video is always viewed in the same live broadcast room, the hard decoder does not need to reset or reconnect), the current decoding mode is maintained.
Furthermore, a soft decoder is called for the first GOP to perform soft decoding and output images, so that the situation that the first frame of video cannot be decoded and watched in the process of waiting for acquiring the hard decoder and initializing the hard decoder is avoided, the decoding efficiency is improved, and soft decoding is performed in a period of time thereafter (until the initialization of the hard decoder is completed).
And S2, receiving a second GOP in the code stream information, and when the I frame in the second GOP is processed, if the SPS/PPS update bit parameter is updated, but the main thread does not acquire the hard decoder (the hard decoder state is an unacquired state), trying to acquire the hard decoder, and sending a use request of the hard decoder or an instruction for calling the hard decoder to the sub-thread. It should be noted that if it is detected that the holding state of the hard decoder is not idle during the I frame in the second GOP, which means that the hard decoder is held by other threads or background applications, the video decoding thread cannot acquire the hard decoder, and can only continue to perform soft decoding on the video, and meanwhile, during the process of processing the subsequent GOP, the holding state of the hard decoder is continuously detected, and the hard decoder is acquired when the holding state of the hard decoder is idle.
S3, when processing the P frame or B frame in the second GOP, after acquiring the hard decoder, updating the state of the hard decoder to the held state, and triggering the initialization of the hard decoder, namely setting the reset flag bit parameter of the hard decoder as the flag to be initialized, and informing the child thread to initialize the hard decoder. Meanwhile, the SPS/PPS update bit parameter is set to be not updated (for example, the flag that is not updated is false), that is, the changed SPS/PPS is cached and has no update flag. In the process of acquiring the hard decoder and initializing the hard decoder, the main thread still performs soft decoding on the GOP and outputs an image.
S4, receiving a third GOP in the code stream information, and when processing an I frame in the third GOP, before decoding each I frame, detecting whether the hard decoder has completed initialization, that is, whether the initialization completion flag bit parameter of the hard decoder has been completed (for example, the completed flag is true), if so, destroying the current soft decoder, invoking the hard decoder, performing hard decoding on the subsequent GOP, and outputting an image; if not, the third GOP is still subjected to soft decoding to output images, and whether the initialization of the hard decoder is finished or not is detected before the I frame of each subsequent GOP is decoded.
It should be noted that if the live broadcast room is switched during the hard decoding of the subsequent GOP (SPS/PPS is changed), the hard decoder is released, the soft decoding is switched, the SPS/PPS update bit parameter is set to be updated, and then S2 to S4 are repeatedly performed. In addition, the foregoing embodiment is described by taking the first three GOPs as an example, but in practical applications, due to the influence of CPU, GPU performance, or other threads in the background, neither the time required for acquiring the hard decoder nor the time required for initializing the hard decoder can be determined, and therefore, various operations performed by the main thread may occur in other GOPs.
Fig. 4 is a schematic flowchart of a sub-thread applied in a video decoding method according to an embodiment of the present invention. As shown in fig. 4, the sub-thread detects whether the hard decoder is in the initial state or the held state in a loop, when the hard decoder is in the initial state, and the sub-thread receives a use request of the hard decoder or an instruction for calling the hard decoder sent by the main thread, the hard decoder is created and the state of the hard decoder is set to the non-acquired state, and the loop continues to detect the state of the hard decoder. It should be noted that, after the hard decoder in the non-acquisition state is held by the main thread, the state is updated to be held. When the hard decoder is in the held state, the sub-thread continuously detects whether the reset flag bit parameter of the hard decoder is a flag to be initialized, if so, the hard decoder is initialized, the internal interface related to the hard decoder is called, the SPS/PPS is transmitted, and after the initialization of the hard decoder is completed, the reset flag bit parameter of the hard decoder is set to be not required to be initialized (exemplarily, the flag which is not required to be initialized is false), and the initialization completion flag bit parameter of the hard decoder is set to be completed; if not, a loop detects whether the hard decoder is in an initial or held state.
In the specific application of the video decoding method provided in the first embodiment, the main thread receives the code stream information of the video, calls the decoder, and communicates with the hard decoder in the sub-thread while performing soft decoding on the video; the hard decoder is established through the sub-thread, an internal interface of the terminal is called according to the reset flag bit parameter of the hard decoder, and the video decoding parameter is transmitted into the hard decoder to complete initialization of the hard decoder, so that soft decoding of the video is realized first, the problem that the video cannot be decoded and watched due to waiting for initialization of the hard decoder is avoided, the hard decoder is initialized after the hard decoder is obtained, the hard decoder is called to continue decoding after the hard decoder is initialized, the overall decoding efficiency of the video is improved, the delay of video decoding can be reduced even under the condition of frequently switching the video, and the watching experience of a user is improved.
Example two
Fig. 5 is a flowchart illustrating an implementation of a video playing method according to a second embodiment of the present invention. The embodiment can be applied to the situation of decoding and playing various live videos. Specifically, the video playing method can be implemented in a software and/or hardware manner and integrated in a video playing system. Further, the video playing system comprises: the video decoding device is used for decoding the video received by the video receiving module and then sending the decoded video to the video playing module for playing. It should be noted that technical details that are not described in detail in the present embodiment may be referred to any of the above embodiments.
Specifically, as shown in fig. 5, the video playing method includes:
and S210, receiving the video.
Specifically, when a user enters a live broadcast room through a terminal to watch live broadcast, a server sends a video stream corresponding to live broadcast video to the terminal, video signals are encoded by an encoder and then transmitted to the terminal through a network by the server, the terminal needs to decode the video to output an image, wherein the video stream is an H.264 video compression code stream, and code stream information comprises SPS/PPS and GOP.
And S220, calling a soft decoder to decode the video.
And S230, acquiring a hard decoder.
S240, whether a hard decoder is acquired or not is judged, and if yes, the step S250 is executed; if not, step S230 is executed to continue to obtain the hard decoder.
And S250, initializing the hard decoder.
And S260, judging whether the initialization of the hard decoder is finished, if so, executing the step S270, otherwise, returning to execute the step S250 until the initialization of the hard decoder is finished.
And S270, calling the hard decoder to continuously decode the video.
And S280, playing the decoded video.
Specifically, the original data of the video signal is compressed in the encoding process, and the terminal calls a soft decoder to decode the video before the initialization of a hard decoder is completed; and after the initialization of the hard decoder is finished, calling the hard decoder to continuously decode the video to obtain the original data before compression, and outputting the image of one frame by one frame so as to play the decoded video.
In the video playing method provided by the second embodiment of the present invention, the hard decoder is initialized after the received video is soft-decoded and the hard decoder is acquired, and the hard decoder is called to decode the video after the initialization of the hard decoder is completed, so as to play the decoded video, thereby avoiding that the video cannot be decoded and played due to waiting for the initialization of the hard decoder, improving the fluency of video playing, reducing the delay of the first frame of video even under the condition of frequently switching the video, reducing the pause, and improving the video playing effect.
EXAMPLE III
Fig. 6 is a schematic structural diagram of a video decoding control apparatus according to a third embodiment of the present invention. The video decoding control device can be arranged in a control module of the video decoding device and used for calling the soft decoder or the hard decoder according to the initialization state of the hard decoder to control the video decoding mode.
As shown in fig. 6, the video decoding control apparatus provided in the present embodiment includes:
a calling module 310, configured to call a soft decoder to decode a video;
an obtaining module 320 for obtaining a hard decoder;
an initialization module 330, configured to initialize a hard decoder if the hard decoder is obtained;
the invoking module 310 is further configured to invoke the hard decoder to continue decoding the video after the hard decoder is initialized.
In the video decoding control device provided by the third embodiment of the present invention, the soft decoder is called to decode the video through the calling module; the hard decoder is obtained through the obtaining module, the hard decoder is initialized after the hard decoder is obtained through the initializing module, the hard decoder is called to continue decoding videos when the initialization of the hard decoder is completed through the calling module, the soft decoding of the videos is controlled while the initialization of the hard decoder is achieved, the situation that the videos cannot be decoded and watched due to the fact that the hard decoder is waited for initialization is avoided, the hard decoder is controlled to be called to perform the hard decoding after the initialization of the hard decoder is completed, the soft decoding and hard decoding switching is controlled, the overall decoding efficiency of the videos is improved, and the watching experience of users is improved.
On the basis of the foregoing embodiment, the invoking module 310 is specifically configured to:
when the video enters a live broadcast room for the first time, a soft decoder is called to decode the video; alternatively, the first and second electrodes may be,
switching the live broadcast room, and calling a soft decoder to decode the video; alternatively, the first and second electrodes may be,
and switching video parameters in the live broadcast room, and calling a soft decoder to decode the video.
Further, the apparatus further comprises:
and the setting module is used for setting the reset flag bit parameter of the hard decoder as a flag to be initialized.
Further, the obtaining module 320 is specifically configured to:
the holding state of the hard decoder is idle, the hard decoder is held.
The video decoding control device provided by the third embodiment of the invention and the video decoding method provided by the third embodiment of the invention belong to the same inventive concept, can be used for realizing the control of video decoding, and have corresponding functions and beneficial effects.
Example four
Fig. 7 is a schematic structural diagram of a video decoding apparatus according to a fourth embodiment of the present invention. As shown in fig. 7, the video decoding apparatus provided in the present embodiment includes: a control module 410, a hard decoder 420 and a soft decoder 430, wherein the control module 410 is connected to the hard decoder 420 and the soft decoder 430, respectively, and the control module 410 is provided with the video decoding control device according to the third embodiment.
Specifically, the control module 410 is configured to invoke the soft decoder 430 to decode the video and acquire the hard decoder 420, and is further configured to initialize the hard decoder 420 if the hard decoder 420 is acquired, and invoke the hard decoder 430 to decode the video after the hard decoder 420 is initialized, so as to control the decoding of the video.
In the video decoding device provided by the fourth embodiment of the present invention, the control module controls the video decoding mode, and the hard decoder is obtained and initialized while the video is soft decoded, so that it is avoided that the video cannot be decoded and viewed due to waiting for initialization of the hard decoder, and the hard decoder is called after the initialization of the hard decoder is completed, so that the overall decoding efficiency of the video is improved, and even under the condition of frequently switching the video, the delay of video decoding can be reduced, and the viewing experience of the user is improved.
The video decoding apparatus provided in the fourth embodiment of the present invention can be used to execute the video decoding method provided in any of the above embodiments, and has corresponding functions and advantageous effects.
EXAMPLE five
Fig. 8 is a schematic structural diagram of a video playing system according to a fifth embodiment of the present invention. As shown in fig. 8, the video playback system 500 includes:
the video decoding apparatus 520 is configured to decode the video received by the video receiving module 510 and send the decoded video to the video playing module 530 for playing.
Specifically, the video receiving module 510 may be a live broadcast platform, a client, a browser, and the like in the terminal, and is configured to receive a video, and the video decoding device 520 is configured to decode the video received by the video receiving module 510 and send the decoded video to the video playing module 530 for playing, where the structure and function of the video decoding device 520 may refer to the video decoding device in the fourth embodiment. The video playing module 530 is used for playing the decoded video.
The video playing system provided by the fifth embodiment of the present invention can be used for executing the video playing method provided by any of the above embodiments, and has corresponding functions and beneficial effects.
EXAMPLE six
Fig. 9 is a schematic diagram of a hardware structure of a terminal according to a sixth embodiment of the present invention. As shown in fig. 9, the terminal provided in this embodiment includes: a processor 610 and a storage device 620. The number of the processors in the terminal may be one or more, one processor 610 is taken as an example in fig. 9, the processor 610 and the storage device 620 in the terminal may be connected through a bus or in other manners, and the connection through the bus is taken as an example in fig. 9.
The one or more programs are executed by the one or more processors 610, so that the one or more processors implement the video decoding method or the video playing method described in any of the above embodiments.
The storage device 620 in the terminal, which is a computer-readable storage medium, can be used to store one or more programs, such as software programs, computer-executable programs, and modules, corresponding to the program instructions/modules of the video decoding method in the embodiment of the present invention (for example, the modules in the video decoding control device shown in fig. 6, including the calling module 210, the obtaining module 220, and the initializing module 230). The processor 610 executes various functional applications and data processing of the terminal, that is, implements the video decoding method or the video playing method in the above-described method embodiments, by running software programs, instructions, and modules stored in the storage device 620.
The storage device 620 mainly includes a storage program area and a storage data area, wherein the storage program area can store an operating system and an application program required by at least one function; the storage data area may store data created according to the use of the terminal, etc. (reset flag bit parameters, video, etc. as in the above-described embodiments). Further, the storage 620 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the storage 620 may further include memory located remotely from the processor 610, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
And, when one or more programs included in the above terminal are executed by the one or more processors 610, the one or more processors implement: calling a soft decoder to decode the video and acquiring a hard decoder; if the hard decoder is acquired, initializing the hard decoder; and if the initialization of the hard decoder is finished, calling the hard decoder to continue decoding the video.
Alternatively, when one or more programs included in the terminal are executed by the one or more processors 610, the one or more processors may implement: receiving a video; calling a soft decoder to decode the video and acquiring a hard decoder; if the hard decoder is acquired, initializing the hard decoder; if the initialization of the hard decoder is finished, calling the hard decoder to continuously decode the video; and playing the decoded video.
The terminal proposed by the present embodiment is the same as the video decoding method or the video playing method proposed by the above embodiments, and the technical details that are not described in detail in the present embodiment can be referred to any of the above embodiments, and the present embodiment has the same beneficial effects as the video decoding method or the video playing method.
On the basis of the above-described embodiments, the present embodiment also provides a computer-readable storage medium on which a computer program is stored, the program implementing the video decoding method or the video playing method in any of the above-described embodiments of the present invention when executed by the video decoding control apparatus or the video decoding apparatus.
Of course, the embodiments of the present invention provide a computer-readable storage medium storing a computer program, where the computer program is executed by a processor to implement a video decoding method or a video playing method according to any of the embodiments of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk, or an optical disk of a computer, and includes several instructions to enable a terminal (which may be a desktop computer, a smart phone, or a network device) to execute the video decoding method or the video playing method according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A video decoding method, comprising:
calling a soft decoder to decode the video and acquiring a hard decoder;
if the hard decoder is acquired, initializing the hard decoder;
if the hard decoder is initialized, calling the hard decoder to continue decoding the video,
the invoking of the soft decoder to decode the video comprises:
when the video enters a live broadcast room for the first time, a soft decoder is called by default to decode the video; alternatively, the first and second electrodes may be,
switching the live broadcast room, and calling a soft decoder to decode the video by default; alternatively, the first and second electrodes may be,
and switching video parameters in the live broadcast room, and calling a soft decoder to decode the video by default.
2. The method of claim 1, wherein prior to initializing the hard decoder, further comprising:
and setting the reset flag bit parameter of the hard decoder as a flag to be initialized.
3. The method of claim 1, wherein obtaining the hard decoder comprises:
the holding state of the hard decoder is idle, the hard decoder is held.
4. The method of claim 1, wherein initializing the hard decoder comprises:
the main thread sends an instruction for initializing a hard decoder;
and the sub thread initializes the hard decoder according to the instruction for initializing the hard decoder.
5. A video playback method, comprising:
receiving a video;
decoding video by the video decoding method of any one of claims 1 to 4;
and playing the decoded video.
6. A video decoding control apparatus, comprising:
the calling module is used for calling the soft decoder to decode the video;
an obtaining module for obtaining a hard decoder;
the initialization module is used for initializing the hard decoder if the hard decoder is obtained;
the calling module is further used for calling the hard decoder to continue decoding the video after the initialization of the hard decoder is finished;
the invoking of the soft decoder to decode the video comprises:
when the video enters a live broadcast room for the first time, a soft decoder is called by default to decode the video; alternatively, the first and second electrodes may be,
switching the live broadcast room, and calling a soft decoder to decode the video by default; alternatively, the first and second electrodes may be,
and switching video parameters in the live broadcast room, and calling a soft decoder to decode the video by default.
7. A video decoding apparatus, comprising: a control module, a hard decoder and a soft decoder, the control module being connected to the hard decoder and the soft decoder, respectively, the control module being provided with the video decoding control apparatus as claimed in claim 6.
8. A video playback system, comprising:
the video decoding device of claim 7, the video receiving module, and the video playing module, wherein the video decoding device is configured to decode the video received by the video receiving module and send the decoded video to the video playing module for playing.
9. A terminal, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
CN201910204733.XA 2019-03-18 2019-03-18 Video decoding method, video playing method, device, system, terminal and storage medium Active CN109862409B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910204733.XA CN109862409B (en) 2019-03-18 2019-03-18 Video decoding method, video playing method, device, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910204733.XA CN109862409B (en) 2019-03-18 2019-03-18 Video decoding method, video playing method, device, system, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109862409A CN109862409A (en) 2019-06-07
CN109862409B true CN109862409B (en) 2021-03-26

Family

ID=66900969

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910204733.XA Active CN109862409B (en) 2019-03-18 2019-03-18 Video decoding method, video playing method, device, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109862409B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111953991B (en) * 2020-08-07 2022-05-20 山东金东数字创意股份有限公司 System and method for accelerating decoding of video CPU + GPU hardware based on windows platform
CN112738525B (en) * 2020-12-11 2023-06-27 深圳万兴软件有限公司 Video processing method, apparatus and computer readable storage medium
CN114845162B (en) * 2021-02-01 2024-04-02 北京字节跳动网络技术有限公司 Video playing method and device, electronic equipment and storage medium
CN113411589A (en) * 2021-06-21 2021-09-17 苏州科达科技股份有限公司 Decoding method, decoding device, electronic equipment and storage medium
CN113676769B (en) * 2021-08-23 2023-03-31 北京字跳网络技术有限公司 Video decoding method, device and storage medium
CN114422799B (en) * 2022-01-24 2024-04-19 北京百度网讯科技有限公司 Decoding method and device for video file, electronic equipment and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002171523A (en) * 2000-09-22 2002-06-14 Matsushita Electric Ind Co Ltd Image decoder, image decoding method, and program storage medium
CN104185062A (en) * 2013-05-27 2014-12-03 中兴通讯股份有限公司 Method for processing video streams by terminal and terminal
CN108282164A (en) * 2017-01-05 2018-07-13 腾讯科技(深圳)有限公司 A kind of data encoding and coding/decoding method and device
CN108959977A (en) * 2018-06-22 2018-12-07 中国电子科技集团公司第五十八研究所 A kind of soft or hard hybrid decoding method suitable for SRAM PUF
CN109120988A (en) * 2018-08-23 2019-01-01 Oppo广东移动通信有限公司 Coding/decoding method, device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002171523A (en) * 2000-09-22 2002-06-14 Matsushita Electric Ind Co Ltd Image decoder, image decoding method, and program storage medium
CN104185062A (en) * 2013-05-27 2014-12-03 中兴通讯股份有限公司 Method for processing video streams by terminal and terminal
CN108282164A (en) * 2017-01-05 2018-07-13 腾讯科技(深圳)有限公司 A kind of data encoding and coding/decoding method and device
CN108959977A (en) * 2018-06-22 2018-12-07 中国电子科技集团公司第五十八研究所 A kind of soft or hard hybrid decoding method suitable for SRAM PUF
CN109120988A (en) * 2018-08-23 2019-01-01 Oppo广东移动通信有限公司 Coding/decoding method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109862409A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN109862409B (en) Video decoding method, video playing method, device, system, terminal and storage medium
WO2016131223A1 (en) Frame loss method for video frame and video sending apparatus
CN110430441B (en) Cloud mobile phone video acquisition method, system, device and storage medium
CN110784740A (en) Video processing method, device, server and readable storage medium
JP2003517797A5 (en)
EP3697088A1 (en) Video sending and receiving method, device, and terminal
CN110858827A (en) Broadcast starting acceleration method and device and computer readable storage medium
CN111669577A (en) Hardware decoding detection method and device, electronic equipment and storage medium
CN111641804A (en) Video data processing method and device, terminal, camera and video conference system
CN110401866B (en) Live video display method, device, terminal and storage medium
CN107295423B (en) Self-adaptive coding and transmission method for mobile terminal video live broadcast
US20240098310A1 (en) Encoding method, real-time communication method, apparatus, device, and storage medium
WO2021057697A1 (en) Video encoding and decoding methods and apparatuses, storage medium, and electronic device
CN110049347B (en) Method, system, terminal and device for configuring images on live interface
CN114143586B (en) Split screen display sharing method, system, storage medium and intelligent screen
CN113286146B (en) Media data processing method, device, equipment and storage medium
CN109587561B (en) Video processing method and device, electronic equipment and storage medium
CN111935500B (en) Video decoding method and device and electronic equipment
US20220148133A1 (en) Image display control device, transmitting device, image display control method, and program
CN116546262A (en) Data processing method, device, equipment and storage medium
CN113630575B (en) Method, system and storage medium for displaying images of multi-person online video conference
CN115643429A (en) Video playing method and device, electronic equipment and computer readable storage medium
CN112135163A (en) Video playing starting method and device
CN116886932B (en) Video stream transmission method, device, terminal equipment and storage medium
US12022088B2 (en) Method and apparatus for constructing motion information list in video encoding and decoding and device

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