Video coding method and system for improving breathing effect of monitoring video

By dynamically optimizing the quantization parameters and macroblock brightness matching of I-frames, the problem of sudden drops in I-frame image quality in surveillance videos was solved, achieving a smooth transition in image quality and improving the fluency of video viewing, thus adapting to the needs of different scenarios.

CN121750864APending Publication Date: 2026-03-27SHANDONG FOREIGN TRADE VOCATIONAL COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The breathing effect caused by a sudden drop in I-frame quality in surveillance video manifests as the image being sometimes clear and sometimes blurry, affecting the smoothness and consistency of video viewing.

Method used

By dynamically optimizing the quantization parameters of I-frames, using macroblock brightness matching to detect image content similarity, and iteratively adjusting the quantization parameters to optimize the coding quality of I-frames and make them consistent with P-frames, an intelligent decision-making mechanism is adopted to find the optimal QP within the peak bit rate range.

Benefits of technology

It significantly suppresses the breathing effect, improves the smoothness and consistency of video viewing, achieves a smooth transition in image quality, adapts to the needs of different complex scenes, and optimizes keyframe image quality under limited bitrate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121750864A_ABST
    Figure CN121750864A_ABST
Patent Text Reader

Abstract

The invention discloses a video coding method and system for improving the breathing effect of a monitoring video, and mainly relates to the technical field of video coding and decoding. Comprising the following steps: before coding an I frame, judging the similarity between the I frame and a previous P frame through macro block brightness matching; if the similarity is high, the breathing effect is possibly triggered, and then the I frame is subjected to primary coding with the quantization parameter of the reference P frame and the quality is evaluated; if the quality of the I frame is obviously lower than that of the reference P frame and the code rate still has a margin, iteratively reducing the quantization parameter and recoding until the quality of the I frame is improved to be close to that of the P frame or reaches the lower limit of the quantization parameter; and finally outputting code streams with consistent visual quality. The method has the beneficial effects that the quantization parameter of the I frame is dynamically optimized, so that the image quality jump between the I frame and the P frame is effectively reduced, the breathing effect caused by the sudden reduction of the quality of the key frame in the monitoring video is remarkably inhibited, and the consistency of the video watching fluency and the subjective experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of video coding, and particularly relates to a method and system for improving breathing effect of monitoring video in video coding. BACKGROUND

[0002] In video coding, an encoder usually divides an image sequence into frames, and divides the frames into I frames (intra-coded frames) and P frames (forward-predicted frames) according to different prediction modes. The I frame is a complete image and is not dependent on other frames for restoration, and is usually used as a key frame to play a role in video synchronization and restart decoding. The P frame is coded by referring to a previous frame (such as an I frame or a previous P frame), and only the changed part is saved, thereby greatly reducing redundant data. In a static scene, the image content between adjacent frames changes very little, and the P frame can use inter-frame prediction technology very efficiently, and only a small amount of data is needed to restore a picture that is almost identical to the original image, so the encoder usually allocates a small quantization parameter QP to the P frame, and the smaller the QP, the lighter the compression, and the more details of the image are retained, and the higher the image quality. In contrast, the I frame uses an intra-frame prediction mode, which cannot refer to other frames, and can only rely on the data of the current frame for compression and coding, and the coding complexity is high. In order to control the code rate, the encoder may allocate a relatively large QP to the I frame, resulting in a decrease in image quality.

[0003] In this case, a typical problem occurs: the image quality of the I frame is worse than that of the surrounding P frames, especially in a static scene or a low dynamic scene (such as a monitoring video), and the video exhibits a fluctuation phenomenon of “picture clear and blurred” and “quality high and low” in visual perception, which is commonly referred to as “breathing effect” in the industry.

[0004] Therefore, there is an urgent need for a method and system for improving breathing effect of monitoring video in video coding to solve the above problems. SUMMARY

[0005] The present application aims to provide a method and system for improving breathing effect of monitoring video in video coding, which effectively reduces the image quality jump between I frames and P frames by dynamically optimizing the quantization parameter of the I frame, significantly suppresses the “breathing effect” caused by the sudden drop in the quality of the key frame in the monitoring video, and improves the fluency and subjective experience consistency of video viewing.

