CN113055673B - Video stream processing method and device, electronic equipment and storage medium - Google Patents
Video stream processing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113055673B CN113055673B CN202110442780.5A CN202110442780A CN113055673B CN 113055673 B CN113055673 B CN 113055673B CN 202110442780 A CN202110442780 A CN 202110442780A CN 113055673 B CN113055673 B CN 113055673B
- Authority
- CN
- China
- Prior art keywords
- gop
- code rate
- video stream
- sequence
- rate threshold
- 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
Links
- 238000003672 processing method Methods 0.000 title abstract description 13
- 238000000034 method Methods 0.000 claims abstract description 44
- 238000006243 chemical reaction Methods 0.000 claims abstract description 19
- 102100037812 Medium-wave-sensitive opsin 1 Human genes 0.000 claims description 89
- 238000004590 computer program Methods 0.000 claims description 4
- 238000012163 sequencing technique Methods 0.000 claims description 2
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001151 other effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/177—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a group of pictures [GOP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/40—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The application provides a video stream processing method, a video stream processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: in the process of processing an input video stream, the input video stream is firstly obtained, wherein the input video stream comprises a first group of pictures (GOP) sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence of the input video stream and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with the code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated. Therefore, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value is not subjected to code rate conversion. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
Description
Technical Field
The present disclosure relates to the field of video technologies, and in particular, to a method and apparatus for processing a video stream, an electronic device, and a storage medium.
Background
In some video transcoding scenarios, users often want to limit the bitrate threshold of the transcoded video stream to within a fixed value as much as possible to avoid the problem of jamming due to excessive network bandwidth requirements. In the related art, transcoding is generally performed on all image groups of an input video stream in combination with a preset bitrate threshold, however, all image groups of all video streams in the above manner need to be subjected to video transcoding, which causes a great amount of waste of computation resources.
Disclosure of Invention
The present disclosure relates to the field of video technologies, and in particular, to a method and apparatus for processing a video stream, an electronic device, and a storage medium.
An embodiment of an aspect of the present application provides a method for processing a video stream, where the method includes: acquiring an input video stream, wherein the input video stream comprises a first group of pictures GOP sequence, and the first GOP sequence comprises a plurality of GOPs which are arranged in sequence; acquiring a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence, and acquiring a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence; decoding the first GOP, and recoding the decoded first GOP to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold; and generating an output video stream of the input video stream according to the third GOP and the second GOP.
In one embodiment of the present application, the decoding the first GOP and recoding the decoded first GOP to obtain a third GOP with a code rate less than or equal to a preset code rate threshold value includes: acquiring a serialization parameter set SPS and an image parameter set PPS of the input video stream; decoding the first GOP; and recoding the decoded first GOP according to the serialization parameter set SPS and the picture parameter set PPS to obtain a third GOP of which the code rate is smaller than or equal to the preset code rate threshold.
In one embodiment of the present application, the generating, according to the third GOP and the second GOP, an output video stream corresponding to the input video stream includes: sequencing the third GOP and the second GOP according to the position of the first GOP corresponding to the third GOP in the first GOP sequence and the position of the second GOP in the first GOP sequence so as to generate a second GOP sequence; and generating an output video stream corresponding to the input video stream according to the second GOP sequence.
In one embodiment of the present application, the obtaining a first GOP in the first GOP sequence, where the code rate is greater than a preset code rate threshold, and obtaining a second GOP in the first GOP sequence, where the code rate is less than or equal to the preset code rate threshold, includes: determining the code rate of each GOP in the first GOP sequence; judging whether the code rate of the GOP is larger than a preset code rate threshold value or not; if the code rate of the GOP is larger than a preset code rate threshold value, the GOP is used as the first GOP; and if the code rate of the GOP is smaller than or equal to a preset code rate threshold value, taking the GOP as the second GOP.
In one embodiment of the present application, the obtaining manner of the preset code rate threshold is: and determining the preset code rate threshold according to the received request for the preset code rate threshold.
In one embodiment of the present application, the input video stream and the output video stream are encoded in the same video manner.
The application provides a processing method of a video stream, which is characterized in that in the process of processing an input video stream, the input video stream is obtained, wherein the input video stream comprises a first group of pictures (GOP) sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence of the input video stream and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with the code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated according to the third GOP and the second GOP. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion, so that the workload of coding can be reduced, and the computing resource is saved.
Another embodiment of the present application proposes a processing apparatus for a video stream, where the apparatus includes: a first acquisition module, configured to acquire an input video stream, where the input video stream includes a first GOP sequence of pictures, and the first GOP sequence includes a plurality of GOPs arranged in sequence; the second acquisition module is used for acquiring a first GOP with the code rate being greater than a preset code rate threshold value in the first GOP sequence and acquiring a second GOP with the code rate being less than or equal to the preset code rate threshold value in the first GOP sequence; the processing module is used for decoding the first GOP and recoding the decoded first GOP to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold value; and the generation module is used for generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP.
In one embodiment of the present application, a processed module includes: an acquisition unit, configured to acquire a serialized parameter set SPS and an image parameter set PPS of the input video stream; a decoding unit configured to decode the first GOP; and the encoding unit is used for recoding the decoded first GOP according to the serialization parameter set SPS and the picture parameter set PPS so as to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold.
In one embodiment of the present application, the generating module is specifically configured to include: a first generation unit, configured to sort the third GOP and the second GOP according to a position of the first GOP corresponding to the third GOP in the first GOP sequence and a position of the second GOP in the first GOP sequence, so as to generate a second GOP sequence; and the second generation unit is used for generating an output video stream corresponding to the input video stream according to the second GOP sequence.
In one embodiment of the present application, the second obtaining module includes: a first determining unit, configured to determine a code rate of each GOP in the first GOP sequence; the judging unit is used for judging whether the code rate of the GOP is larger than a preset code rate threshold value or not; a second determining unit, configured to take the GOP as the first GOP if the code rate of the GOP is greater than a preset code rate threshold; and the third determining unit is used for taking the GOP as the second GOP if the code rate of the GOP is smaller than or equal to a preset code rate threshold value.
The application provides a processing device for a video stream, which is used for acquiring the input video stream in the process of processing the input video stream, wherein the input video stream comprises a first group of pictures (GOP) sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence of the input video stream and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with a code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated according to the third GOP and the second GOP. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion, so that the workload of coding can be reduced, and the computing resource is saved.
Another embodiment of the present application proposes an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a method of processing a video stream when executing the program.
Another embodiment of the present application proposes a computer-readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements a method for processing a video stream.
Other effects of the above alternative will be described below in connection with specific embodiments.
Drawings
Fig. 1 is a flow chart of a video stream processing method according to an embodiment of the present application.
Fig. 2 is a flow chart of another method for processing a video stream according to an embodiment of the present application.
Fig. 3 is a flow chart of another method for processing a video stream according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a video stream processing apparatus according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of another video stream processing apparatus according to an embodiment of the present application.
Fig. 6 is a block diagram of an electronic device according to one embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present application and are not to be construed as limiting the present application.
The following describes a method, a device and an electronic device for processing a video stream according to an embodiment of the present application with reference to the accompanying drawings.
Fig. 1 is a flow chart of a video stream processing method according to an embodiment of the present application. It should be noted that, the execution body of the video stream processing method provided in this embodiment is a video stream processing apparatus, where the video stream processing apparatus may be implemented in a software and/or hardware manner, the video stream processing apparatus in this embodiment may be configured in an electronic device, and the electronic device in this embodiment may include a server, etc., and this embodiment is not specifically limited to an electronic device.
As shown in fig. 1, the method for processing a video stream may include:
in step 101, an input video stream is acquired, wherein the input video stream includes a first group of pictures GOP sequence including a plurality of GOPs arranged in sequence.
Note that GOP (Group of Pictures) refers to an image group.
In an exemplary embodiment, in a video conversion usage scenario, after receiving a transcoding request from a user, a video stream corresponding to the transcoding request may be acquired, and the acquired video stream may be used as an input video stream.
In some embodiments, the preset bitrate threshold may be a default value set in a processing device of the video stream, or may be preset according to a setting request of a user, so as to meet a requirement of the user for individually setting the preset bitrate threshold.
As an exemplary embodiment, the preset code rate threshold may be determined according to a received preset code rate threshold request. In some embodiments, the code rate fluctuation occurs according to different transmitted pictures, so that only the first GOP with the code rate larger than the preset code rate threshold value in the acquired first GOP sequence is required to be further encoded and decoded, the output video stream is output,
in other embodiments, the second GOP in the first GOP sequence having a code rate less than or equal to the preset code rate threshold is directly output by replacing the input video stream with the output video stream without performing a coding and decoding process.
And 103, decoding the first GOP, and recoding the decoded first GOP to obtain a third GOP with the code rate smaller than or equal to a preset code rate threshold.
In this embodiment, in order to avoid the problem of incompatibility of the player, a serialization parameter set (Sequence Parameter Set, SPS) and a picture parameter set (Picture Parameter Set, PPS) of the first GOP may be acquired, the first GOP may be decoded, and the decoded first GOP may be recoded according to the serialization parameter set and the picture parameter set, so as to obtain a third GOP with a code rate less than or equal to a preset code rate threshold.
Wherein the serialization parameter set and the image parameter set information are part of the input video stream information.
And 104, generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP.
In some embodiments, a third GOP is decoded from the new encoding by the first GOP, wherein the code rates of the third GOP and the second GOP are both less than a preset code rate threshold, and the output video stream is generated based on the second GOP and the third GOP.
It can be understood that in this embodiment, in the process of processing an input video stream to obtain an output video stream, only a first GOP in the input video stream with a code rate greater than a preset code rate threshold is subjected to code rate conversion, and a second GOP in the input video stream with a code rate less than or equal to the preset code rate threshold is not subjected to code rate conversion. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
It should be noted that, in some embodiments, each GOP in the GOP sequence may be processed at the same time. In other embodiments, the GOPs in the GOP sequence may also be processed sequentially in the order in which the GOPs in the GOP sequence are ordered.
The application provides a processing method of a video stream, which is characterized in that in the process of processing an input video stream, the input video stream is obtained, wherein the input video stream comprises a first group of pictures (GOP) sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence of the input video stream and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with the code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated according to the third GOP and the second GOP. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion, so that the workload of coding can be reduced, and the computing resource is saved.
In some embodiments of the present application, the first GOP sequence of the input video stream may include a plurality of groups of multiple GOPs arranged in sequence, where multiple GOPs may be transcoded simultaneously, but in a real-time application scenario, multiple GOPs in the first GOP sequence are generally sequential, so in some embodiments, the transcoding may be performed sequentially, in an actual application, and may be set according to an actual service requirement, where the embodiment is not limited in this specific manner.
In some embodiments, the video encoding mode of the input video stream and the output video stream in this embodiment is the same.
As an exemplary embodiment, the video encoding mode may be H264, H265, or the like.
Fig. 2 is a flow chart of another method for processing a video stream according to an embodiment of the present application. It should be noted that, the execution body of the video stream processing method provided in this embodiment is a video stream processing apparatus, where the video stream processing apparatus may be implemented in a software and/or hardware manner, the video stream processing apparatus in this embodiment may be configured in an electronic device, and the electronic device in this embodiment may include a server, etc., and this embodiment is not specifically limited to an electronic device.
As shown in fig. 2, the method may include:
in step 201, an input video stream is acquired, wherein the input video stream includes a first group of pictures GOP sequence including a plurality of GOPs arranged in order.
In some embodiments of the present application, the above determination manner for determining the code rate of each GOP in the first GOP sequence may be: for each GOP in the first GOP sequence, the byte size and the time length of the GOP may be obtained, and the code rate of the GOP may be determined according to the byte size and the time length.
Specifically, the byte size of the GOP may be divided by the length of time to obtain the code rate of the GOP.
And 203, judging whether the code rate of the GOP is larger than a preset code rate threshold value.
In some embodiments, the preset bitrate threshold may be a default value set in a processing device of the video stream, or may be preset according to a setting request of a user, so as to meet a requirement of the user for individually setting the preset bitrate threshold.
As an exemplary embodiment, the preset code rate threshold may be determined according to a received preset code rate threshold request.
And 204, if the code rate of the GOP is greater than the preset code rate threshold, taking the GOP as a first GOP.
And step 205, if the code rate of the GOP is less than or equal to the preset code rate threshold, taking the GOP as a second GOP.
In step 206, a serialization parameter set SPS and a picture parameter set PPS of the input video stream are acquired.
Wherein the serialization parameter set and the image parameter set information are part of the input video stream information.
Step 207 decodes the first GOP.
In step 208, the decoded first GOP is recoded according to the serialization parameter set SPS and the picture parameter set PPS to obtain a third GOP with a code rate less than or equal to the preset code rate threshold.
It can be understood that, in the process of recoding the decoded first GOP, the first GOP is recoded based on the serialization parameter set SPS and the picture parameter set PPS of the input video stream, so that the serialization parameter set SPS and the picture parameter set PPS of the third GOP obtained by the first GOP and the recoding are the same.
Step 209, sorting the third GOP and the second GOP according to the position of the first GOP corresponding to the third GOP in the first GOP sequence and the position of the second GOP in the first GOP sequence, so as to generate a second GOP sequence.
It is understood that the serialization parameter set SPS and the picture parameter set PPS of the input video stream and the output video stream in this embodiment are the same.
The application provides a processing method of a video stream, which comprises the steps of firstly obtaining an input video stream, wherein the input video stream comprises a first group of pictures (GOP) sequence, the first GOP sequence comprises a plurality of GOPs which are arranged in sequence, judging whether the code rate of each GOP is larger than a preset code rate threshold value according to the code rate of each GOP in the first GOP sequence, respectively obtaining a first GOP with the code rate larger than the preset code rate threshold value in the first GOP sequence and a second GOP with the code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence, simultaneously obtaining a serialization parameter set SPS and a picture parameter set PPS of the input video stream, further decoding the first GOP, re-encoding the decoded first GOP according to the serialization parameter set and the picture parameter set, obtaining a third GOP with the code rate smaller than or equal to the preset code rate threshold value, and finally sorting the third GOP and the second GOP according to the position of the first GOP corresponding to the third GOP in the first GOP sequence and the position of the second GOP sequence so as to generate a second GOP sequence, thereby generating an output video stream corresponding to the input video stream according to the second GOP sequence, and converting the output video stream with the code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence, and converting video stream input video stream with the code rate smaller than or equal to the preset code rate threshold value in the first GOP. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
In order to make the present application clear to those skilled in the art, the processing method of the video stream of this embodiment is described below with reference to fig. 3.
Fig. 3 is a flow chart of another method for processing a video stream according to an embodiment of the present application.
As shown in fig. 3, the method may include:
step 301, obtaining a serialization parameter set SPS and an image parameter set PPS of an input video stream, and a preset code rate threshold of a required output video stream, and initializing an output video encoder by using the SPS and PPS of the input video stream and the preset code rate threshold of the output video stream.
In some embodiments of the present application, the SPS and PPS information is part of the input video stream information. The SPS and PPS information of the input video stream is used to initialize a video encoder used in the video transcoding process. In this embodiment, the video encoder used in the video transcoding process is initialized based on the SPS and PPS information of the input video stream, so that the SPS and PPS information of the output video stream are identical to the SPS and PPS information of the input video stream, thereby avoiding the problem of player compatibility caused by switching between the input video stream and the output video stream.
It can be understood that if the code rate is less than or equal to the preset code rate threshold, the input stream is directly used, and the input stream at the moment is directly output as the output video stream, so that the computing resource is saved.
In some embodiments of the present application, steps 302-304 need to be repeated all the time to determine whether the encoding needs to be re-decoded, and thus to switch between the input stream and the output video stream, until the input video processing is completed, and the process is ended.
The application provides a video stream processing method, which comprises the steps of firstly using a SPS and a PPS of an obtained input video stream and a preset code rate threshold value of a required output video stream to initialize the output video stream, then comparing the code rate of the obtained GOP of the input video stream with the preset code rate threshold value of the output video stream, switching the GOP into the output video stream if the code rate is larger than the preset code rate threshold value, decoding and encoding the GOP which is larger than the limit, outputting the GOP, directly using an input stream if the code rate is smaller than or equal to the preset code rate threshold value, and ending the process when the GOP of the input video stream is not obtained. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
Fig. 4 is a schematic structural diagram of a video stream processing apparatus according to an embodiment of the present application.
As shown in fig. 4, the processing apparatus 400 for video stream includes:
a first acquisition module 401 is configured to acquire an input video stream, where the input video stream includes a first GOP sequence including a plurality of GOPs arranged in order.
The second obtaining module 402 is configured to obtain a first GOP in the first GOP sequence with a code rate greater than a preset code rate threshold, and obtain a second GOP in the first GOP sequence with a code rate less than or equal to the preset code rate threshold.
And the processing module 403 is configured to decode the first GOP, and re-encode the decoded first GOP to obtain a third GOP with a code rate less than or equal to a preset code rate threshold.
The generating module 404 is configured to generate an output video stream corresponding to the input video stream according to the third GOP and the second GOP.
The application provides a processing device for a video stream, which is used for acquiring the input video stream in the process of processing the input video stream, wherein the input video stream comprises a first group of pictures (GOP) sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence of the input video stream and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with the code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated according to the third GOP and the second GOP. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
In one embodiment of the present application, as shown in fig. 5, the processing module 403 may include:
an acquisition unit 4031 is configured to acquire a serialized parameter set SPS and a picture parameter set PPS of the input video stream.
A decoding unit 4032 for decoding the first GOP.
The encoding unit 4033 is configured to re-encode the decoded first GOP according to the serialized parameter set SPS and the picture parameter set PPS to obtain a third GOP with a code rate less than or equal to a preset code rate threshold.
In one embodiment of the present application, as shown in fig. 5, the generating module 404 may include:
a first generating unit 4041, configured to sort the third GOP and the second GOP according to the position of the first GOP corresponding to the third GOP in the first GOP sequence and the position of the second GOP in the first GOP sequence, so as to generate the second GOP sequence.
A second generating unit 4042, configured to generate an output video stream corresponding to the input video stream according to the second GOP sequence.
In one embodiment of the present application, as shown in fig. 5, the second obtaining module 402 may include:
the first determining unit 4021 is configured to determine a code rate of each GOP in the first GOP sequence.
The judging unit 4022 is configured to judge whether the code rate of the GOP is greater than a preset code rate threshold.
The second determining unit 4023 is configured to take the GOP as the first GOP if the code rate of the GOP is greater than a preset code rate threshold.
The third determining unit 4024 is configured to take the GOP as the second GOP if the code rate of the GOP is less than or equal to a preset code rate threshold.
The application provides a processing device for a video stream, which firstly needs to acquire an input video stream, wherein the input video stream comprises a first group of pictures (GOP) sequence, the first GOP sequence comprises a plurality of GOPs which are arranged in sequence, then a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence and a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence are respectively obtained, the first GOP is further decoded, the decoded first GOP is recoded, a third GOP with a code rate smaller than or equal to the preset code rate threshold value is obtained, and finally an output video stream corresponding to the input video stream is generated according to the third GOP and the second GOP. Therefore, in the process of processing the input video stream to obtain the output video stream, only the first GOP with the code rate larger than the preset code rate threshold value in the input video stream is subjected to code rate conversion, and the second GOP with the code rate smaller than or equal to the preset code rate threshold value in the input video stream is not subjected to code rate conversion. Thus, the workload of encoding can be reduced, and the computing resources can be saved.
According to embodiments of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 6, is a block diagram of an electronic device according to one embodiment of the present application.
As shown in fig. 6, the electronic device includes:
The processor 602, when executing instructions, implements the method for processing a video stream provided in the above embodiment.
Further, the electronic device further includes:
a communication interface 603 for communication between the memory 601 and the processor 602.
A memory 601 for storing computer instructions executable on the processor 602.
The memory 601 may comprise a high-speed RAM memory or may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory.
A processor 602, configured to implement the video stream processing method of the above embodiment when executing a program.
If the memory 601, the processor 602, and the communication interface 603 are implemented independently, the communication interface 603, the memory 601, and the processor 602 may be connected to each other through a bus and perform communication with each other. The bus may be an industry standard architecture (Industry Standard Architecture, abbreviated ISA) bus, an external device interconnect (Peripheral Component, abbreviated PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one thick line is shown in fig. 6, but not only one bus or one type of bus.
Alternatively, in a specific implementation, if the memory 601, the processor 602, and the communication interface 603 are integrated on a chip, the memory 601, the processor 602, and the communication interface 603 may perform communication with each other through internal interfaces.
The processor 602 may be a central processing unit (Central Processing Unit, abbreviated as CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" is at least two, such as two, three, etc., unless explicitly defined otherwise.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.
Claims (10)
1. A method of processing a video stream, the method comprising:
acquiring an input video stream, wherein the input video stream comprises a first group of pictures GOP sequence, and the first GOP sequence comprises a plurality of GOPs which are arranged in sequence;
acquiring a first GOP with a code rate larger than a preset code rate threshold value in the first GOP sequence, and acquiring a second GOP with a code rate smaller than or equal to the preset code rate threshold value in the first GOP sequence;
decoding the first GOP, and recoding the decoded first GOP to obtain a third GOP with a code rate smaller than or equal to the preset code rate threshold, including:
acquiring a serialization parameter set SPS and an image parameter set PPS of the input video stream;
decoding the first GOP;
recoding the decoded first GOP according to the serialization parameter set SPS and the picture parameter set PPS to obtain a third GOP of which the code rate is smaller than or equal to the preset code rate threshold;
generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP;
when the first GOP includes a plurality of GOPs, the method further includes: and simultaneously performing code rate conversion on the multiple GOPs.
2. The method of claim 1, wherein generating an output video stream corresponding to the input video stream from the third GOP and the second GOP comprises:
sequencing the third GOP and the second GOP according to the position of the first GOP corresponding to the third GOP in the first GOP sequence and the position of the second GOP in the first GOP sequence so as to generate a second GOP sequence;
and generating an output video stream corresponding to the input video stream according to the second GOP sequence.
3. The method of claim 1, wherein the obtaining a first GOP in the first GOP sequence having a code rate greater than a preset code rate threshold and obtaining a second GOP in the first GOP sequence having a code rate less than or equal to the preset code rate threshold comprises:
determining the code rate of each GOP in the first GOP sequence;
judging whether the code rate of the GOP is larger than a preset code rate threshold value or not;
if the code rate of the GOP is larger than a preset code rate threshold value, the GOP is used as the first GOP;
and if the code rate of the GOP is smaller than or equal to a preset code rate threshold value, taking the GOP as the second GOP.
4. The method of claim 1, wherein the preset code rate threshold is obtained by: and determining the preset code rate threshold according to the received request for the preset code rate threshold.
5. The method of claim 1, wherein the input video stream is encoded in the same manner as the output video stream.
6. A video stream processing apparatus, the apparatus comprising:
a first acquisition module, configured to acquire an input video stream, where the input video stream includes a first GOP sequence including a plurality of GOPs arranged in order;
the second acquisition module is used for acquiring a first GOP with the code rate being greater than a preset code rate threshold value in the first GOP sequence and acquiring a second GOP with the code rate being less than or equal to the preset code rate threshold value in the first GOP sequence;
the processing module is used for decoding the first GOP and recoding the decoded first GOP to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold value;
the generation module is used for generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP;
the processing module comprises:
an acquisition unit, configured to acquire a serialized parameter set SPS and an image parameter set PPS of the input video stream;
a decoding unit configured to decode the first GOP;
the coding unit is used for recoding the decoded first GOP according to the serialization parameter set SPS and the picture parameter set PPS so as to obtain a third GOP of which the code rate is smaller than or equal to the preset code rate threshold value;
when the first GOP includes a plurality of GOPs, the apparatus is further configured to: and simultaneously performing code rate conversion on the multiple GOPs.
7. The apparatus of claim 6, wherein the generating module is specifically configured to include:
a first generation unit, configured to sort the third GOP and the second GOP according to a position of the first GOP corresponding to the third GOP in the first GOP sequence and a position of the second GOP in the first GOP sequence, so as to generate a second GOP sequence;
and the second generation unit is used for generating an output video stream corresponding to the input video stream according to the second GOP sequence.
8. The apparatus of claim 6, wherein the second acquisition module comprises:
a first determining unit, configured to determine a code rate of each GOP in the first GOP sequence;
the judging unit is used for judging whether the code rate of the GOP is larger than a preset code rate threshold value or not;
a second determining unit, configured to take the GOP as the first GOP if the code rate of the GOP is greater than a preset code rate threshold;
and the third determining unit is used for taking the GOP as the second GOP if the code rate of the GOP is smaller than or equal to a preset code rate threshold value.
9. An electronic device, comprising:
memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of processing a video stream according to any of claims 1-5 when executing the program.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements a method of processing a video stream according to any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110442780.5A CN113055673B (en) | 2021-04-23 | 2021-04-23 | Video stream processing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110442780.5A CN113055673B (en) | 2021-04-23 | 2021-04-23 | Video stream processing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113055673A CN113055673A (en) | 2021-06-29 |
CN113055673B true CN113055673B (en) | 2023-06-23 |
Family
ID=76520185
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110442780.5A Active CN113055673B (en) | 2021-04-23 | 2021-04-23 | Video stream processing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113055673B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110381316A (en) * | 2019-07-17 | 2019-10-25 | 腾讯科技(深圳)有限公司 | A kind of method for controlling video transmission, device, equipment and storage medium |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006295535A (en) * | 2005-04-11 | 2006-10-26 | Toshiba Corp | Dynamic image coding apparatus, and method |
JPWO2008053557A1 (en) * | 2006-11-02 | 2010-02-25 | パイオニア株式会社 | Moving image re-encoding device, moving image re-encoding method, moving image re-encoding program, and recording medium storing moving image re-encoding program |
ES2773329T3 (en) * | 2010-05-12 | 2020-07-10 | Nippon Telegraph & Telephone | Video encoding control method, video encoding device, and video encoding program |
CN102457728B (en) * | 2010-10-27 | 2013-12-25 | 杭州华三通信技术有限公司 | Method and device for video image encoding |
CN105704510A (en) * | 2014-11-25 | 2016-06-22 | 中兴通讯股份有限公司 | Video processing method and device |
CN105847796A (en) * | 2016-03-31 | 2016-08-10 | 乐视控股(北京)有限公司 | Bit distribution method and device used for video coding |
CN109743639B (en) * | 2018-12-25 | 2021-11-09 | 深圳市麦谷科技有限公司 | Self-adaptive code rate control method, system, computer equipment and storage medium |
-
2021
- 2021-04-23 CN CN202110442780.5A patent/CN113055673B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110381316A (en) * | 2019-07-17 | 2019-10-25 | 腾讯科技(深圳)有限公司 | A kind of method for controlling video transmission, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113055673A (en) | 2021-06-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10924783B2 (en) | Video coding method, system and server | |
US10489426B2 (en) | Category-prefixed data batching of coded media data in multiple categories | |
US8675740B2 (en) | Hypothetical reference decoder | |
WO2019119950A1 (en) | Video coding processing method and apparatus, and application having video coding function | |
US20170180746A1 (en) | Video transcoding method and electronic apparatus | |
CN107155093B (en) | Video preview method, device and equipment | |
CN112165653B (en) | Video playing method, device and equipment | |
CN111669577A (en) | Hardware decoding detection method and device, electronic equipment and storage medium | |
CN115134629B (en) | Video transmission method, system, equipment and storage medium | |
CN111147926B (en) | Data transcoding method and device | |
US8681860B2 (en) | Moving picture compression apparatus and method of controlling operation of same | |
CN113055673B (en) | Video stream processing method and device, electronic equipment and storage medium | |
CN108696505A (en) | Video distribution apparatus, video reception apparatus, method of video distribution and recording medium | |
CN113066140B (en) | Image coding method, device, computer equipment and storage medium | |
CN117241106B (en) | Resource processing method and device | |
CN110868610B (en) | Streaming media transmission method, device, server and storage medium | |
CN110324629B (en) | Image transcoding method and device and electronic equipment | |
US10791350B2 (en) | System and method for optimization of video bitrate | |
US10244142B2 (en) | Image processing apparatus that carries out facsimile communications, control method therefor, and storage medium | |
CN116248921A (en) | Media file transcoding method and device, computing equipment and storage medium | |
CN107277650B (en) | Video file cutting method and device | |
CN107426611B (en) | multi-path output method and system based on video transcoding | |
CN113453075A (en) | Method and device for decoding multi-channel video, electronic equipment and storage medium | |
CN114245143A (en) | Encoding method, device, system, electronic device and storage medium | |
US9336557B2 (en) | Apparatus and methods for processing of media signals |
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 |