In order to improve the rate control performance of video encoder, video frames are segmented into two regions according to the video content, i.e. the foreground region containing the main moving objects and the background region containing the relatively static scene. The rate-distortion properties of the two regions are analyzed. Based on the analyses, a novel region-based macroblock layer rate control method for H.264/AVC is proposed. For the bit allocation process, more target bits can be assigned to the important macroblocks by employing an adaptive factor determined by the region information. Then, the quantization parameter (QP) is computed by using the quadratic model with different parameters related to the two regions. The computed QP is further adjusted to suppress the coding quality fluctuation between the two regions, as well as the quality fluctuation among the consecutive macroblocks. Finally, the rate control parameters are updated after coding the current macroblock. Experimental results demonstrate the mismatches between the actual coding bit-rates and the target bit-rates are reduced, while the coding performance of the encoder and the subjective visual quality of the reconstructed video are improved.