[0006] To achieve the above-mentioned purpose, the present application realizes the following technical scheme: On the one hand, the present application provides a method for improving breathing effect of monitoring video in video coding, comprising the following steps: Step S1: determining the initial quantization parameter of the current to-be-coded I frame in the coding process of the video sequence ; Step S2: Determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds a preset similarity threshold; if so, determine that a breathing effect may occur and proceed to step S3; otherwise, directly use the initial quantization parameters. Encode the current I-frame and output it to the bitstream; Step S3: Use the quantization parameters employed in the previous encoded P-frame. The current I-frame is encoded for the first time to obtain the number of bits for the first encoding. And the peak signal-to-noise ratio (PSNR) of the first encoded reconstructed image relative to the original I-frame. ; Step S4: Determine whether the encoding quality of the current I-frame meets the optimization conditions; the optimization conditions are: the peak signal-to-noise ratio of the current I-frame. Lower than the peak signal-to-noise ratio of the previous encoded P-frame The preset ratio, and the number of bits in the current I-frame. If the bitrate is lower than the threshold allowed by the peak video bitrate, then proceed to step S5; otherwise, directly output the first encoding result to the bitstream. Step S5: Iteratively adjust the quantization parameters used to encode the current I-frame. Gradually reduce The values ​​are then re-encoded until the peak signal-to-noise ratio (PSNR) of the current I-frame obtained after re-encoding reaches or exceeds the PSNR of the previously encoded P-frame. The preset ratio, or until the adjusted ratio. The value reaches the preset minimum. value The last encoding result is taken as the optimal encoding result; Step S6: Output the optimal encoding result or the first encoding result when the optimization conditions in step S4 are not met to the bitstream, and update the bitrate control information.

[0007] Preferably, in step S1, the initial quantization parameters of the current I-frame to be encoded are determined. The method is as follows: If the current I-frame is the first frame of the video sequence, the initial quantization parameters are calculated based on the target bitrate of the video and the complexity estimate of the current frame. ; If the current I-frame is not the first frame, the encoder's bitrate control module determines the initial quantization parameters based on the target bitrate of the video, the encoding information of historical frames, and the complexity estimate of the current frame. .

[0008] Preferably, in step S2, the method for determining the similarity of image content is macroblock brightness matching, including: The original image of the current I-frame and the original image of the previous encoded P-frame are each divided into multiple parts of size [missing information]. Macroblocks of pixels; For position coordinates are all Calculate the average macroblock brightness value for the current I-frame macroblock and the previous P-frame macroblock, respectively. and ; Calculate the brightness difference between two corresponding macroblocks ; like Less than the preset brightness difference threshold If so, then the two macroblocks at that position are determined to match; Count the number of matching macroblocks in all macroblocks and calculate the proportion of matching macroblocks to the total number of macroblocks; If the matching ratio exceeds a preset matching threshold, it is determined that the image content similarity between the current I-frame and the previous encoded P-frame exceeds the similarity threshold.

[0009] Preferably, the brightness difference threshold The value range is greater than 30 and less than 100; the value range of the matching threshold is 25% to 40%.

[0010] Preferably, in step S4, the preset ratio The value range is from 0.90 to 0.98; the allowed threshold for the video peak bitrate is set as the peak bitrate. 0.7 times; the specific optimization conditions are: ,and .

[0011] Preferably, in step S5, the quantization parameters are iteratively adjusted. The specific method is as follows: Step S51: Quantize the parameters used in the first encoding. Subtract a fixed adjustment step size To obtain new quantization parameters The adjustment step size The value range is 1 to 2; Step S52: Determine Is it less than or equal to the preset minimum? value If so, the adjustment will be terminated and the following will be used. Or the last valid The result of the value encoding is taken as the optimal encoding result; If not, then use The current I-frame is re-encoded to obtain a new peak signal-to-noise ratio. and number of bits ; Step S53: Determine Does it meet the requirements? If so, then it will be used. The encoded result is taken as the optimal encoded result; If not, then Assign to And repeat steps S51 to S53.

[0012] Preferably, the minimum value Set as Subtract 10.

