This invention discloses a method for improving two-pass bitrate control using peak
signal-to-
noise ratio (PSNR), comprising the following steps: setting a target total number of bits (TB), starting the first two-pass encoding, acquiring the
bitstream, and after encoding, statistically analyzing the total number of video frames (N), PSNR, QP, SATD, and Bits of each frame, starting the pre-analysis stage of the second two-pass encoding, defining the PSNR redundancy of the i-th frame as psnr_rd(i) = psnr(i) - TH1, where TH1 is a constant with a value range of (30~40). When psnr_rd(i) is greater than 0, the
subjective quality is good; when psnr_rd(i) is less than 0, the
subjective quality is poor. Calculating the QP values of frames with good quality, frames with
poor quality, and frames with balanced quality, respectively. Starting the encoding stage of the second two-pass encoding, determining whether each frame belongs to a frame with good quality, a frame with
poor quality, or a frame with balanced quality, and encoding using the calculated QP values to obtain the final
bitstream.