CN113055673A - 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 PDF

Info

Publication number
CN113055673A
CN113055673A CN202110442780.5A CN202110442780A CN113055673A CN 113055673 A CN113055673 A CN 113055673A CN 202110442780 A CN202110442780 A CN 202110442780A CN 113055673 A CN113055673 A CN 113055673A
Authority
CN
China
Prior art keywords
gop
code rate
video stream
sequence
input video
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.)
Granted
Application number
CN202110442780.5A
Other languages
Chinese (zh)
Other versions
CN113055673B (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.)
Beijing Huijun Technology Co ltd
Original Assignee
Beijing Huijun 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 Beijing Huijun Technology Co ltd filed Critical Beijing Huijun Technology Co ltd
Priority to CN202110442780.5A priority Critical patent/CN113055673B/en
Publication of CN113055673A publication Critical patent/CN113055673A/en
Application granted granted Critical
Publication of CN113055673B publication Critical patent/CN113055673B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods 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/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods 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/177Methods 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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods 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, an electronic device 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 obtained first, 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 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 in the first GOP sequence are obtained, the first GOP is decoded, the decoded first GOP is re-encoded, a third GOP with a code rate smaller than or equal to the preset code rate threshold 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. Therefore, the workload of coding can be reduced, and the computing resources can be saved.

Description