[0013] On the other hand, the present invention provides a video coding system for improving the breathing effect in surveillance videos, used to implement the video coding method for improving the breathing effect in surveillance videos as described above, characterized in that it includes: The initial parameter determination module is used to determine the initial quantization parameters of the current I-frame to be encoded during the encoding process of a video sequence. The similarity detection and judgment module is used to determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds the preset similarity threshold, and to trigger or skip the optimization process based on the judgment result. The initial encoding and quality assessment module is used to perform the first encoding of the current I-frame using the quantization parameters of the previous P-frame when the optimization process is triggered, and to obtain the number of encoded bits and peak signal-to-noise ratio. The optimization condition judgment module is used to determine whether the optimization conditions for initiating iterative adjustment of quantization parameters are met based on the number of bits and the peak signal-to-noise ratio. The quantization parameter iterative optimization module is used to iteratively adjust the quantization parameters used to encode the current I-frame when the optimization conditions are met, to find the optimal encoding parameters and obtain the optimal encoding result; The encoding output and update module is used to output the optimal encoding result or the initial encoding result when the optimization conditions are not met to the bitstream, and update the bitrate control information.

[0014] Preferably, the similarity detection and judgment module specifically includes: The image segmentation unit is used to divide the original image of the current I-frame and the original image of the previous P-frame into multiple macroblocks; A luminance calculation unit is used to calculate the average luminance value of each macroblock. The matching judgment unit is used to determine whether a macroblock matches by comparing the brightness difference of the corresponding macroblock with a preset brightness difference threshold. The statistics and threshold comparison unit is used to count the proportion of matching macroblocks and compare the proportion with a preset matching threshold to output the final similarity judgment result.

[0015] Preferably, the quantization parameter iterative optimization module specifically includes: The parameter adjustment unit is used to reduce the value of the currently used quantization parameter according to a preset adjustment step size; The boundary check unit is used to check whether the adjusted quantization parameter value has reached the preset minimum. Value restrictions; Cyclic encoding and evaluation unit, used to evaluate the minimum value before it is reached. When the value is reached, re-encode using the adjusted quantization parameters and evaluate whether the peak signal-to-noise ratio of the new encoding result meets the stopping condition; The loop control unit is used to control the continuation or termination of the iterative process based on the results of the boundary check unit and the loop encoding and evaluation unit, and to determine the optimal encoding result of the final output.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Effectively suppresses the "breathing effect" and significantly improves visual viewing consistency: This invention fundamentally solves the problem of "sometimes clear and sometimes blurry picture" caused by the sudden drop in I-frame image quality by dynamically detecting and optimizing the encoding quality of I-frames; it achieves a smooth transition of image quality between frames, greatly enhancing the overall visual stability and viewing comfort of the video.

[0017] 2. Intelligent Optimization of Keyframe (I-frame) Quality under Limited Bitrate: This invention does not blindly improve the quality of all I-frames, but introduces an intelligent decision-making mechanism. First, macroblock brightness matching is used to determine whether the scene is static or has low dynamic range (prone to breathing effect), and the optimization process is initiated only when necessary. Second, the optimization process uses the quality of a reference P-frame as a benchmark and strictly adheres to the peak bitrate limit, iteratively fine-tuning the quantization parameter (QP) to find the "optimal QP" for the I-frame. This ensures that, under bandwidth-constrained conditions (such as surveillance networks), limited bitrate resources are precisely used to improve the quality of keyframes that have the greatest impact on viewing experience, achieving an optimal balance between bitrate allocation and subjective quality perception.

[0018] 3. The solution is highly adaptable, balancing efficiency and effectiveness: The method sets multiple adjustable parameters (such as similarity threshold, brightness difference threshold TH1, quality ratio coefficient a, etc.) to adapt to the needs of monitoring scenarios with different complexities (such as indoor static scenes and outdoor scenes with slight wind). While avoiding missing the real breathing effect, it also prevents unnecessary intervention in dynamic scenes, ensuring the overall efficiency of the coding system.

