This paper presents a new adaptive macroblock quantization algorithm which generates the output bits corresponding to the target bit budget. The H.264 standard uses various coding modes and optimization methods to improve the compression performance, which makes it difficult to control the amount of the generated traffic accurately. In the proposed scheme, linear regression analysis is used to analyze the relationship between the bit rate of each macroblock and the quantization parameter and to predict the MAD values. Using the predicted values, the quantization parameter of each macroblock is determined by the Lagrange multiplier method and then modified according to the difference between the bit budget and the generated bits. It is shown by experimental results that the new algorithm can generate output bits accurately corresponding to the target bit rates.