CN117097904A - Video coding method, device, electronic equipment and medium - Google Patents
Video coding method, device, electronic equipment and medium Download PDFInfo
- Publication number
- CN117097904A CN117097904A CN202210533395.6A CN202210533395A CN117097904A CN 117097904 A CN117097904 A CN 117097904A CN 202210533395 A CN202210533395 A CN 202210533395A CN 117097904 A CN117097904 A CN 117097904A
- Authority
- CN
- China
- Prior art keywords
- frame
- quantization parameter
- current frame
- macroblock
- current
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000013139 quantization Methods 0.000 claims abstract description 291
- 238000004590 computer program Methods 0.000 claims description 16
- 230000005540 biological transmission Effects 0.000 claims description 5
- 230000000241 respiratory effect Effects 0.000 abstract description 14
- 230000008859 change Effects 0.000 abstract description 5
- 238000004891 communication Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000002401 inhibitory effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000029058 respiratory gaseous exchange Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
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/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/17—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 an image region, e.g. an object
- H04N19/176—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 an image region, e.g. an object the region being a block, e.g. a macroblock
-
- 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/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- 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/17—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 an image region, e.g. an object
- H04N19/172—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 an image region, e.g. an object the region being a picture, frame or field
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The application discloses a video coding method, a video coding device, electronic equipment and a video coding medium. Determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information; determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters; determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame; the current frame is encoded based on the target quantization parameter. According to the method, the frame-level quantization parameter of the current frame can be determined according to the frame size of the current frame and the current space information, so that the macro-block-level quantization parameter and the target quantization parameter of the macro block included in the current frame are sequentially determined, the current frame is encoded based on the target quantization parameter, and the respiratory effect in video encoding caused by the large change of the quantization parameter can be restrained.
Description
Technical Field
The present application relates to the field of video coding technologies, and in particular, to a video coding method, a video coding device, an electronic device, and a medium.
Background
The respiratory effect is mainly expressed in the video coding process that the periodicity of video pictures changes between blurring and sharpness, which influences the viewing experience.
In order to inhibit respiratory effect, the prior technical scheme firstly carries out time domain filtering denoising on an input image before video coding so as to increase the correlation of front and rear frame images; respiratory effects are also suppressed by reducing the I-frame refresh frequency, or refreshing only local I-slices per frame in multiple consecutive P-frames. In addition, a bi-directional predictive (B-frame) coding mode can be used before the I-frame to smooth the texture changes of the P-frame and the I-frame by the B-frame to suppress respiratory effects.
However, the above technical solution cannot be applied to the field of Real-time communication (Real-Time Communication, RTC), and cannot ensure the requirements of low latency, high frame rate and instantaneity in the RTC field, and in addition, local respiratory effects may be caused.
Disclosure of Invention
The application provides a video coding method, a video coding device, electronic equipment and a video coding medium, which are used for inhibiting respiratory effect in the video coding process of more fields.
According to an aspect of the present application, there is provided a video encoding method including:
determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information;
determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters;
determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame;
the current frame is encoded based on the target quantization parameter.
According to another aspect of the present application, there is provided a video encoding apparatus including:
the first determining module is used for determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information;
a second determining module, configured to determine a macroblock-level quantization parameter of a macroblock included in the current frame according to the frame-level quantization parameter;
a third determining module, configured to determine, according to the macroblock-level quantization parameter and a macroblock quantization range, a target quantization parameter of a macroblock included in the current frame, where the macroblock quantization range is determined based on a video frame of a set frame number before the current frame;
and the encoding module is used for encoding the current frame based on the target quantization parameter.
According to another aspect of the present application, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the video encoding method of any one of the embodiments of the present application.
According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a video encoding method according to any one of the embodiments of the present application.
The embodiment of the application provides a video coding method, a video coding device, electronic equipment and a video coding medium, wherein the video coding method comprises the following steps: determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information; determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters; determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame; the current frame is encoded based on the target quantization parameter. By utilizing the technical scheme, the frame-level quantization parameter of the current frame can be determined according to the frame size and the current space information of the current frame, so that the macroblock-level quantization parameter and the target quantization parameter of the macroblock included in the current frame are sequentially determined, the current frame is encoded based on the target quantization parameter, and the respiratory effect in video encoding caused by great change of the quantization parameter can be restrained.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the application or to delineate the scope of the application. Other features of the present application will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a video encoding method according to an embodiment of the present application;
fig. 2 is a flowchart of a video encoding method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device implementing a video encoding method according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Various features described in the embodiments below may be combined to form a number of alternatives. Furthermore, embodiments of the application and features of the embodiments may be combined with each other without conflict.
Fig. 1 is a flowchart of a video encoding method according to an embodiment of the present application, where the method may be performed by a video encoding apparatus, and the video encoding apparatus may be implemented in hardware and/or software, and the video encoding apparatus may be configured in an electronic device. The electronic device in this embodiment includes, but is not limited to: computers, notebook computers, tablet computers, cell phones and other devices.
It should be noted that, in the video coding standard h.264, there are different frame types, including I frames, P frames, B frames, etc., where an I frame may refer to an Intra-coded image frame (Intra-coded picture), and an I frame may represent a key frame, and decoding may be performed only with the frame data; the P frame may refer to a forward Predictive coded Picture frame (P frame), which represents the difference between the current frame and a previous key frame (or P frame), and when decoding, the difference defined by the current frame needs to be overlapped with the previously buffered Picture to generate a final Picture; the B frame may be Bidirectionally predicted picture (bi-directionally predictive coded image frame), and the B frame may be a bi-directionally differential frame, that is, the B frame records the difference between the present frame and the previous and subsequent frames, and when decoding, not only the previous buffered picture but also the picture after decoding is acquired, and the final picture is acquired by overlapping the previous and subsequent pictures with the present frame data.
The respiratory effect is mainly generated due to the sudden degradation of the quality of the frames and the sudden recovery, and is reflected in the video coding as a large change of the quantization parameter qp. The quantization parameter qp is a key factor determining the image quality and size in the encoder, and it can be understood that the larger qp is, the worse the image quality is and the smaller the frame is; conversely, the smaller qp, the higher the image quality, the larger the frame, and the respiratory effect is suppressed by controlling the difference between the qp value of the I frame and the qp value of the frame in a period of time before the I frame.
Based on this, the embodiment of the application provides a video coding method, which comprises the following steps:
s110, determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information.
The frame size is understood to be the size of the pixels occupied by the length and width of each frame of the screen, and it is considered that the greater the number of pixels, the higher the sharpness, that is, the larger the frame. The specific value of the frame size is not limited and may be determined by the current target code rate, for example. The current frame may be the frame currently to be encoded. The current frame may be an I frame or a P frame.
The current spatial information may be used to describe the spatial complexity of the content information in the current picture, and it may be considered that the larger the current spatial information value is, the more texture information representing the current picture is, and the higher the spatial complexity of the current picture is, for example, the gradient sum of all pixels may be calculated by using a canny operator to obtain the current spatial information. The frame-level quantization parameter may refer to a quantization parameter of a current picture in units of frames.
Specifically, the frame level quantization parameter of the current frame may be determined according to the frame size of the current frame and the current spatial information, and the embodiment does not limit the specific steps of determining the frame level quantization parameter of the current frame, for example, the relation between the frame size of the current frame, the current spatial information and the frame level quantization parameter of the current frame may be simulated through a plurality of data points, and then the frame level quantization parameter of the current frame may be determined through data fitting.
In one embodiment, the frame size is a set multiple of a current target code rate, the current target code rate being determined based on a current network transmission state.
In this embodiment, the current target code rate may refer to a target code rate of the current encoder, where the target code rate may be understood to refer to a target bit rate value of the video required to be obtained when video encoding is performed, and the target bit rate value may be considered to be a value preset for the current encoder, which is not limited herein; the current target code rate may be determined based on the current network transmission state.
It will be appreciated that too large a frame may cause transmission congestion and delay, and too small a frame may cause a poor picture quality of the frame. The embodiment effectively balances the technical defects caused by oversized frames or undersized frames by constraining the frame size through the current target code rate.
Alternatively, the frame size may be a set multiple of the current target code rate, where the set multiple may be determined by the system or the actual situation. For example, the set multiple may be one fifth, that is, the frame size may be one fifth of the current target code rate, which is determined by the maximum delay (such as 200 ms) tolerated by the RTC scenario, the maximum number of packets MTU transmitted in a unit time, the real-time network RTT, the packet loss rate, and the jitter time, which is not limited in this embodiment.
S120, determining macro block level quantization parameters of macro blocks included in the current frame according to the frame level quantization parameters.
The macroblock-level quantization parameter may refer to a quantization parameter of a current picture in units of macroblocks. It will be appreciated that, since h.264 video coding mainly uses 16×16 macroblocks as a unit of transformation and quantization, this step needs to determine macroblock-level quantization parameters of included macroblocks of the current frame according to frame-level quantization parameters, and the specific determination means is not limited, for example, the macroblock-level quantization parameters of included macroblocks of the current frame may be obtained by a numerical relationship between the macroblock-level quantization parameters and the frame-level quantization parameters.
In one embodiment, determining macroblock-level quantization parameters for included macroblocks of the current frame based on the frame-level quantization parameters comprises:
determining a quantization parameter difference for each macroblock of the current frame;
for each macroblock, a difference value of the frame-level quantization parameter and the corresponding quantization parameter difference is determined as a macroblock-level quantization parameter for the macroblock.
The quantization parameter difference of each macroblock may be considered as a difference between the quantization parameter of the current macroblock and the frame-level quantization parameter of the current frame, and the quantization parameter difference of each macroblock may be the same or different, and may be determined by an encoder native algorithm, which is not developed in this step.
After determining the quantization parameter difference of each macroblock of the current frame, the difference between the frame-level quantization parameter and the corresponding quantization parameter difference may be determined as the macroblock-level quantization parameter of the current macroblock for each macroblock, so as to determine the subsequent target quantization parameter.
S130, determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and the macro block quantization range, wherein the macro block quantization range is determined based on video frames with set frame numbers before the current frame.
The macroblock quantization range may be understood as a range of a value corresponding to a macroblock-level quantization parameter, and the macroblock quantization range may be determined based on a video frame of a set frame number before a current frame, for example, the set frame number may be set by a system or a related person, for example, the set frame number may be 15 frames.
According to the embodiment, the target quantization parameter of the macro block is restrained from being valued through the macro block quantization range, so that the breathing effect is avoided.
The target quantization parameter may be considered as a quantization parameter that is desired when the current frame is encoded. In this embodiment, the target quantization parameter of the macroblock included in the current frame may be determined according to the macroblock-level quantization parameter and the macroblock quantization range, and the specific determination method is not limited, and, by way of example, when the macroblock-level quantization parameter is within the macroblock quantization range, the macroblock-level quantization parameter may be determined as the target quantization parameter of the macroblock included in the current frame.
In one embodiment, the macroblock quantization range is determined based on a target mean and a set difference, the target mean being determined based on quantization parameters of a video frame a set number of frames before the current frame.
In this embodiment, the target average value may be considered as an average value of macroblock-level quantization parameters of video frames of a set number of frames preceding the current frame, and the set number of frames is not limited. Optionally, the target average value is an average value of quantization parameters of macro blocks included in each video frame. That is, the target average value may be an average value of quantization parameters of macro blocks included in each video frame in the set frame before the current frame. For example, the target average value may be an average value of quantization parameters of macro blocks included in each video frame of 15 frames preceding the current frame.
The set difference may refer to the maximum difference acceptable between the macroblock-level quantization parameter of the included macroblock of the current frame and the target mean, and the set difference may be obtained from an empirical value.
Specifically, the macroblock quantization range can be determined based on the target mean value and the set difference value, and on the basis, the macroblock quantization range is accurately determined, and a basis is provided for subsequent constraint of the value of the target quantization parameter.
For example, a sliding window average calculation may be performed on a macroblock quantization parameter over a period of time in units of each macroblock. Specifically, the average value of the macroblock-level quantization parameters corresponding to 15P frames before all macroblocks of the current frame (e.g., I frame) may be calculated through a sliding window with a size of 15, and then controlled through a qpDelta parameter (i.e., a set difference value), where the qpDelta parameter may be the difference between the macroblock quantization parameters of the I frame and the average value of the macroblock quantization parameters of the first 15P frames, and qpDelta represents the maximum tolerated difference value. At this time, the average quantization parameter of the first 15P-frame macroblocks is denoted as qpu, and the range of the I-frame macroblock level quantization parameter [ qpu-qpDelta, qpu +qpdelta ], i.e., the macroblock quantization range, can be obtained.
And S140, encoding the current frame based on the target quantization parameter.
After the target quantization parameter is obtained, the current frame may be encoded based on the target quantization parameter.
According to the video coding method provided by the embodiment of the application, the frame level quantization parameter of the current frame is determined according to the frame size of the current frame and the current space information; determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters; determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame; the current frame is encoded based on the target quantization parameter. According to the method, the frame-level quantization parameter of the current frame can be determined according to the frame size of the current frame and the current space information, so that the macro-block-level quantization parameter and the target quantization parameter of the macro block included in the current frame are sequentially determined, the current frame is encoded based on the target quantization parameter, and the respiratory effect in video encoding caused by the large change of the quantization parameter can be restrained.
In one embodiment, determining the target quantization parameter of the macroblock included in the current frame according to the macroblock-level quantization parameter and the macroblock quantization range includes:
determining the macro-block level quantization parameter as a target quantization parameter when the macro-block level quantization parameter is within the macro-block quantization range;
when the macro-block level quantization parameter is larger than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the largest value in the macro-block quantization range as a target quantization parameter;
and when the macro-block level quantization parameter is smaller than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the minimum value in the macro-block quantization range as a target quantization parameter.
It can be appreciated that when the macroblock-level quantization parameter is located within the macroblock quantization range, the macroblock-level quantization parameter may be considered as a quantization parameter expected when the current frame is encoded, and at this time, the macroblock-level quantization parameter may be determined as a target quantization parameter; when the macro-block level quantization parameter is larger than each quantization parameter in the macro-block quantization range, the obtained macro-block level quantization parameter is larger than the macro-block quantization range, and the quantization parameter with the largest value in the macro-block quantization range is required to be determined as the target quantization parameter; when the macroblock-level quantization parameter is smaller than each quantization parameter in the macroblock quantization range, it is indicated that the obtained macroblock-level quantization parameter is smaller than the macroblock quantization range, and at this time, the quantization parameter with the smallest value in the macroblock quantization range can be determined as the target quantization parameter. On the basis, the target quantization parameter is determined by comparing the specific numerical value of the macro-block quantization parameter with the macro-block quantization range, so that the accuracy of the target quantization parameter is further improved.
Illustratively, if qpx (i.e., macroblock-level quantization parameter) lies within the [ qpu-qpDelta, qpu +qpdelta ] interval (i.e., macroblock quantization range), qpx can be considered to be the desired qp value (i.e., target quantization parameter), then qpx can be directly used for encoding; if qpx < qpu-qpDelta, qpu-qpDelta is used as the final qp (i.e., target quantization parameter) to participate in encoding; if qpx > qpu +qpdelta, qpu +qpdelta is used as the final qp to participate in encoding.
As can be seen from the above description, the video encoding method provided by the embodiment of the present application can encode the I frame according to the obtained target quantization parameter, so as to avoid respiratory effect caused by overlarge difference in picture quality between the P frame and the I frame. In addition, the embodiment of the application can be applied to the RTC field, and the RTC field has the characteristics of low delay and high frame rate, and is required to be calculated quickly, so that the real-time performance and the high frame rate are ensured.
Fig. 2 is a flowchart of a video encoding method according to an embodiment of the present application, where the embodiment is optimized based on the above embodiments. In this embodiment, determining the frame level quantization parameter of the current frame according to the frame size and the current spatial information of the current frame is further specified as: the frame level quantization parameter of the current frame is determined based on a predetermined index and relationship, a frame size of the current frame, and current spatial information.
As shown in fig. 2, the method includes:
s210, determining a frame level quantization parameter of the current frame based on a predetermined index and relation, the frame size of the current frame and the current space information.
The predetermined index and relationship may be regarded as a relationship of a predetermined frame size of the current frame, current spatial information, and a frame-level quantization parameter of the current frame, which is expressed as the index and relationship. Specifically, the determination of the frame-level quantization parameter of the current frame may be performed based on a predetermined index and relationship, the frame size of the current frame, and the current spatial information.
The predetermined index and relation are not limited to specific steps, for example, the relation between the Size of the I frame (i.e. the frame Size of the current frame) and si (i.e. the current spatial information) and qp (i.e. the frame level quantization parameter of the current frame) can be simulated by massive video data of a specific scene, and then the formula size=a×si×e can be obtained by data fitting b*qp +c*e d*qp I.e., a predetermined index and relationship, wherein a, b, c, d may be a data fit.
S220, determining macro block level quantization parameters of macro blocks included in the current frame according to the frame level quantization parameters.
S230, determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and the macro block quantization range, wherein the macro block quantization range is determined based on video frames with set frame numbers before the current frame.
S240, encoding the current frame based on the target quantization parameter.
The embodiment of the application provides a video coding method, which is used for determining a frame level quantization parameter of a current frame based on a predetermined index and relation, the frame size of the current frame and current space information; determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters; determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame; the current frame is encoded based on the target quantization parameter. By utilizing the method, the frame-level quantization parameter of the current frame is determined based on the predetermined index and relation, the frame size of the current frame and the current space information, so that the accuracy of the target quantization parameter of the macro block included in the current frame is improved, and the respiratory effect can be effectively reduced.
Fig. 3 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present application, as shown in fig. 3, the apparatus includes:
a first determining module 310, configured to determine a frame level quantization parameter of the current frame according to the frame size and the current spatial information of the current frame;
a second determining module 320, configured to determine a macroblock-level quantization parameter of a macroblock included in the current frame according to the frame-level quantization parameter;
a third determining module 330, configured to determine a target quantization parameter of a macroblock included in the current frame according to the macroblock-level quantization parameter and a macroblock quantization range, where the macroblock quantization range is determined based on a video frame of a set frame number before the current frame;
an encoding module 340, configured to encode the current frame based on the target quantization parameter.
According to the video coding device provided by the embodiment of the application, the first determining module 310 determines the frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information; determining, by the second determining module 320, macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters; determining, by the third determining module 330, a target quantization parameter of a macroblock included in the current frame according to the macroblock-level quantization parameter and a macroblock quantization range, wherein the macroblock quantization range is determined based on a video frame of a set frame number before the current frame; the current frame is encoded based on the target quantization parameter by an encoding module 340. By using the device, the frame-level quantization parameter of the current frame can be determined according to the frame size and the current space information of the current frame, and then the macro-block-level quantization parameter and the target quantization parameter of the macro block included in the current frame are sequentially determined, the current frame is encoded based on the target quantization parameter, and the respiratory effect in video encoding caused by the large change of the quantization parameter can be restrained.
Optionally, the frame size is a set multiple of a current target code rate, where the current target code rate is determined based on a current network transmission state.
Optionally, the first determining module 310 includes:
the frame level quantization parameter of the current frame is determined based on a predetermined index and relationship, a frame size of the current frame, and current spatial information.
Optionally, the macroblock quantization range is determined based on a target average value and a set difference value, and the target average value is determined based on a quantization parameter of a video frame of a set frame number before the current frame.
Optionally, the target average value is an average value of quantization parameters of macro blocks included in each video frame.
Optionally, the third determining module 330 includes:
determining the macro-block level quantization parameter as a target quantization parameter when the macro-block level quantization parameter is within the macro-block quantization range;
when the macro-block level quantization parameter is larger than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the largest value in the macro-block quantization range as a target quantization parameter;
and when the macro-block level quantization parameter is smaller than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the minimum value in the macro-block quantization range as a target quantization parameter.
Optionally, the second determining module 320 includes:
determining a quantization parameter difference for each macroblock of the current frame;
for each macroblock, a difference value of the frame-level quantization parameter and the corresponding quantization parameter difference is determined as a macroblock-level quantization parameter for the macroblock.
The video coding device provided by the embodiment of the application can execute the video coding method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 4 is a schematic structural diagram of an electronic device implementing a video encoding method according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as method video encoding.
In some embodiments, the method video encoding may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more of the steps of the method video encoding described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the method video encoding in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present application, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present application are achieved, and the present application is not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.
Claims (10)
1. A video encoding method, comprising:
determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information;
determining macroblock-level quantization parameters of the included macroblocks of the current frame according to the frame-level quantization parameters;
determining target quantization parameters of macro blocks included in the current frame according to the macro block level quantization parameters and a macro block quantization range, wherein the macro block quantization range is determined based on a video frame of a set frame number before the current frame;
the current frame is encoded based on the target quantization parameter.
2. The method of claim 1, wherein the frame size is a set multiple of a current target code rate, the current target code rate being determined based on a current network transmission state.
3. The method of claim 1, wherein determining the frame-level quantization parameter of the current frame based on the frame size of the current frame and the current spatial information comprises:
the frame level quantization parameter of the current frame is determined based on a predetermined index and relationship, a frame size of the current frame, and current spatial information.
4. The method of claim 1, wherein the macroblock quantization range is determined based on a target mean and a set difference, the target mean being determined based on quantization parameters of a video frame a set number of frames prior to the current frame.
5. The method of claim 4, wherein the target mean is a mean of quantization parameters of macroblocks included in each of the video frames.
6. The method of claim 1, wherein determining the target quantization parameter for the macroblock included in the current frame based on the macroblock-level quantization parameter and macroblock quantization range comprises:
determining the macro-block level quantization parameter as a target quantization parameter when the macro-block level quantization parameter is within the macro-block quantization range;
when the macro-block level quantization parameter is larger than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the largest value in the macro-block quantization range as a target quantization parameter;
and when the macro-block level quantization parameter is smaller than each quantization parameter in the macro-block quantization range, determining the quantization parameter with the minimum value in the macro-block quantization range as a target quantization parameter.
7. The method of claim 1, wherein determining macroblock-level quantization parameters for included macroblocks of the current frame based on the frame-level quantization parameters comprises:
determining a quantization parameter difference for each macroblock of the current frame;
for each macroblock, a difference value of the frame-level quantization parameter and the corresponding quantization parameter difference is determined as a macroblock-level quantization parameter for the macroblock.
8. A video encoding apparatus, comprising:
the first determining module is used for determining a frame level quantization parameter of the current frame according to the frame size of the current frame and the current space information;
a second determining module, configured to determine a macroblock-level quantization parameter of a macroblock included in the current frame according to the frame-level quantization parameter;
a third determining module, configured to determine, according to the macroblock-level quantization parameter and a macroblock quantization range, a target quantization parameter of a macroblock included in the current frame, where the macroblock quantization range is determined based on a video frame of a set frame number before the current frame;
and the encoding module is used for encoding the current frame based on the target quantization parameter.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the video encoding method of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the video encoding method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210533395.6A CN117097904A (en) | 2022-05-13 | 2022-05-13 | Video coding method, device, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210533395.6A CN117097904A (en) | 2022-05-13 | 2022-05-13 | Video coding method, device, electronic equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117097904A true CN117097904A (en) | 2023-11-21 |
Family
ID=88773971
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210533395.6A Pending CN117097904A (en) | 2022-05-13 | 2022-05-13 | Video coding method, device, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117097904A (en) |
-
2022
- 2022-05-13 CN CN202210533395.6A patent/CN117097904A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6615346B2 (en) | Method, terminal, and non-volatile computer-readable storage medium for real-time video noise reduction in encoding process | |
WO2021114846A1 (en) | Video noise cancellation processing method and apparatus, and storage medium | |
CN111918066A (en) | Video encoding method, device, equipment and storage medium | |
CN111182303A (en) | Encoding method and device for shared screen, computer readable medium and electronic equipment | |
KR20220001420A (en) | Method for coding video and related device | |
CN115514960A (en) | Video coding method and device, electronic equipment and storage medium | |
CN114245196B (en) | Screen recording and stream pushing method and device, electronic equipment and storage medium | |
CN110912922B (en) | Image transmission method and device, electronic equipment and storage medium | |
CN116567246A (en) | AVC coding method and device | |
TW201842775A (en) | Systems and methods for deferred post-processes in video encoding | |
CN115174774B (en) | Depth image compression method, device, equipment and storage medium | |
CN117097904A (en) | Video coding method, device, electronic equipment and medium | |
CN116112707A (en) | Video processing method and device, electronic equipment and storage medium | |
US10080032B2 (en) | Lossy channel video blur avoidance | |
CN115767149A (en) | Video data transmission method and device | |
CN117061827B (en) | Image frame processing method, device, equipment and storage medium | |
CN113542737A (en) | Encoding mode determining method and device, electronic equipment and storage medium | |
CN115190309B (en) | Video frame processing method, training device, video frame processing equipment and storage medium | |
CN118042139A (en) | Data transmission method, data processing method, device and equipment | |
CN113824985B (en) | Live streaming method, apparatus, device, storage medium and computer program product | |
CN117676239A (en) | Video transmission method, device, equipment and medium | |
CN117354526A (en) | Image coding method, device and medium | |
CN115661273B (en) | Motion vector prediction method, motion vector prediction device, electronic equipment and storage medium | |
CN117528141A (en) | Video encoding method, video encoding device, electronic device, storage medium, and program product | |
CN117376607A (en) | Video code stream processing method, device, equipment and medium |
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 |