[0019] 4. Good compatibility with existing coding frameworks and easy integration: The core of the detection and optimization process proposed in this invention lies in the improvement of bitrate control and quantization parameter adjustment strategies, without changing the core coding processes such as intra / inter-frame prediction, transform, and entropy coding in the standard. Therefore, this method can be easily integrated into the encoder implementations of existing H.264 / AVC, H.265 / HEVC, and even newer video coding standards, and has good prospects for practical application and industrialization. Attached Figure Description

[0020] Figure 1 This is a flowchart of a method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a video P-frame encoded using the conventional method of this invention. Figure 3 This is a schematic diagram of a video I-frame encoded using the conventional method of this invention. Figure 4 This is a schematic diagram of a video P-frame encoded by the method of an embodiment of the present invention; Figure 5 This is a schematic diagram of a video I-frame encoded by the method of an embodiment of the present invention; Figure 6 This is a schematic diagram of the system structure according to an embodiment of the present invention. Detailed Implementation

[0021] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined in this application.

[0022] In this invention, terms such as "upper," "lower," "left," "right," "front," "back," "vertical," "horizontal," "side," and "bottom" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used only to facilitate the description of the structural relationships of the various components or elements of this invention and do not specifically refer to any component or element in this invention. They should not be construed as limiting the invention.

[0023] Example: like Figure 1 As shown, this embodiment provides a video coding method to improve the breathing effect in surveillance videos, including the following steps: Step S1: During the encoding process of the video sequence, determine the initial quantization parameters of the current I-frame to be encoded. ; Step S2: Determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds a preset similarity threshold; if so, determine that a breathing effect may occur and proceed to step S3; otherwise, directly use the initial quantization parameters. Encode the current I-frame and output it to the bitstream; Step S3: Use the quantization parameters employed in the previous encoded P-frame. The current I-frame is encoded for the first time to obtain the number of bits for the first encoding. And the peak signal-to-noise ratio (PSNR) of the first encoded reconstructed image relative to the original I-frame. ; Step S4: Determine whether the encoding quality of the current I-frame meets the optimization conditions; the optimization conditions are: the peak signal-to-noise ratio of the current I-frame. Lower than the peak signal-to-noise ratio of the previous encoded P-frame preset ratio And the number of bits in the current I-frame If the bitrate is lower than the threshold allowed by the peak video bitrate, then proceed to step S5; otherwise, directly output the first encoding result to the bitstream. Step S5: Iteratively adjust the quantization parameters used to encode the current I-frame. Gradually reduce The values ​​are then re-encoded until the peak signal-to-noise ratio (PSNR) of the current I-frame obtained after re-encoding reaches or exceeds the PSNR of the previously encoded P-frame. preset ratio or until the adjusted The value reaches the preset minimum. value The last encoding result is taken as the optimal encoding result; Step S6: Output the optimal encoding result or the first encoding result when the optimization conditions in step S4 are not met to the bitstream, and update the bitrate control information.

[0024] Specifically: 1. At the start of encoding, the encoder's bitrate control module determines the initial quantization parameter QP values ​​of the I-frame and P-frame in the current GOP based on the target bitrate of the current video, the actual bitrate feedback of the previous frame (if it exists), and the intra-frame complexity estimation. If the current I-frame is the first frame of the sequence (there is no previous P-frame), the encoder directly estimates the initial I-frame QP based on the target bitrate and frame complexity. If the current I-frame is the first frame of the sequence (there is no previous P-frame), the encoder directly estimates the initial QP value based on the target bit rate and frame complexity: ; in The baseline set for the system , It is a proportionality coefficient (usually taken as 2 to 4). The target bitrate for the current video. The complexity metric is calculated for the current frame based on the entire frame's SATD (Sumof AbsoluteTransformed Differences).