Video stream processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of video technologies, and in particular, to a method and an apparatus for processing a video stream, an electronic device, and a storage medium.
Background
In some video transcoding scenarios, users generally want to limit the bitrate threshold of the transcoded video stream to a fixed value as much as possible to avoid the seizure problem caused by excessive network bandwidth requirements. In the related art, all the image groups of the input video stream are usually transcoded by combining with a preset code rate threshold, however, in the above manner, all the image groups of all the video streams need to be transcoded, which results in a great deal of waste of computing resources.
Disclosure of Invention
The present application relates to the field of video technologies, and in particular, to a method and an 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 arranged in sequence; acquiring a first GOP (group of pictures) with a code rate larger than a preset code rate threshold in the first GOP sequence, and acquiring a second GOP with a code rate smaller than or equal to the preset code rate threshold in the first GOP sequence; decoding the first GOP, and re-encoding the decoded first GOP to obtain a third GOP with a code rate less 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 an embodiment of the present application, the decoding the first GOP and re-encoding the decoded first GOP to obtain a third GOP with a code rate less than or equal to a preset code rate threshold includes: acquiring a serialization parameter set SPS and a picture 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 image parameter set PPS to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold.
In an embodiment of the present application, the generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP includes: sorting the third GOP and the second GOP according to the position of the first GOP in the first GOP sequence corresponding to the third GOP and the position of the second GOP in the first GOP sequence 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 an embodiment of the present application, the obtaining a first GOP in the first GOP sequence whose code rate is greater than a preset code rate threshold, and obtaining a second GOP in the first GOP sequence whose 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, taking the GOP as the first GOP; and if the code rate of the GOP is smaller than or equal to a preset code rate threshold, taking the GOP as the second GOP.
In an embodiment of the present application, the preset code rate threshold is obtained by: determining the preset code rate threshold according to the received preset code rate threshold request.
In one embodiment of the present application, the input video stream is video encoded in the same manner as the output video stream.
The application provides a video stream processing method, which includes the steps of obtaining an 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 obtaining a first GOP of the input video stream, wherein the code rate of the first GOP sequence is larger than a preset code rate threshold value, and a second GOP of the input video stream, wherein the code rate of the first GOP sequence is smaller than or equal to the preset code rate threshold value, further decoding the first GOP, re-encoding the decoded first GOP to obtain a third GOP of which the code rate is smaller than or equal to the preset code rate threshold value, and finally generating an output video stream corresponding to the input video stream 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 coding workload can be reduced, and the computing resources can be saved.
Another embodiment of the present application provides a device for processing a video stream, where the device includes: the device comprises a first acquisition module, a second acquisition module and a first display module, wherein the first acquisition module is used for acquiring an input video stream, and the input video stream comprises a first group of pictures (GOP) sequence which comprises a plurality of GOPs arranged in sequence; the second obtaining module is used for obtaining a first GOP (group of pictures) with a code rate larger than a preset code rate threshold in the first GOP sequence and obtaining a second GOP with a code rate smaller than or equal to the preset code rate threshold 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; and the generating 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, the processing module includes: an obtaining unit, configured to obtain a serialization parameter set SPS and a picture parameter set PPS of the input video stream; a decoding unit configured to decode the first GOP; and the encoding unit is used for re-encoding the decoded first GOP according to the serialization parameter set SPS and the image parameter set PPS to obtain a third GOP with a code rate smaller than or equal to the preset code rate threshold.
In an embodiment of the application, the generating module is specifically configured to include: a first generating unit, configured to sort the third GOP and the second GOP according to a position of a 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 generating unit is used for generating an output video stream corresponding to the input video stream according to the second GOP sequence.
In an embodiment of the 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 less than or equal to a preset code rate threshold value.
The application provides a processing device of 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 acquiring a first GOP (group of pictures) of the input video stream, wherein the code rate of the first GOP sequence is greater than a preset code rate threshold, and a second GOP of the first GOP sequence, wherein the code rate of the first GOP sequence is less than or equal to the preset code rate threshold, further decoding the first GOP, re-encoding the decoded first GOP to obtain a third GOP of which the code rate is less than or equal to the preset code rate threshold, and finally generating an output video stream corresponding to the input video stream 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 coding workload can be reduced, and the computing resources can be saved.
An embodiment of another aspect of the present application provides an electronic device, including: memory, processor and 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 provides a computer-readable storage medium, on which a computer program is stored, where the computer program is used to implement a method for processing a video stream when the computer program is executed by a processor.
Other effects of the above-described alternative will be described below with reference to specific embodiments.
Drawings
Fig. 1 is a schematic flowchart of a method for processing a video stream according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of another video stream processing method according to an embodiment of the present application.
Fig. 3 is a flowchart illustrating another video stream processing method 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
Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.
The following describes a method, an apparatus and an electronic device for processing a video stream according to an embodiment of the present application with reference to the drawings.
Fig. 1 is a schematic flowchart of a method for processing a video stream according to an embodiment of the present application. It should be noted that an execution subject of the method for processing a video stream provided in this embodiment is a processing apparatus for a video stream, the processing apparatus for a video stream may be implemented in a software and/or hardware manner, the processing apparatus for a video stream in this embodiment may be configured in an electronic device, the electronic device in this embodiment may include a server, and the electronic device in this embodiment is not particularly limited.
As shown in fig. 1, the method for processing the video stream may include:
step 101, an input video stream is obtained, wherein the input video stream comprises a first group of pictures, GOP, sequence, and the first GOP sequence comprises a plurality of GOPs arranged in sequence.
Here, the gop (group of pictures) refers to a group of pictures.
In an exemplary embodiment, in a video conversion use scenario, after a transcoding request of a user is received, a video stream corresponding to the transcoding request may be acquired, and the acquired video stream is used as an input video stream.
Step 102, obtaining a first GOP of which the code rate is greater than a preset code rate threshold in the first GOP sequence, and obtaining a second GOP of which the code rate is less than or equal to the preset code rate threshold in the first GOP sequence.
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 setting the preset bitrate threshold individually.
As an exemplary embodiment, the preset bitrate threshold can be determined according to a received preset bitrate threshold request. In some embodiments, 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 needs to be further encoded and decoded, the output video stream is output,
in other embodiments, the second GOP with the code rate smaller than or equal to the preset code rate threshold in the first GOP sequence is directly output by replacing the input video stream with the output video stream without performing the encoding and decoding process.
And 103, decoding the first GOP, and re-encoding 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, to avoid the problem of player incompatibility, a Sequence Parameter Set (SPS) and a Picture Parameter Set (PPS) of the first GOP may be obtained, the first GOP is decoded, and the decoded first GOP is re-encoded according to the SPS 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 picture parameter set information are part of the input video stream information.
And step 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 obtained by decoding the first GOP from the new coding, wherein the code rates of the third GOP and the second GOP are both smaller 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 the input video stream to obtain the output video stream, only the first GOP with the bitrate greater than the preset bitrate threshold in the input video stream is subjected to bitrate conversion, and the second GOP with the bitrate less than or equal to the preset bitrate threshold in the input video stream is not subjected to bitrate conversion. Therefore, the workload of coding can be reduced, and the computing resources can be saved.
It should be noted that, in some embodiments, each GOP in the sequence of GOPs may be processed simultaneously. In other embodiments, the GOPs in the GOP sequence may also be processed sequentially according to the ordering order of the GOPs in the GOP sequence.
The application provides a method for processing a video stream, which comprises the steps of 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 acquiring a first GOP (group of pictures) of the input video stream, wherein the code rate of the first GOP sequence is greater than a preset code rate threshold, and a second GOP of the first GOP sequence, wherein the code rate of the first GOP sequence is less than or equal to the preset code rate threshold, further decoding the first GOP, re-encoding the decoded first GOP to obtain a third GOP of which the code rate is less than or equal to the preset code rate threshold, and finally generating an output video stream corresponding to the input video stream 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 coding workload can be reduced, and the computing resources can be saved.
In some embodiments of the present application, the first GOP sequence of the input video stream may include multiple groups of multiple GOPs arranged in sequence, and in the present application, rate conversion may be performed on the multiple GOPs at the same time, but in a real-time application scenario, generally, the multiple GOPs in the first GOP sequence are all sequential, so rate conversion may be performed in some embodiments according to the sequence, and in an actual application, the rate conversion may be set according to an actual service requirement, and this embodiment is not specifically limited to this.
In some embodiments, the input video stream and the output video stream are encoded in the same manner in this embodiment.
As an exemplary embodiment, the video encoding method may be H264, H265, or the like.
Fig. 2 is a schematic flowchart of another video stream processing method according to an embodiment of the present application. It should be noted that an execution subject of the method for processing a video stream provided in this embodiment is a processing apparatus for a video stream, the processing apparatus for a video stream may be implemented in a software and/or hardware manner, the processing apparatus for a video stream in this embodiment may be configured in an electronic device, the electronic device in this embodiment may include a server, and the electronic device in this embodiment is not particularly limited.
As shown in fig. 2, the method may include:
step 201, an input video stream is obtained, wherein the input video stream includes a first group of pictures, GOP, sequence, and the first GOP sequence includes a plurality of GOPs arranged in sequence.
Step 202, determining the code rate of each GOP in the first GOP sequence.
In some embodiments of the present application, the determining 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 duration of the GOP may be obtained, and the code rate of the GOP may be determined according to the byte size and duration.
Specifically, the byte size of the GOP may be divided by the duration to obtain the code rate of the GOP.
Step 203, determining whether the code rate of the GOP is greater than a preset code rate threshold.
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 setting the preset bitrate threshold individually.
As an exemplary embodiment, the preset bitrate threshold can be determined according to a received preset bitrate threshold request.
And step 204, if the code rate of the GOP is greater than a preset code rate threshold, taking the GOP as a first GOP.
Step 205, if the code rate of the GOP is less than or equal to the preset code rate threshold, the GOP is taken as a second GOP.
In step 206, the serialization parameter sets SPS and the picture parameter sets PPS of the input video stream are obtained.
Wherein the serialization parameter set and the picture parameter set information are part of the input video stream information.
Step 207 decodes the first GOP.
And step 208, re-encoding the decoded first GOP according to the serialization parameter set SPS and the image parameter set PPS to obtain a third GOP with the code rate less than or equal to a preset code rate threshold.
It is to be understood that, in the process of re-encoding the decoded first GOP, the first GOP is re-encoded based on the serialization parameter set SPS and the picture parameter set PPS of the input video stream, and thus, the serialization parameter set SPS and the picture parameter set PPS of the first GOP and the re-encoded third GOP are the same.
Step 209, the third GOP and the second GOP are sorted according to the position of the first GOP in the first GOP sequence corresponding to the third GOP and the position of the second GOP in the first GOP sequence, so as to generate a second GOP sequence.
Step 210, generating an output video stream corresponding to the input video stream according to the second GOP sequence.
It should be understood that the serialization parameter sets SPS and the picture parameter sets PPS of the input video stream and the output video stream in the present embodiment are the same.
The application provides a method for processing a video stream, which comprises the steps of firstly acquiring an input video stream, wherein the input video stream comprises a first GOP (group of pictures) sequence, the first GOP sequence comprises a plurality of GOPs (group of pictures) which are arranged in sequence, then judging whether the code rate of the GOPs is larger than a preset code rate threshold value or not according to the code rate of each GOP in the first GOP sequence, respectively acquiring a first GOP of which the code rate is larger than the preset code rate threshold value and a second GOP of which the code rate is smaller than or equal to the preset code rate threshold value in the first GOP sequence, simultaneously acquiring a serialized SPS (picture parameter set) and a PPS (picture parameter set) of the input video stream, further decoding the first GOP, re-encoding the decoded first GOP according to the serialized parameter set and the picture parameter set to obtain a third GOP of which the code rate is smaller than or equal to the preset code rate threshold value, and finally, determining the position of the first GOP in the first GOP sequence and, and sequencing the third GOP and the second GOP to generate a second GOP sequence, and generating an output video stream corresponding to the input video stream according to the second GOP sequence, so that 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. Therefore, the workload of coding 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 the embodiment is described below with reference to fig. 3.
Fig. 3 is a flowchart illustrating another video stream processing method according to an embodiment of the present application.
As shown in fig. 3, the method may include:
step 301, acquiring a serialization parameter set SPS and a picture parameter set PPS of an input video stream, and a preset code rate threshold of a required output video stream, and then 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. A video encoder used in the video transcoding process is initialized using SPS and PPS information of the input video stream. 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 is the same as 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.
Step 302, comparing the code rate of the current GOP of the input video stream with a preset code rate threshold of the output video stream.
Step 303, if the code rate of the current GOP is greater than the preset code rate threshold of the output video stream, decoding the current GOP of the input video stream, and re-encoding the decoded data by the video encoder to obtain a processed GOP with a code rate less than the preset code rate threshold.
And step 304, if the code rate of the current GOP is less than or equal to the preset code rate threshold value of the output video stream, directly outputting the current GOP.
It can be understood that if the bitrate is less than or equal to the preset bitrate threshold, the input stream is directly used, and the input stream at the moment is directly output as an output video stream, so that the computing resources are saved.
Step 305, after acquiring the next GOP of the input video stream, taking the next GOP as the current GOP, and repeatedly executing 302 and 304 operations.
Step 306, when the video stream is input, the process is ended.
In some embodiments of the present application, step 302 and step 304 need to be repeated to determine whether re-decoding and encoding are needed, so as to realize the conversion between the input stream and the output video stream until the input video is processed, and the process is ended.
The method comprises the steps of firstly, using an SPS (semi-persistent scheduling) and a PPS (picture per second) of an acquired input video stream and a preset code rate threshold of a required output video stream to initialize an output video stream, then comparing the code rate of an acquired GOP (group of pictures) of the input video stream with the preset code rate threshold of the output video stream, switching to the output video stream if the code rate is greater than the preset code rate threshold, decoding and encoding the GOP greater than a limit value, outputting, directly using an input stream if the code rate is less than or equal to the preset code rate threshold, and ending a process when the GOP of the input video stream cannot be acquired. 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. Therefore, the workload of coding 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 apparatus 400 for processing a video stream includes:
the first obtaining module 401 is configured to obtain an input video stream, where the input video stream includes a first group of pictures, GOP, sequence, and the first GOP sequence includes multiple GOPs arranged in sequence.
A second obtaining module 402, configured to obtain a first GOP in the first GOP sequence, where the code rate is greater than a preset code rate threshold, and obtain a second GOP in the first GOP sequence, where the code rate is less than or equal to the preset code rate threshold.
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 smaller than or equal to a preset code rate threshold.
And a generating module 404, 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 of a video stream, in the process of processing the 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, then the first GOP is decoded, the decoded first GOP is recoded to obtain a third GOP with a code rate smaller than or equal to the preset code rate threshold value, 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. Therefore, the workload of coding can be reduced, and the computing resources can be saved.
In an embodiment of the present application, as shown in fig. 5, the processing module 403 may include:
an obtaining unit 4031 is configured to obtain the serialization parameter set SPS and the picture parameter set PPS of the input video stream.
A decoding unit 4032 for decoding the first GOP.
An encoding unit 4033, configured to re-encode 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 a code rate smaller 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:
the first generating unit 4041 is configured to sort the third GOP and the second GOP according to a position of the first GOP in the first GOP sequence and a position of the second GOP in the first GOP sequence corresponding to the third GOP, so as to generate a second GOP sequence.
The second generating unit 4042 is configured to generate an output video stream corresponding to the input video stream according to the second GOP sequence.
In an embodiment of the present application, as shown in fig. 5, the second obtaining module 402 may include:
a first determining unit 4021, configured to determine a code rate of each GOP in the first GOP sequence.
The determining unit 4022 is configured to determine whether the code rate of the GOP is greater than a preset code rate threshold.
A second determining unit 4023, configured to determine the GOP as the first GOP if the code rate of the GOP is greater than a preset code rate threshold.
A third determining unit 4024, configured to determine 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 of a video stream, which firstly needs to acquire an input video stream, wherein the input video stream comprises a first GOP (group of pictures) sequence, the first GOP sequence comprises a plurality of GOPs (group of pictures) which are arranged in sequence, then a first GOP (group of pictures) 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, then the first GOP is decoded, the decoded first GOP is re-encoded, 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. Therefore, the workload of coding can be reduced, and the computing resources can be saved.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
FIG. 6 is a block diagram of an electronic device according to an embodiment of the present application.
As shown in fig. 6, the electronic apparatus includes:
memory 601, processor 602, and computer instructions stored on memory 601 and executable on processor 602.
The processor 602, when executing the instructions, implements the method of processing the video stream provided in the above embodiments.
Further, the electronic device further includes:
a communication interface 603 for communication between the memory 601 and the processor 602.
Memory 601 for storing computer instructions executable on processor 602.
Memory 601 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 602 is configured to implement the video stream processing method according to the above embodiment when executing the 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 (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
Optionally, 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 complete mutual communication through an internal interface.
The processor 602 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present Application.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," 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 application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer 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, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (12)

1. A method for 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 arranged in sequence;
acquiring a first GOP (group of pictures) with a code rate larger than a preset code rate threshold in the first GOP sequence, and acquiring a second GOP with a code rate smaller than or equal to the preset code rate threshold in the first GOP sequence;
decoding the first GOP, and re-encoding the decoded first GOP to obtain a third GOP with a code rate less than or equal to the preset code rate threshold;
and generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP.
2. The method of claim 1, wherein decoding the first GOP and re-encoding the decoded first GOP to obtain a third GOP with a code rate less than or equal to a preset code rate threshold comprises:
acquiring a serialization parameter set SPS and a picture 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 image parameter set PPS to obtain a third GOP with the code rate smaller than or equal to the preset code rate threshold.
3. The method according to claim 1 or 2, wherein generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP comprises:
sorting the third GOP and the second GOP according to the position of the first GOP in the first GOP sequence corresponding to the third GOP and the position of the second GOP in the first GOP sequence to generate a second GOP sequence;
and generating an output video stream corresponding to the input video stream according to the second GOP sequence.
4. The method of claim 1, wherein obtaining a first GOP in the first GOP sequence with a code rate greater than a preset code rate threshold and obtaining a second GOP in the first GOP sequence with a code rate less than or equal to a 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, taking the GOP as the first GOP;
and if the code rate of the GOP is smaller than or equal to a preset code rate threshold, taking the GOP as the second GOP.
5. The method of claim 1, wherein the preset code rate threshold is obtained by: determining the preset code rate threshold according to the received preset code rate threshold request.
6. The method of claim 1, wherein the input video stream is video encoded in the same manner as the output video stream.
7. An apparatus for processing a video stream, the apparatus comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring an input video stream, and the input video stream comprises a first GOP (group of pictures) sequence which comprises a plurality of GOPs (group of GOPs) arranged in sequence;
the second obtaining module is used for obtaining a first GOP (group of pictures) with a code rate larger than a preset code rate threshold in the first GOP sequence and obtaining a second GOP with a code rate smaller than or equal to the preset code rate threshold 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;
and the generating module is used for generating an output video stream corresponding to the input video stream according to the third GOP and the second GOP.
8. The apparatus of claim 7, wherein the processing module comprises:
an obtaining unit, configured to obtain a serialization parameter set SPS and a picture parameter set PPS of the input video stream;
a decoding unit configured to decode the first GOP;
and the encoding unit is used for re-encoding the decoded first GOP according to the serialization parameter set SPS and the image parameter set PPS to obtain a third GOP with a code rate smaller than or equal to the preset code rate threshold.
9. The apparatus according to claim 7 or 8, wherein the generating module is specifically configured to include:
a first generating unit, configured to sort the third GOP and the second GOP according to a position of a 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 generating unit is used for generating an output video stream corresponding to the input video stream according to the second GOP sequence.
10. The apparatus of claim 7, wherein the second obtaining 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 less than or equal to a preset code rate threshold value.
11. An electronic device, comprising:
memory, processor and 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 to 6 when executing the program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of processing a video stream according to any one of claims 1 to 6.
CN202110442780.5A 2021-04-23 2021-04-23 Video stream processing method and device, electronic equipment and storage medium Active CN113055673B (en)

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 true CN113055673A (en) 2021-06-29
CN113055673B 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 (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006295535A (en) * 2005-04-11 2006-10-26 Toshiba Corp Dynamic image coding apparatus, and method
WO2008053557A1 (en) * 2006-11-02 2008-05-08 Pioneer Corporation Moving picture re-encoding device, moving picture re-encoding method, moving picture re-encoding program, and recording medium containing the moving picture re-encoding program
CN102457728A (en) * 2010-10-27 2012-05-16 杭州华三通信技术有限公司 Method and device for video image encoding
CN102870415A (en) * 2010-05-12 2013-01-09 日本电信电话株式会社 Video coding control method, video coding device and video codingprogram
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
CN109743639A (en) * 2018-12-25 2019-05-10 深圳市麦谷科技有限公司 A kind of method for controlling self-adaption code rate, system, computer equipment and storage medium
CN110381316A (en) * 2019-07-17 2019-10-25 腾讯科技(深圳)有限公司 A kind of method for controlling video transmission, device, equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006295535A (en) * 2005-04-11 2006-10-26 Toshiba Corp Dynamic image coding apparatus, and method
WO2008053557A1 (en) * 2006-11-02 2008-05-08 Pioneer Corporation Moving picture re-encoding device, moving picture re-encoding method, moving picture re-encoding program, and recording medium containing the moving picture re-encoding program
CN102870415A (en) * 2010-05-12 2013-01-09 日本电信电话株式会社 Video coding control method, video coding device and video codingprogram
CN102457728A (en) * 2010-10-27 2012-05-16 杭州华三通信技术有限公司 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
CN109743639A (en) * 2018-12-25 2019-05-10 深圳市麦谷科技有限公司 A kind of method for controlling self-adaption code rate, system, computer equipment and storage medium
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
CN113055673B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
US10536732B2 (en) Video coding method, system and server
CN110418177B (en) Video encoding method, apparatus, device and storage medium
CN105451031B (en) Video transcoding method and system
US20170180746A1 (en) Video transcoding method and electronic apparatus
CN107155093B (en) Video preview method, device and equipment
CN113965751B (en) Screen content coding method, device, equipment and storage medium
CN111669577A (en) Hardware decoding detection method and device, electronic equipment and storage medium
CN111343503B (en) Video transcoding method and device, electronic equipment and storage medium
CN112138376A (en) Cloud game archiving method and device and electronic equipment
CN115134629B (en) Video transmission method, system, equipment and storage medium
CN109217980B (en) Encoding and decoding capacity configuration method, device and computer storage medium
CN116567170A (en) Video super-resolution parallel scheduling method and device for cloud platform and cloud platform
CN111147926A (en) Data transcoding method and device
US20080267284A1 (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
CN110324629B (en) Image transcoding method and device and electronic equipment
US10791350B2 (en) System and method for optimization of video bitrate
CN113453075A (en) Method and device for decoding multi-channel video, electronic equipment and storage medium
CN107426611B (en) multi-path output method and system based on video transcoding
CN110969672A (en) Image compression method and device
CN110022480B (en) H265 hardware coding method based on AMD display card and live broadcast platform
US9336557B2 (en) Apparatus and methods for processing of media signals
CN113067988B (en) Conference synthesis method and device and electronic equipment
WO2024067736A1 (en) Video coding method and apparatus, computing device, storage medium, and program product
CN118118683A (en) Short video quick transcoding method system

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