In this letter, we propose a novel bitrate control, using both Kalman and FIR filters, based on a Hamiltonian analysis with respect to the amount of bits from each macroblock, in an encoding of a general video codec such as H.264/AVC. Since the proposed bitrate control is based on the simple computation of an optimal control method based on the Hamiltonian analysis, it is not necessary to use additional computation, such as a DCT or quantization, to estimate the bits for bitrate control. As a result, the proposed algorithm can be applied to single‐pass encoding and can provide sufficient encoding speed with respect to various applications, even those requiring real‐time control.