[0025] 2. Before encoding the I-frame, if there is a previous P-frame, the block matching method is used to determine the similarity between the original image of the current I-frame and the original image of the previous P-frame to determine whether the breathing effect may occur. Taking a 16x16 pixel block as one macroblock, the number of matches between the I-frame macroblock and the macroblock of the previous P-frame is calculated. If the number of matches exceeds 30% of the total number of macroblocks in the whole frame (this threshold can be adaptively set in the range of 25% to 40% according to the scene complexity), it is considered that the breathing effect may occur and the next step needs to be executed. Otherwise, the I-frame is directly encoded and step 6 is executed. The method for determining the number of matches is as follows: each frame is divided into several macroblocks, and the average brightness value of the macroblock in the i-th row and j-th column of the original I-frame image is calculated. Calculate the average luminance value of the macroblock in the i-th row and j-th column of the previous P-frame original image. Calculation of corresponding macroblock brightness difference: ,if If the macroblock in row i and column j of the I-frame is considered to match the macroblock in row i and column j of the previous P-frame, then... The value range is (30, 100), which is based on experimental statistics: below 30, potential respiratory effects will be missed, and above 100, too many irrelevant scenarios will be triggered, thereby reducing detection efficiency; The calculation of the macroblock average brightness value is as follows: ; ; in , This represents the brightness value of the pixel at position (x, y) in the macroblock of row i and column j in an I-frame. This represents the brightness value of the pixel at position (x,y) in the macroblock of row i and column j in frame P.

[0026] 3. Perform the first encoding and quality assessment on the I-frame: Specifically, it involves: obtaining the QP value used in the previous P-frame. Using this as the initial QP, the I-frame is encoded for the first time, and the number of bits in the encoder output frame is counted, denoted as . The reconstructed image output by the encoder is obtained, and the peak signal-to-noise ratio (PSNR) between the reconstructed image and the original image is calculated, denoted as . , ; in The mean square error is the difference between the reconstructed image and the original image of the I-frame.

