The application discloses a two pass fixed QP
code rate control method, comprising the following steps: setting a target total bit number TB, starting a first encoding of the two pass, obtaining a code
stream, after the encoding is finished, counting a total frame number N of the video, a frame type of each frame, a QP of each frame, a texture bit number of each frame, a
motion vector bit number of each frame, marking the frame type of each frame as FT(1), FT(2),..., FT(N) respectively, marking the QP of each frame as qp(1), qp(2),..., qp(N) respectively, marking the texture bit number of each frame as tex_bits(1), tex_bits(2),..., tex_bits(N) respectively, and marking the
motion vector bit number of each frame as mv_bits(1), mv_bits(2),..., mv_bits(N) respectively; starting a second encoding of the two pass, calculating actual QP values of each frame according to the target total bit number TB and the information collected in the first encoding, and encoding each frame to obtain a final code
stream.