Video coding method and device, equipment, storage medium and program product
By adjusting the frame-level quantization parameters of video frames and determining the row-level quantization parameters, the problem of large fluctuations in frame-level code rate in the existing technology is solved, and more stable code rate control is achieved, reducing video playback lags and improving users The video view.
Patent Information
- Application Number
- CN202411428645.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-14
AI Technical Summary
In the existing video encoding methods, there are large fluctuations in frame-level code rates and cannot be applied to real-time communication scenarios, which can easily cause lag in video playback and affect the user's video viewing.
By adjusting the frame-level quantization parameters of the video frame, determining the row-level quantization parameters based on this parameter, and adding row-level code rate control to improve the stability of the frame-level code rate.
It achieves a more stable and closer to the target code rate at the frame level, reduces the stuttering of video playback in real-time communication scenarios, and ensures the smooth video viewing of users.
Smart Images

Figure CN119450060A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of video processing technology, and in particular to a video encoding method, apparatus, device, storage medium, and program product. Background Art
[0002] At present, the video transmission process is often limited by the network bandwidth. In order to effectively transmit video data while meeting the channel bandwidth and transmission delay restrictions, and to ensure a stable video bit rate and image quality, it is necessary to control the bit rate of the video encoding process, thereby fully utilizing the bandwidth and avoiding freezes during video playback.
[0003] In the related technology, commonly used rate control algorithms include CBR (Constant Bit Rate) algorithm, VBR (Variable Bit Rate) algorithm and ABR (Average Bit Rate) algorithm, etc. The aforementioned rate control algorithms can be combined with VBV (Video Buffering Verifier) tool for rate control to ensure that VBV will not overflow or underflow, so that the actual output rate is close to the target rate. However, in the video encoding process, the frame-level rate output by the relevant rate control algorithm still has large fluctuations, which cannot be applied to real-time communication scenarios, and is prone to causing video playback jams, affecting the user's video viewing experience, and needs to be improved. Summary of the invention
[0004] The embodiments of the present application provide a video encoding method, apparatus and device, which solve the problem that the frame-level bit rate output by the application-related bit rate control algorithm still has large fluctuations, cannot be applied to real-time communication scenarios, and easily causes video playback jams, affecting the user's video viewing experience. By effectively adjusting the frame-level quantization parameters of the current video frame, and determining the row-level quantization parameters based on the frame-level quantization parameters, further refining the regulated quantization parameters, and adding the row-level bit rate control function, it is beneficial to improve the stability of the frame-level bit rate, so that the actual encoding bit rate is more stable and close to the target bit rate, reducing the jams in video playback in real-time communication scenarios, and ensuring the user's smooth video viewing experience.
[0005] In a first aspect, an embodiment of the present application provides a video encoding method, the method comprising:
[0006] In the process of encoding a video frame sequence, when a current video frame is a key frame or a forward prediction frame, determining a frame-level quantization parameter of the current video frame according to a frame-level complexity of the current video frame and a first encoding bit number of a processed video frame;
[0007] Determining a first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity, and a set frame-level bit estimation parameter;
[0008] When the first predicted coding bit number is not within the set bit number threshold interval, adjusting the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval;
[0009] The row-level quantization parameter of each to-be-encoded row in the current video frame is determined based on the adjusted frame-level quantization parameter, and each to-be-encoded row is encoded based on the row-level quantization parameter.
[0010] In a second aspect, an embodiment of the present application further provides a video encoding device, the device comprising:
[0011] A first quantization parameter calculation module is configured to determine a frame-level quantization parameter of the current video frame according to a frame-level complexity of the current video frame and a first number of encoding bits of a processed video frame in a process of encoding a video frame sequence, when the current video frame is a key frame or a forward prediction frame;
[0012] A coding bit number calculation module, configured to determine a first predicted coding bit number of the current video frame according to the frame level quantization parameter, the frame level complexity and a set frame level bit estimation parameter;
[0013] A second quantization parameter calculation module is configured to adjust the frame-level quantization parameter when the first predicted coding bit number is not within a set bit number threshold interval, so that the re-determined first predicted coding bit number is within the bit number threshold interval;
[0014] The encoding module is configured to determine a row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encode each to-be-encoded row based on the row-level quantization parameter.
[0015] In a third aspect, an embodiment of the present application further provides a video encoding device, the device comprising:
[0016] one or more processors;
[0017] a storage device configured to store one or more programs,
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the video encoding method described in the embodiment of the present application.
[0019] In a fourth aspect, an embodiment of the present application further provides a non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the video encoding method described in the embodiment of the present application when executed by a computer processor.
[0020] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device executes the video encoding method described in the embodiment of the present application.
[0021] In an embodiment of the present application, during the process of encoding a video frame sequence, when the current video frame is a key frame or a forward predicted frame, the frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first number of encoded bits of the processed video frame; the first predicted number of encoded bits of the current video frame is determined according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter; when the first predicted number of encoded bits is not within the set bit number threshold interval, the frame-level quantization parameter is adjusted so that the re-determined first predicted number of encoded bits is within the bit number threshold interval; based on the adjusted frame-level quantization parameter, the row-level quantization parameter of each to-be-encoded row in the current video frame is determined, and each to-be-encoded row is encoded based on the row-level quantization parameter. In the above scheme, by determining the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter, the predicted coding size of the current video frame can be effectively estimated. By continuously adjusting the frame-level quantization parameter corresponding to the current video frame based on the comparison result of the first predicted coding bit number and the set bit number threshold interval, and re-determining the first predicted coding bit number until the first predicted coding bit number is in the bit number threshold interval, the frame-level quantization parameter of the current video frame is effectively adjusted, and the row-level quantization parameter is determined based on the frame-level quantization parameter. The quantization parameter is further refined and regulated, and the row-level bit rate control function is added, which can improve the stability of the frame-level bit rate, make the actual coding bit rate more stable and close to the target bit rate, reduce the jamming of video playback in real-time communication scenarios, and ensure the user's smooth video viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flowchart of a video encoding method provided in an embodiment of the present application;
[0023] Figure 2 A flowchart of a video encoding method including a process of adjusting a frame-level quantization parameter provided in an embodiment of the present application;
[0024] Figure 3A flowchart of a video encoding method including a process of encoding a current video frame provided in an embodiment of the present application;
[0025] Figure 4 A flowchart of a video encoding method including a process of adjusting a first row-level quantization parameter provided in an embodiment of the present application;
[0026] Figure 5 A flowchart of a video encoding method provided by an embodiment of the present application, including a process of adjusting a first row-level quantization parameter by referring to a maximum quantization parameter threshold and a minimum quantization parameter threshold corresponding to a current row to be encoded;
[0027] Figure 6 A structural block diagram of a video encoding device provided in an embodiment of the present application;
[0028] Figure 7 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than to limit the embodiments of the present application. It should also be noted that, for ease of description, only parts related to the embodiments of the present application are shown in the accompanying drawings, rather than all structures.
[0030] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0031] The video encoding method provided in the embodiment of the present application can be applied to the video encoding process, by estimating the predicted coding bit number of the current video frame, and adjusting the frame-level quantization parameter so that the predicted coding bit number is in the bit number threshold interval based on the size comparison result of the predicted coding bit number and the set bit number threshold interval, and determining the row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encoding each of the to-be-encoded rows based on the row-level quantization parameter, thereby achieving a more stable bit rate control and reducing frame-level bit rate fluctuations. Relevant real-time communication scenarios may include: video conferencing, video calls, and indoor and outdoor live broadcasts. The aforementioned several application scenarios are only exemplary and explanatory. In practical applications, the video encoding method can also be used in video encoding in other scenarios, and the embodiment of the present application does not limit this. The video encoding method, device, equipment, storage medium and program product provided in the embodiment of the present application are intended to solve the problem that the frame-level bit rate output by the relevant bit rate control algorithm still has large fluctuations, cannot be applied to real-time communication scenarios, and easily causes video playback jams, affecting the user's video viewing experience.
[0032] In the video encoding method provided in the embodiment of the present application, the executor of each step can be a computer device, which refers to any electronic device with data calculation, processing and storage capabilities, such as PC (Personal Computer), tablet computer and other terminal devices, and can also be servers and other devices, which are not limited in the embodiment of the present application.
[0033] Figure 1 A flowchart of a video encoding method provided in an embodiment of the present application. Figure 1 As shown, the following steps are included:
[0034] Step S101, during encoding of a video frame sequence, when the current video frame is a key frame or a forward prediction frame, a frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame.
[0035] Among them, the video frame sequence can be composed of multiple video frames in a continuous order, and the multiple video frames can include one or more of key frames, forward prediction frames and bidirectional prediction frames. In the embodiment of the present application, different rate control strategies are adopted for video frames of different frame types. In the case where the current video frame is a bidirectional prediction frame, in order to avoid a large difference in quantization parameters between the bidirectional prediction frame and the front and back reference frames, a smooth transition is achieved in time. In one embodiment, if the current video frame is a bidirectional prediction frame, the corresponding frame-level quantization parameter can be determined by referring to the adjacent encoded key frames or forward prediction frames. For example, the corresponding frame-level quantization parameter can be obtained by interpolating the frame-level quantization parameters of the two forward prediction frames referenced before and after. Specifically, it can be determined according to the time distance between the bidirectional prediction frame and the two forward prediction frames referenced before and after, and the interpolation weights corresponding to the two frame-level quantization parameters of the reference are respectively determined, and the frame-level quantization parameter of the bidirectional prediction frame is obtained by weighted calculation. In the case where the current video frame is a key frame or a forward prediction frame, the frame-level quantization parameter can be adjusted in combination with the predicted coding bit number of the current video frame, which is conducive to controlling the actual coding bit number of the current video frame within a reasonable range and stabilizing the frame-level bit rate of the output video. Among them, the frame-level complexity is used to measure the content complexity of the current video frame, and can be a related calculation result obtained by pre-processing the video frame sequence. For example, the SATD (Sum of Absolute Transformed Difference) of the current video frame can be calculated as the frame-level complexity. The SATD is the sum of the absolute values of the residuals after the prediction coding and the original image after the Hadamard transform. For another example, the SAD (Sum of Absolute Differences) of the current video frame can be calculated as the frame-level complexity. The SAD is the sum of the absolute values of the residuals after the prediction coding and the original image. The first coding bit number can be the sum of the bits occupied by the encoded video frames, which is used to determine the number of allocable bits for subsequent video encoding, reflecting the usage of encoding resources. Among them, for frame-level complexity, a higher frame-level complexity may require the allocation of a relatively large quantization parameter, and a lower frame-level complexity may require the allocation of a relatively small quantization parameter, and for the first number of coding bits, the smaller the difference between the first number of coding bits and the target number of bits, the smaller the adjustment range of the quantization parameter, and the larger the difference between the first number of coding bits and the target number of bits, the larger the adjustment range of the quantization parameter. By comprehensively considering the frame-level complexity and the first number of coding bits, the frame-level quantization parameter of the current video frame can be reasonably estimated. In one embodiment, a mathematical statistical model constructed based on empirical data can be provided, and the frame-level complexity of the current video frame and the first number of coding bits are input into the mathematical statistical model to obtain the frame-level quantization parameter of the current video frame.
[0036] Step S102: determining a first predicted coding bit number of the current video frame according to a frame-level quantization parameter, a frame-level complexity and a set frame-level bit estimation parameter.
[0037] Among them, the frame-level quantization parameter determines the degree to which the pixel value is quantized during the encoding process of the current video frame. A smaller frame-level quantization parameter will retain more image details, but will increase the number of bits after encoding; a larger frame-level quantization parameter will reduce the number of bits, but may lose image quality. Frame-level complexity reflects the complexity of the content of the current video frame. The higher the frame-level complexity, the more details, textures and motions are usually contained in the video frame, and the number of bits for encoding needs to be reduced. The lower the frame-level complexity, the flatter the content in the video frame, and the more bits for encoding need to be increased. The frame-level bit estimation parameter is set to more accurately estimate the first predicted coding bit number of the current video frame, and can be set to adapt to different coding standards, video content characteristics and specific application scenarios, which are not limited in this application. Among them, the calculation of the first predicted coding bit number can be based on a mathematical model pre-established by an empirical formula, statistical analysis or machine learning algorithm. In one embodiment, the relevant formula for calculating the first predicted coding bit number can be: first predicted coding bit number = a1×frame level complexity + b1×frame level quantization parameter + c1, where a1, b1, and c1 are set frame-level bit estimation parameters. In one embodiment, the relevant formula for calculating the first predicted coding bit number may be:
[0038] framesizePlanned=(coeff*frameSatd+offset) / qscale,
[0039]
[0040] Among them, framesizePlanned is the first predicted coding bit number, frameSatd is the frame level complexity, frameQP is the frame level quantization parameter, coeff and offset are both frame level bit estimation parameters, coeff is used to adjust the influence of frame level complexity on bit number estimation, offset is used to compensate for system deviation or provide a compensation value that is not related to frame level complexity but affects the bit number. The specific setting can be adaptively made by the developer according to the video content characteristics and expected bit rate requirements in the actual application scenario, and this application is not limited here.
[0041] Step S103: When the first predicted coding bit number is not within the set bit number threshold interval, the frame level quantization parameter is adjusted to make the re-determined first predicted coding bit number within the bit number threshold interval.
[0042] Among them, the bit number threshold interval can be used to provide a reasonable prediction range for the first predicted coding bit number, so as to avoid the phenomenon that the buffer of the video buffer verifier underflows or overflows due to the first predicted coding bit number being too large or too small, thereby affecting the stability of video playback. Optionally, the bit number threshold interval can be set according to the buffer state parameter of the video buffer verifier and the target encoding bit rate. For example, the corresponding bit number when the buffer of the video buffer verifier is in a full state is set to bufferFill, and the target encoding bit rate is bufferRate. Correspondingly, the upper limit threshold of the bit number threshold interval can be set to bufferFill×k1, and the value range of k1 is (0,1). The lower limit threshold of the bit number threshold interval can be set to max(bufferFill×k2,bufferRate×k3), and max() is a maximum value function, and the value range of k2 is (0,k1), and the value range of k3 is (0,k1). Optionally, corresponding bit number threshold intervals can be set for the data volume characteristics of video frames of different frame types. In one embodiment, if the current video frame is a key frame and the corresponding data volume is relatively large, the upper threshold of the bit number threshold interval can be set to bufferFill×0.6, and the lower threshold of the bit number threshold interval can be set to max(bufferFill×0.3, bufferRate×0.5), so as to reasonably reduce the frame size of the key frame and improve the video playback rate. In one embodiment, if the current video frame is a forward prediction frame and the corresponding data volume is relatively small, the upper threshold of the bit number threshold interval can be set to bufferFill×0.8, and the lower threshold of the bit number threshold interval can be set to max(bufferFill×0.5, bufferRate×0.5). Of course, the specific threshold settings of the aforementioned bit number threshold interval are only exemplary descriptions, and developers can make adaptive adjustments based on the network environment and transmission requirements in the actual application scenario, which is not limited in this application. In one embodiment, if the first predicted coding bit number is greater than the upper threshold of the bit number threshold interval, the frame-level quantization parameter can be adjusted up multiple times according to the set amplitude, and after each increase, the first predicted coding bit number is re-determined based on the increased frame-level quantization parameter, frame-level complexity and the set frame-level bit estimation parameter, until the first predicted coding bit number is reduced to within the bit number threshold interval, and the increase of the frame-level quantization parameter is terminated, thereby avoiding underflow of the buffer of the video buffer verifier.In one embodiment, if the first predicted coding bit number is less than the lower limit threshold of the bit number threshold interval, the frame-level quantization parameter can be adjusted down multiple times according to the set amplitude, and after each adjustment, the first predicted coding bit number is re-determined according to the adjusted frame-level quantization parameter, frame-level complexity and the set frame-level bit estimation parameter, until the first predicted coding bit number increases to be within the bit number threshold interval, and the frame-level quantization parameter is adjusted down, thereby avoiding overflow of the buffer of the video buffer verifier. Therefore, by adjusting the frame-level quantization parameter so that the first predicted coding bit number is within the bit number threshold interval, it can be ensured that the buffer of the video buffer verifier will not overflow or underflow, thereby ensuring that the actual encoding bit rate is close to the target bit rate and reducing frame-level bit rate fluctuations.
[0043] Step S104: determining a row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encoding each to-be-encoded row based on the row-level quantization parameter.
[0044] In one embodiment, during the encoding process of the current video frame, the row-level quantization parameter of the first encoding row can be set as the frame-level quantization parameter, and the corresponding row-level encoding quantization parameters of other encoding rows are determined according to their corresponding row-level complexity, the number of encoded bits of the current encoding frame, and the row-level quantization parameter of the previous row. Then, during the encoding process of each encoding row, the row-level quantization parameter can be adjusted according to the spatiotemporal complexity of the current encoding block to obtain the block-level quantization parameter of the current encoding block, and the current encoding block is encoded based on the block-level quantization parameter.
[0045] In the above, in the process of encoding a video frame sequence, when the current video frame is a key frame or a forward predicted frame, the frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first coding bit number of the processed video frame; the first predicted coding bit number of the current video frame is determined according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter; when the first predicted coding bit number is not within the set bit number threshold interval, the frame-level quantization parameter is adjusted so that the re-determined first predicted coding bit number is within the bit number threshold interval; and the current video frame is encoded based on the adjusted frame-level quantization parameter. In the above scheme, by determining the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter, the predicted coding size of the current video frame can be effectively estimated. By continuously adjusting the frame-level quantization parameter corresponding to the current video frame based on the comparison result of the first predicted coding bit number and the set bit number threshold interval, and re-determining the first predicted coding bit number until the first predicted coding bit number is in the bit number threshold interval, the frame-level quantization parameter of the current video frame is effectively adjusted, and the row-level quantization parameter is determined based on the frame-level quantization parameter. The quantization parameter is further refined and regulated, and the row-level bit rate control function is added, which can improve the stability of the frame-level bit rate, make the actual coding bit rate more stable and close to the target bit rate, reduce the jamming of video playback in real-time communication scenarios, and ensure the user's smooth video viewing experience.
[0046] Figure 2 A flowchart of a video encoding method including a process of adjusting a frame-level quantization parameter is provided in an embodiment of the present application. Figure 2 As shown, the following steps are included:
[0047] Step S201, during encoding of a video frame sequence, when the current video frame is a key frame or a forward prediction frame, a frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame.
[0048] Step S202: Determine the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter.
[0049] Step S203: When the first predicted coding bit number is not within the set bit number threshold interval and the first predicted coding bit number is greater than the upper limit threshold of the bit number threshold interval, based on the ratio of the first predicted coding bit number to the upper limit threshold, increase the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0050] Among them, if the first predicted coding bit number is greater than the upper threshold of the bit number threshold interval, it can be regarded that the coding bit number of the current video frame is too large, which may cause the buffer of the video buffer verifier to underflow, and the frame-level quantization parameter needs to be adjusted upward, thereby reducing the coding bit number of the current video frame. Since the first predicted coding bit number is greater than the upper threshold, the ratio of the first predicted coding bit number to the upper threshold can effectively measure the degree of deviation of the first predicted coding bit number relative to the upper threshold. Therefore, in one embodiment, the ratio of the first predicted coding bit number to the upper threshold can be set as the upward adjustment coefficient of the frame-level quantization parameter, and the ratio is multiplied by the frame-level quantization parameter to obtain a new frame-level quantization parameter, so as to achieve the purpose of appropriately adjusting the frame-level quantization parameter. Since after the frame-level quantization parameter is increased, the re-determined first predicted coding bit number is constantly approaching the upper threshold, and therefore, the ratio of the first predicted coding bit number to the upper threshold is also synchronously reduced, so as to achieve reasonable dynamic control of the upward adjustment amplitude of the frame-level quantization parameter, and adapt to the numerical value change of the first predicted coding bit number. In one embodiment, the upward adjustment amplitude corresponding to the ratio of the first predicted coding bit number to the upper limit threshold can be matched according to a preset mapping relationship, and the upward adjustment amplitude can be added to the frame-level quantization parameter to obtain a new frame-level quantization parameter, so as to achieve the purpose of appropriately increasing the frame-level quantization parameter.
[0051] Step S204: When the first predicted coding bit number is not within the set bit number threshold interval and the first predicted coding bit number is less than the lower limit threshold of the bit number threshold interval, based on the ratio of the first predicted coding bit number to the lower limit threshold, lower the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0052] Among them, if the first predicted coding bit number is less than the lower limit threshold of the bit number threshold interval, it can be regarded that the coding bit number of the current video frame is too small, which may cause the buffer of the video buffer verifier to overflow, and the frame-level quantization parameter needs to be lowered, thereby increasing the coding bit number of the current video frame. Since the first predicted coding bit number is less than the lower limit threshold, the ratio of the first predicted coding bit number to the lower limit threshold can effectively measure the degree of deviation of the first predicted coding bit number relative to the lower limit threshold. Therefore, in one embodiment, the ratio of the first predicted coding bit number to the lower limit threshold can be set as the downward adjustment coefficient of the frame-level quantization parameter, and the ratio is multiplied by the frame-level quantization parameter to obtain a new frame-level quantization parameter, so as to achieve the purpose of appropriately lowering the frame-level quantization parameter. Since after lowering the frame-level quantization parameter, the re-determined first predicted coding bit number is constantly approaching the lower limit threshold, therefore, the ratio of the first predicted coding bit number to the lower limit threshold is also synchronously increased, so as to achieve reasonable dynamic control of the downward adjustment amplitude of the frame-level quantization parameter, and adapt to the numerical size change of the first predicted coding bit number. In one embodiment, the downward adjustment amplitude corresponding to the ratio of the first predicted coding bit number to the lower limit threshold can be matched according to a preset mapping relationship, and the downward adjustment amplitude can be added to the frame level quantization parameter to obtain a new frame level quantization parameter, so as to achieve the purpose of appropriately lowering the frame level quantization parameter.
[0053] Step S205 : determining a row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encoding each to-be-encoded row based on the row-level quantization parameter.
[0054] As described above, by based on the ratio of the first predicted coding bit number to the upper threshold or the lower threshold, the upward adjustment range or downward adjustment range of the frame-level quantization parameter can be reasonably determined, which is conducive to smooth adjustment of the frame-level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold range.
[0055] Figure 3 A flowchart of a video encoding method including a process of encoding a current video frame is provided in an embodiment of the present application. Figure 3 As shown, the following steps are included:
[0056] Step S301, during encoding of a video frame sequence, when the current video frame is a key frame or a forward prediction frame, a frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame.
[0057] Step S302: Determine the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter.
[0058] Step S303: When the first predicted coding bit number is not within the set bit number threshold interval, adjust the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0059] Step S304: determine the second predicted number of coding bits for the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second number of coding bits of the encoded row, wherein the initial value of the first row-level quantization parameter is the second row-level quantization parameter of the previous encoded row, and the row-level quantization parameter of the first encoded row of the current video frame is the adjusted frame-level quantization parameter.
[0060] Among them, the row-level quantization parameter of the first coding line of the current video frame can be set to the adjusted frame-level quantization parameter, and the first coding line is encoded based on the row-level quantization parameter. Starting from the second coding line of the current video frame, the initial value of the first row-level quantization parameter corresponding to the current coding line can be set to be the same as the second row-level quantization parameter of the previous coded line, and adjusted on the basis of the initial value. The row-level quantization parameter determines the degree of quantization of the pixel value in the encoding process of the current coding line. The smaller the row-level quantization parameter, the more bits after encoding; the larger the row-level quantization parameter, the less bits after encoding. The row-level complexity is used to measure the content complexity of the current coding line, which can be the SATD, SAD, etc. corresponding to the current coding line obtained by pre-processing, which is not limited in this application. The row-level complexity reflects the content complexity of the current coding line. When the row-level quantization parameter is fixed, the higher the row-level complexity, the more bits are required for encoding, and the lower the row-level complexity, the fewer bits are required for encoding. The row-level bit estimation parameter is set to more accurately estimate the predicted coding bit number of the current row to be encoded, and can be set to adapt to different encoding standards, video content characteristics and specific application scenarios, which are not limited in this application. The second predicted coding bit number is the frame size of the current video frame re-estimated before encoding the current row to be encoded, and is reasonably combined with the encoded part of the current video frame and the row-level quantization parameter of the current row to be encoded to re-estimate, effectively reflecting the frame size change of the current video frame during the encoding process.
[0061] In one embodiment, according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second encoding bit number of the encoded row, the specific process of determining the second predicted encoding bit number of the current video frame is as follows:
[0062] According to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter and the set row-level bit estimation parameter, the third predicted coding bit number of the unencoded row is determined; the second coding bit number of the encoded row is added to the third predicted coding bit number to obtain the second predicted coding bit number of the current video frame.
[0063] Optionally, the predicted number of coding bits of the current row to be encoded can be calculated, and the predicted number of coding bits can be used as the predicted number of coding bits of each remaining uncoded row. Optionally, the predicted number of coding bits of the current row to be encoded can be calculated, and the difference between the average row-level complexity of other uncoded rows and the row-level complexity corresponding to the current row to be encoded can be calculated, and the predicted number of coding bits of the current row to be encoded can be used as a benchmark, and adjustments can be made based on the difference to obtain the predicted number of coding bits of other uncoded rows.
[0064] The calculation of the predicted number of coding bits of the current row to be encoded may be performed based on a mathematical model pre-established by an empirical formula, statistical analysis, or a machine learning algorithm. In one embodiment, the relevant formula for calculating the predicted number of coding bits of the current row to be encoded may be: predicted number of coding bits = a2×row-level complexity + b2×first row-level quantization parameter + c2, where a2, b2, and c2 are set row-level bit estimation parameters. In one embodiment, the relevant formula for calculating the predicted number of coding bits of the current row to be encoded may be:
[0065] predRowSize=(coeff1*rowSatd+offset1) / qscale1,
[0066]
[0067] Among them, predRowSize is the predicted number of coding bits of the current row to be encoded, rowSatd is the row-level complexity of the current row to be encoded, curRowQP is the first row-level quantization parameter, coeff1 and offset1 are both row-level bit estimation parameters, coeff1 is used to adjust the influence of row-level complexity on bit number estimation, offset1 is used to compensate for system deviation or provide a compensation value that is not related to row-level complexity but affects the bit number. The developer can make adaptive settings based on the video content characteristics and expected bit rate requirements in the actual application scenario, and this application is not limited to this.
[0068] Correspondingly, the relevant formula for calculating the second predicted coding bit number may be:
[0069]
[0070] Among them, accFrameBits is the second predicted coding bit number of the current video frame, encodedBits iis the number of bits of the coded row i, predRowSize i is the number of predicted coding bits for the i-th uncoded row.
[0071] Step S305: When the second predicted coding bit number is greater than the first predicted coding bit number, the first row-level quantization parameter is increased based on a preset amplitude so that the re-determined second predicted coding bit number is less than or equal to the first predicted coding bit number, and when the second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and a preset ratio, the current row to be encoded is encoded based on the increased first row-level quantization parameter.
[0072] Among them, if the second predicted coding bit number is greater than the first predicted coding bit number, it may be that the coding bit number of the current video frame is too large, which may cause the buffer of the video buffer verifier to underflow, and it is necessary to increase the first row-level quantization parameter to reduce the coding bit number of the current video frame. For example, the preset amplitude may be 0.5, which is not limited in this application. The first row-level quantization parameter can be increased multiple times according to a preset amplitude, and after each increase, the second predicted number of coding bits is determined again based on the increased first row-level quantization parameter, the row-level complexity corresponding to the current row to be encoded, the set row-level bit estimation parameter, and the second coding bit number quantization parameter of the encoded row, until the second predicted number of coding bits is reduced to less than or equal to the first predicted number of coding bits, and when the second predicted number of coding bits is greater than or equal to the product of the first predicted number of coding bits and the preset ratio, the increase of the first row-level quantization parameter is terminated, thereby avoiding underflow of the buffer of the video buffer verifier and avoiding overflow of the buffer of the video buffer verifier caused by excessive increase of the first row-level quantization parameter, wherein the preset ratio has a value range of (0,1). In order to make the second predicted number of coding bits close to the first predicted number of coding bits, the preset ratio can be set to 0.8, 0.9, etc., which is not limited in this application.
[0073] In the above, by determining the second predicted coding bit number of the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter and the second coding bit number of the encoded row, the frame size of the current video frame in the process of line-by-line encoding can be effectively evaluated, and when the second predicted coding bit number is greater than the first predicted coding bit number, the first row-level quantization parameter is increased, thereby realizing rate control with the addition of a row-level dimension, ensuring that the buffer of the video buffer verifier will not underflow, further improving the stability of the frame-level bit rate, and making the actual encoding bit rate closer to the target bit rate.
[0074] Figure 4 A flowchart of a video encoding method including a process of adjusting a first row-level quantization parameter is provided in an embodiment of the present application. Figure 4 As shown, the following steps are included:
[0075] Step S401, during encoding of a video frame sequence, when the current video frame is a key frame or a forward prediction frame, a frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame.
[0076] Step S402: Determine the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter.
[0077] Step S403: When the first predicted coding bit number is not within the set bit number threshold interval, adjust the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0078] Step S404, determine the second predicted coding bit number of the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second coding bit number of the encoded row, wherein the initial value of the first row-level quantization parameter is the second row-level quantization parameter of the previous encoded row, and the row-level quantization parameter of the first encoded row of the current video frame is the adjusted frame-level quantization parameter.
[0079] Step S405: When the second predicted coding bit number is greater than the first predicted coding bit number, the first row-level quantization parameter is increased based on a preset amplitude so that the re-determined second predicted coding bit number is less than or equal to the first predicted coding bit number, and when the second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and a preset ratio, the current row to be encoded is encoded based on the increased first row-level quantization parameter.
[0080] Step S406: When the second predicted number of coding bits is less than the product of the first predicted number of coding bits and a preset ratio, the first row-level quantization parameter is lowered based on a preset amplitude so that the re-determined second predicted number of coding bits is greater than or equal to the product of the first predicted number of coding bits and the preset ratio, and the current row to be encoded is encoded based on the lowered first row-level quantization parameter.
[0081] Among them, if the second predicted coding bit number is less than the product of the first predicted coding bit number and the preset ratio, it can be regarded that the coding bit number of the current video frame is too small, which may cause the buffer of the video buffer verifier to overflow, and it is necessary to reduce the first row-level quantization parameter, thereby increasing the coding bit number of the current video frame. For example, the preset amplitude can be 0.5, which is not limited in this application. The first row-level quantization parameter can be reduced multiple times according to the preset amplitude, and after each reduction, the second predicted coding bit number is determined again based on the reduced first row-level quantization parameter, the row-level complexity corresponding to the current row to be encoded, the set row-level bit estimation parameter, and the second coding bit number quantization parameter of the encoded row, until the second predicted coding bit number increases to greater than or equal to the product of the first predicted coding bit number and the preset ratio, and the reduction of the first row-level quantization parameter is ended, thereby avoiding underflow of the buffer of the video buffer verifier.
[0082] In the above, when the second predicted coding bit number is less than the product of the first predicted coding bit number and the preset ratio, the first row-level quantization parameter is lowered to ensure that the buffer of the video buffer verifier will not overflow, effectively stabilizing the frame-level bit rate and making the actual coding bit rate closer to the target bit rate.
[0083] Figure 5 A flowchart of a video encoding method provided by an embodiment of the present application includes a process of adjusting the first row-level quantization parameter by referring to the maximum quantization parameter threshold and the minimum quantization parameter threshold corresponding to the current row to be encoded. Figure 5 As shown, the following steps are included:
[0084] Step S501, during encoding of a video frame sequence, when the current video frame is a key frame or a forward prediction frame, a frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame.
[0085] Step S502: Determine the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter.
[0086] Step S503: When the first predicted coding bit number is not within the set bit number threshold interval, adjust the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0087] Step S504, determine the second predicted coding bit number of the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second coding bit number of the encoded row, wherein the initial value of the first row-level quantization parameter is the second row-level quantization parameter of the previous encoded row, and the row-level quantization parameter of the first encoded row of the current video frame is the adjusted frame-level quantization parameter.
[0088] Step S505 : determining a maximum quantization parameter threshold and a minimum quantization parameter threshold corresponding to the current row to be encoded based on the first row-level quantization parameter and the preset step size.
[0089] Wherein, before the adjustment of the first row-level quantization parameter, the first row-level quantization parameter corresponding to the current row to be encoded is the second row-level quantization parameter of the previous encoded row. Therefore, the threshold range of the first row-level quantization parameter is set based on the first row-level quantization parameter before adjustment and the preset step size. It can be regarded as taking the second row-level quantization parameter of the previous encoded row as a reference to reasonably determine the maximum amplitude of the subsequent adjustment of the first row-level quantization parameter of the current row to be encoded, and reduce the difference in quantization parameter values between the current row to be encoded and the previous encoded row. Wherein, the maximum quantization parameter threshold value can be the sum of the initial value of the first row-level quantization parameter and the preset step size, and the minimum quantization parameter threshold value can be the difference between the initial value of the first row-level quantization parameter and the preset step size. For example, the preset step size can be set to 4, which is not limited in this application.
[0090] Step S506: When the second predicted coding bit number is greater than the first predicted coding bit number and the first row-level quantization parameter is less than the maximum quantization parameter threshold, the first row-level quantization parameter is increased based on a preset amplitude so that the re-determined second predicted coding bit number is less than or equal to the first predicted coding bit number, and when the second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and a preset ratio, the current row to be encoded is encoded based on the increased first row-level quantization parameter.
[0091] Among them, if the first row-level quantization parameter is less than the maximum quantization parameter threshold, it can be regarded that the current first row-level quantization parameter is still within the adjustable range and can continue to be adjusted upward; if the first row-level quantization parameter is greater than or equal to the maximum quantization parameter threshold, the first row-level quantization parameter will no longer be adjusted upward.
[0092] Step S507, when the second predicted number of coding bits is less than the product of the first predicted number of coding bits and a preset ratio, and the first row-level quantization parameter is greater than the minimum quantization parameter threshold, the first row-level quantization parameter is lowered based on a preset amplitude so that the re-determined second predicted number of coding bits is greater than or equal to the product of the first predicted number of coding bits and the preset ratio, and the current row to be encoded is encoded based on the lowered first row-level quantization parameter.
[0093] Among them, if the first row-level quantization parameter is greater than the minimum quantization parameter threshold, it can be regarded that the current first row-level quantization parameter is still within the adjustable range and can continue to be adjusted down; if the first row-level quantization parameter is less than or equal to the minimum quantization parameter threshold, the first row-level quantization parameter will no longer be adjusted down.
[0094] As mentioned above, by setting the maximum quantization parameter threshold and the minimum quantization parameter threshold corresponding to the current row to be encoded, the difference in row-level quantization parameters between the current row to be encoded and the previous encoded row can be effectively controlled, avoiding excessive adjustment that causes a large difference in row-level quantization parameters corresponding to the current row to be encoded and the previous encoded row, resulting in a sudden change in image quality between the corresponding rows after encoding, affecting the user's video viewing experience.
[0095] Figure 6 This is a structural block diagram of a video encoding device provided in an embodiment of the present application. The device is configured to execute the video encoding method provided in the above embodiment and has the corresponding functional modules and beneficial effects of the execution method. Figure 6 As shown, the device comprises:
[0096] The first quantization parameter calculation module 101 is configured to determine the frame-level quantization parameter of the current video frame according to the frame-level complexity of the current video frame and the first encoding bit number of the processed video frame in the process of encoding the video frame sequence, when the current video frame is a key frame or a forward prediction frame;
[0097] The coding bit number calculation module 102 is configured to determine a first predicted coding bit number of the current video frame according to a frame level quantization parameter, a frame level complexity and a set frame level bit estimation parameter;
[0098] The second quantization parameter calculation module 103 is configured to adjust the frame-level quantization parameter when the first predicted coding bit number is not within the set bit number threshold interval, so that the re-determined first predicted coding bit number is within the bit number threshold interval.
[0099] The encoding module 104 is configured to determine a row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encode each to-be-encoded row based on the row-level quantization parameter.
[0100] In the above, in the process of encoding a video frame sequence, when the current video frame is a key frame or a forward predicted frame, the frame-level quantization parameter of the current video frame is determined according to the frame-level complexity of the current video frame and the first number of encoded bits of the processed video frame; the first predicted number of encoded bits of the current video frame is determined according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter; when the first predicted number of encoded bits is not within the set bit number threshold interval, the frame-level quantization parameter is adjusted so that the re-determined first predicted number of encoded bits is within the bit number threshold interval; the row-level quantization parameter of each to-be-encoded row in the current video frame is determined based on the adjusted frame-level quantization parameter, and each to-be-encoded row is encoded based on the row-level quantization parameter. In the above scheme, by determining the first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter, the predicted coding size of the current video frame can be effectively estimated. By continuously adjusting the frame-level quantization parameter corresponding to the current video frame based on the comparison result of the first predicted coding bit number and the set bit number threshold interval, and re-determining the first predicted coding bit number until the first predicted coding bit number is in the bit number threshold interval, the frame-level quantization parameter of the current video frame is effectively adjusted, the stability of the frame-level bit rate can be improved, and the row-level quantization parameter is determined based on the frame-level quantization parameter, the quantization parameter is further refined and adjusted, and the row-level bit rate control function is added, so that the actual encoding bit rate is more stable and close to the target bit rate, reducing the jamming of video playback in real-time communication scenarios, and ensuring users' smooth video viewing experience.
[0101] In a possible embodiment, the second quantization parameter calculation module 103 is further configured to:
[0102] When the first predicted coding bit number is greater than an upper threshold of the bit number threshold interval, the frame level quantization parameter is increased based on a ratio of the first predicted coding bit number to the upper threshold.
[0103] When the first predicted coding bit number is less than the lower threshold of the bit number threshold interval, the frame level quantization parameter is lowered based on the ratio of the first predicted coding bit number to the lower threshold.
[0104] In a possible embodiment, the encoding module 104 is further configured to:
[0105] Determine the second predicted number of coding bits of the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second number of coding bits of the encoded row, wherein the initial value of the first row-level quantization parameter is the second row-level quantization parameter of the previous encoded row, and the row-level quantization parameter of the first encoded row of the current video frame is the adjusted frame-level quantization parameter;
[0106] When the second predicted coding bit number is greater than the first predicted coding bit number, the first row-level quantization parameter is adjusted upward based on a preset amplitude so that the re-determined second predicted coding bit number is less than or equal to the first predicted coding bit number, and when the second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and a preset ratio, the current row to be encoded is encoded based on the increased first row-level quantization parameter.
[0107] In a possible embodiment, a second encoding module is further included, configured as follows:
[0108] When the second predicted coding bit number is less than the product of the first predicted coding bit number and a preset ratio, the first row-level quantization parameter is lowered based on a preset amplitude so that the re-determined second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and the preset ratio, and the current row to be encoded is encoded based on the lowered first row-level quantization parameter.
[0109] In a possible embodiment, the encoding module 104 is further configured to:
[0110] Determine a third predicted number of coding bits of the uncoded row according to the row-level complexity corresponding to the current row to be coded, the first row-level quantization parameter, and the set row-level bit estimation parameter;
[0111] The second coding bit number of the coded row is added to the third predicted coding bit number to obtain the second predicted coding bit number of the current video frame.
[0112] In a possible embodiment, a threshold determination module is further included, configured to:
[0113] Based on the first row-level quantization parameter and the preset step size, determining a maximum quantization parameter threshold and a minimum quantization parameter threshold corresponding to the current row to be encoded;
[0114] Correspondingly, the encoding module 104 is further configured as follows:
[0115] When the first row-level quantization parameter is less than the maximum quantization parameter threshold, the first row-level quantization parameter is increased based on a preset amplitude;
[0116] When the first row-level quantization parameter is greater than the minimum quantization parameter threshold, the first row-level quantization parameter is lowered based on a preset amplitude.
[0117] Figure 7 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the device includes a processor 201, a memory 202, an input device 203 and an output device 204; the number of processors 201 in the device can be one or more. Figure 7A processor 201 is taken as an example; the processor 201, memory 202, input device 203 and output device 204 in the device can be connected by a bus or other means. Figure 7 The example of connecting through a bus is taken. The memory 202, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the video encoding method in the embodiment of the present application. The processor 201 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 202, that is, implements the above-mentioned video encoding method. The input device 203 can be configured to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 204 may include a display device such as a display screen.
[0118] An embodiment of the present application also provides a non-volatile storage medium containing computer executable instructions, which, when executed by a computer processor, is configured to execute a video encoding method described in the above embodiment, which includes: in the process of encoding a video frame sequence, when the current video frame is a key frame or a forward predicted frame, determining the frame-level quantization parameter of the current video frame according to the frame-level complexity of the current video frame and the first number of encoded bits of the processed video frame; determining the first predicted number of encoding bits of the current video frame according to the frame-level quantization parameter, the frame-level complexity and the set frame-level bit estimation parameter; when the first predicted number of encoding bits is not within the set bit number threshold interval, adjusting the frame-level quantization parameter so that the re-determined first predicted number of encoding bits is within the bit number threshold interval; determining the row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encoding each to-be-encoded row based on the row-level quantization parameter.
[0119] It is worth noting that in the embodiment of the above-mentioned video encoding device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not configured to limit the protection scope of the embodiments of the present application.
[0120] In some possible implementations, various aspects of the method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on a computer device, the program code is configured to enable the computer device to execute the steps of the method according to various exemplary embodiments of the present application described above in this specification. For example, the computer device may execute the video encoding method described in the embodiment of the present application. The program product may be implemented in any combination of one or more readable media.
Claims
1. A video encoding method, characterized in that: include: In the process of encoding a video frame sequence, when a current video frame is a key frame or a forward prediction frame, determining a frame-level quantization parameter of the current video frame according to a frame-level complexity of the current video frame and a first encoding bit number of a processed video frame; Determining a first predicted coding bit number of the current video frame according to the frame-level quantization parameter, the frame-level complexity, and a set frame-level bit estimation parameter; When the first predicted coding bit number is not within the set bit number threshold interval, adjusting the frame level quantization parameter so that the re-determined first predicted coding bit number is within the bit number threshold interval; The row-level quantization parameter of each to-be-encoded row in the current video frame is determined based on the adjusted frame-level quantization parameter, and each to-be-encoded row is encoded based on the row-level quantization parameter.
2. The video encoding method according to claim 1, characterized in that: The adjusting the frame-level quantization parameter includes: When the first predicted coding bit number is greater than an upper threshold of the bit number threshold interval, based on a ratio of the first predicted coding bit number to the upper threshold, increasing the frame level quantization parameter; When the first predicted coding bit number is less than a lower limit threshold of the bit number threshold interval, the frame level quantization parameter is lowered based on a ratio of the first predicted coding bit number to the lower limit threshold.
3. The video encoding method according to claim 1, characterized in that: The determining of the row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encoding each to-be-encoded row based on the row-level quantization parameter comprises: Determine the second predicted coding bit number of the current video frame according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second coding bit number of the encoded row, wherein the initial value of the first row-level quantization parameter is the second row-level quantization parameter of the previous encoded row, and the row-level quantization parameter of the first encoded row of the current video frame is the adjusted frame-level quantization parameter; When the second predicted coding bit number is greater than the first predicted coding bit number, the first row-level quantization parameter is adjusted upward based on a preset amplitude so that the re-determined second predicted coding bit number is less than or equal to the first predicted coding bit number, and when the second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and a preset ratio, the current row to be encoded is encoded based on the increased first row-level quantization parameter.
4. The video encoding method according to claim 3, characterized in that: Also includes: When the second predicted coding bit number is less than the product of the first predicted coding bit number and a preset ratio, the first row-level quantization parameter is lowered based on the preset amplitude so that the re-determined second predicted coding bit number is greater than or equal to the product of the first predicted coding bit number and the preset ratio, and the current row to be encoded is encoded based on the lowered first row-level quantization parameter.
5. The video encoding method according to claim 3, characterized in that: The determining, according to the row-level complexity corresponding to the current row to be encoded, the first row-level quantization parameter, the set row-level bit estimation parameter, and the second encoding bit number of the encoded row, the second predicted encoding bit number of the current video frame comprises: Determine a third predicted number of coding bits of the uncoded row according to the row-level complexity corresponding to the current row to be coded, the first row-level quantization parameter, and the set row-level bit estimation parameter; The second number of coding bits of the encoded row is added to the third number of predicted coding bits to obtain the second number of predicted coding bits of the current video frame.
6. The video encoding method according to claim 4, characterized in that: After determining the second predicted coding bit number of the current video frame, the method further includes: Determining a maximum quantization parameter threshold and a minimum quantization parameter threshold corresponding to the current to-be-encoded row based on the first row-level quantization parameter and a preset step size; Correspondingly, the step of increasing the first row-level quantization parameter based on a preset amplitude includes: When the first row-level quantization parameter is less than the maximum quantization parameter threshold, the first row-level quantization parameter is increased based on a preset amplitude; The step of lowering the first row-level quantization parameter based on the preset amplitude includes: When the first row-level quantization parameter is greater than the minimum quantization parameter threshold, the first row-level quantization parameter is lowered based on the preset amplitude.
7. A video encoding device, characterized in that: include: A first quantization parameter calculation module is configured to determine a frame-level quantization parameter of the current video frame according to a frame-level complexity of the current video frame and a first number of encoding bits of a processed video frame in a process of encoding a video frame sequence, when the current video frame is a key frame or a forward prediction frame; A coding bit number calculation module, configured to determine a first predicted coding bit number of the current video frame according to the frame level quantization parameter, the frame level complexity and a set frame level bit estimation parameter; A second quantization parameter calculation module is configured to adjust the frame-level quantization parameter when the first predicted coding bit number is not within a set bit number threshold interval, so that the re-determined first predicted coding bit number is within the bit number threshold interval; The encoding module is configured to determine a row-level quantization parameter of each to-be-encoded row in the current video frame based on the adjusted frame-level quantization parameter, and encode each to-be-encoded row based on the row-level quantization parameter.
8. A video encoding device, the device comprising: one or more processors; A storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the video encoding method according to any one of claims 1-6.
9. A non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to perform the video encoding method according to any one of claims 1 to 6 when executed by a computer processor.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the video encoding method according to any one of claims 1 to 6 is implemented.