[0027] 4. Evaluate the quality of the I-frame after the first encoding and the potential for quality improvement within the peak bitrate range: Specifically: comparison PSNR value compared to the previous P frame If satisfied ( If the subjective quality of the I-frame is significantly lower than that of the adjacent P-frame, further optimization is needed. With video peak bitrate Values ​​are compared, if This indicates that the peak bit rate was not being fully utilized at this time. If there is still room to increase the number of bits in the I-frame within the allowed range, proceed to step 5; otherwise, proceed directly to step 6.

[0028] 5. Iteratively adjust the QP of the I-frame until the PSNR of the I-frame is high enough or the QP adjustment of the I-frame reaches the lower limit. : Specifically: Order , You can choose 1 to 2, if Then stop adjusting and proceed to step 6, where... for Otherwise use Re-encode the I-frame and obtain the new and Repeat steps 4 and 5 until the condition is met. ; 6. Output the I-frame encoding result to the bitstream and update the statistical information of the bitrate control module for QP prediction of subsequent frames.

[0029] like Figures 2-5 As shown, Figure 2 The 24th frame (P-frame) of the video encoded using traditional methods, It is 34.71 dB. Figure 3 The 25th frame (I-frame) of the video encoded using conventional methods, The value was 29.48 dB, when playing from frame 24 to frame 25. The image quality dropped by 5.23 dB, suddenly becoming blurry from clear, and the video quality became inconsistent. Figure 4 The 24th frame (P-frame) of the video encoded by the method of this invention, It is 34.83 dB. Figure 5The 25th frame (frame I) of the video encoded by the method of this invention, The value was 34.16 dB, when playing from frame 24 to frame 25. The decrease was only 0.67 dB, resulting in a minimal change in the visual quality of the image. The video no longer presented a "fluctuating quality" appearance.

[0030] like Figure 6 As shown, this embodiment also provides a video coding system for improving the breathing effect in surveillance videos, including: The initial parameter determination module is used to determine the initial quantization parameters of the current I-frame to be encoded during the encoding process of a video sequence. The similarity detection and judgment module is used to determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds the preset similarity threshold, and to trigger or skip the optimization process based on the judgment result. The initial encoding and quality assessment module is used to perform the first encoding of the current I-frame using the quantization parameters of the previous P-frame when the optimization process is triggered, and to obtain the number of encoded bits and peak signal-to-noise ratio. The optimization condition judgment module is used to determine whether the optimization conditions for initiating iterative adjustment of quantization parameters are met based on the number of bits and the peak signal-to-noise ratio. The quantization parameter iterative optimization module is used to iteratively adjust the quantization parameters used to encode the current I-frame when the optimization conditions are met, to find the optimal encoding parameters and obtain the optimal encoding result; The encoding output and update module is used to output the optimal encoding result or the initial encoding result when the optimization conditions are not met to the bitstream, and update the bitrate control information. The similarity detection and judgment module specifically includes: The image segmentation unit is used to divide the original image of the current I-frame and the original image of the previous P-frame into multiple macroblocks; A luminance calculation unit is used to calculate the average luminance value of each macroblock. The matching judgment unit is used to determine whether a macroblock matches by comparing the brightness difference of the corresponding macroblock with a preset brightness difference threshold. The statistics and threshold comparison unit is used to count the proportion of matching macroblocks and compare the proportion with a preset matching threshold to output the final similarity judgment result. The quantization parameter iterative optimization module specifically includes: The parameter adjustment unit is used to reduce the value of the currently used quantization parameter according to a preset adjustment step size; The boundary check unit is used to check whether the adjusted quantization parameter value has reached the preset minimum. Value restrictions; Cyclic encoding and evaluation unit, used to evaluate the minimum value before it is reached. When the value is reached, re-encode using the adjusted quantization parameters and evaluate whether the peak signal-to-noise ratio of the new encoding result meets the stopping condition; The loop control unit is used to control the continuation or termination of the iterative process based on the results of the boundary check unit and the loop coding and evaluation unit, and to determine the optimal coding result of the final output.

[0031] The above is a detailed description of the preferred embodiments of the present invention, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A method for improving the breathing effect in surveillance videos, characterized in that, Includes the following steps: Step S1: During the encoding process of the video sequence, determine the initial quantization parameters of the current I-frame to be encoded. ; Step S2: Determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds a preset similarity threshold; if so, determine that a breathing effect may occur and proceed to step S3; otherwise, directly use the initial quantization parameters. Encode the current I-frame and output it to the bitstream; Step S3: Use the quantization parameters employed in the previous encoded P-frame. The current I-frame is encoded for the first time to obtain the number of bits for the first encoding. And the peak signal-to-noise ratio (PSNR) of the first encoded reconstructed image relative to the original I-frame. ; Step S4: Determine whether the encoding quality of the current I-frame meets the optimization conditions; the optimization conditions are: the peak signal-to-noise ratio of the current I-frame. Lower than the peak signal-to-noise ratio of the previous encoded P-frame The preset ratio, and the number of bits in the current I-frame. If the bitrate is lower than the threshold allowed by the peak video bitrate, then proceed to step S5; otherwise, directly output the first encoding result to the bitstream. Step S5: Iteratively adjust the quantization parameters used to encode the current I-frame. Gradually reduce The values ​​are then re-encoded until the peak signal-to-noise ratio (PSNR) of the current I-frame obtained after re-encoding reaches or exceeds the PSNR of the previously encoded P-frame. The preset ratio, or until the adjusted ratio. The value reaches the preset minimum. value The last encoding result is taken as the optimal encoding result; Step S6: Output the optimal encoding result or the first encoding result when the optimization conditions in step S4 are not met to the bitstream, and update the bitrate control information.

2. The video coding method for improving the breathing effect in surveillance video according to claim 1, characterized in that, In step S1, the initial quantization parameters of the current I-frame to be encoded are determined. The method is as follows: If the current I-frame is the first frame of the video sequence, the initial quantization parameters are calculated based on the target bitrate of the video and the complexity estimate of the current frame. ; If the current I-frame is not the first frame, the encoder's bitrate control module determines the initial quantization parameters based on the target bitrate of the video, the encoding information of historical frames, and the complexity estimate of the current frame. .

3. The video coding method for improving the breathing effect in surveillance video according to claim 1, characterized in that, In step S2, the method for determining the similarity of image content is macroblock brightness matching, which includes: The original image of the current I-frame and the original image of the previous encoded P-frame are each divided into multiple parts of size [missing information]. Macroblocks of pixels; For position coordinates are all Calculate the average macroblock brightness value for the current I-frame macroblock and the previous P-frame macroblock, respectively. and ; Calculate the brightness difference between two corresponding macroblocks ; like Less than the preset brightness difference threshold If so, then the two macroblocks at that position are determined to match; Count the number of matching macroblocks in all macroblocks and calculate the proportion of matching macroblocks to the total number of macroblocks; If the matching ratio exceeds a preset matching threshold, it is determined that the image content similarity between the current I-frame and the previous encoded P-frame exceeds the similarity threshold.

4. The video coding method for improving the breathing effect in surveillance video according to claim 3, characterized in that, The brightness difference threshold The value range is greater than 30 and less than 100; the value range of the matching threshold is 25% to 40%.

5. The video coding method for improving the breathing effect in surveillance video according to claim 1, characterized in that, In step S4, the preset ratio The value range is from 0.90 to 0.98; the allowed threshold for the video peak bitrate is set as the peak bitrate. 0.7 times; the specific optimization conditions are: ,and .

6. The video coding method for improving the breathing effect in surveillance video according to claim 1, characterized in that, In step S5, the quantization parameters are iteratively adjusted. The specific method is as follows: Step S51: Quantize the parameters used in the first encoding. Subtract a fixed adjustment step size To obtain new quantization parameters The adjustment step size The value range is from 1 to 2; Step S52: Determine Is it less than or equal to the preset minimum? value ; If so, then terminate the adjustment and use Or the last valid The result of the value encoding is taken as the optimal encoding result; If not, then use The current I-frame is re-encoded to obtain a new peak signal-to-noise ratio. and number of bits ; Step S53: Determine Does it meet the requirements? ; If so, then it will be used The encoded result is taken as the optimal encoded result; If not, then Assign to And repeat steps S51 to S53.

7. The video coding method for improving the breathing effect in surveillance video according to claim 1, characterized in that, The minimum value Set as Subtract 10.

8. A video coding system for improving the breathing effect in surveillance videos, used to implement the video coding method for improving the breathing effect in surveillance videos as described in any one of claims 1-7, characterized in that, include: The initial parameter determination module is used to determine the initial quantization parameters of the current I-frame to be encoded during the encoding process of a video sequence. The similarity detection and judgment module is used to determine whether the image content similarity between the current I-frame and the previous encoded P-frame exceeds the preset similarity threshold, and to trigger or skip the optimization process based on the judgment result. The initial encoding and quality assessment module is used to perform the first encoding of the current I-frame using the quantization parameters of the previous P-frame when the optimization process is triggered, and to obtain the number of encoded bits and peak signal-to-noise ratio. The optimization condition judgment module is used to determine whether the optimization conditions for initiating iterative adjustment of quantization parameters are met based on the number of bits and the peak signal-to-noise ratio. The quantization parameter iterative optimization module is used to iteratively adjust the quantization parameters used to encode the current I-frame when the optimization conditions are met, to find the optimal encoding parameters and obtain the optimal encoding result; The encoding output and update module is used to output the optimal encoding result or the initial encoding result when the optimization conditions are not met to the bitstream, and update the bitrate control information.

9. A video coding system for improving the breathing effect in surveillance video according to claim 8, characterized in that, The similarity detection and judgment module specifically includes: The image segmentation unit is used to divide the original image of the current I-frame and the original image of the previous P-frame into multiple macroblocks; A luminance calculation unit is used to calculate the average luminance value of each macroblock. The matching judgment unit is used to determine whether a macroblock matches by comparing the brightness difference of the corresponding macroblock with a preset brightness difference threshold. The statistics and threshold comparison unit is used to count the proportion of matching macroblocks and compare the proportion with a preset matching threshold to output the final similarity judgment result.

10. A video coding system for improving breathing effect in surveillance video according to claim 8, characterized in that, The quantization parameter iterative optimization module specifically includes: The parameter adjustment unit is used to reduce the value of the currently used quantization parameter according to a preset adjustment step size; The boundary check unit is used to check whether the adjusted quantization parameter value has reached the preset minimum. Value restrictions; Cyclic encoding and evaluation unit, used to evaluate the minimum value before it is reached. When the value is reached, re-encode using the adjusted quantization parameters and evaluate whether the peak signal-to-noise ratio of the new encoding result meets the stopping condition; The loop control unit is used to control the continuation or termination of the iterative process based on the results of the boundary check unit and the loop encoding and evaluation unit, and to determine the optimal encoding result of the final output.