Constant quantizer, constant rate factor, average bitrate and constant bitrate
Rate control chooses a starting quantization parameter (QP) for every frame; an encoder may then adjust it within the frame. The four common modes differ in what they aim at: a fixed quantizer, an encoder quality setting, an average bitrate for the whole stream, or an average bitrate under a limit on bursts. A target is not a guarantee, and whatever a mode pursues, something else has to move.
Four modes on one sequence
The sequence is ten seconds long: a quiet section, a busy one and one in between, each with an invented complexity (shaded lightest to darkest in the plots). A frame's modeled size rises with its complexity and falls as its quantizer rises. Choose a mode and its target, and compare what stays flat. The sizes are modeled and quality is not measured. The model has no frame types, and macroblock-tree, which x264 has on by default, is off.
- Constant quantizer: every frame gets the QP you set.
- Constant rate factor (CRF): the number selects a rate factor, not a bitrate or a measured quality. In this model a frame of complexity 80, a reference value chosen for the demo, gets the QP you set; busier frames get a higher QP and quieter ones a lower QP.
- Average bitrate (ABR): the same shaping, with the level adjusted as it goes so the total comes out near the bitrate.
- Constant bitrate (CBR), here a constrained average bitrate: average bitrate, plus a buffer of one second that must not be overdrawn, with the encoder pushed to use more of that budget. Frame sizes still vary. No filler is added and delivery is not modeled.
--qcomp 0.6 and macroblock-tree off: the rate factor formula with a reference complexity of 80 chosen for the demo, where x264 scales by the picture's size in macroblocks and by whether B frames and macroblock-tree are on; the average bitrate feedback with its usual bound of 4 QP between frames, started at QP 24; and the buffer rule. In its constant bitrate mode the demo keeps the average bitrate feedback running, where x264 switches it off, and it leaves out the decay x264 applies to its running sums. Not modeled: frame types, x264's size predictors (the demo knows each frame's size exactly), and macroblock-tree, which changes how the rate factor is applied. The two "by section" tiles give the averages for the quiet, busy and medium sections in that order.With the sliders at 26 and 700:
- Constant quantizer let size follow complexity completely. QP 26 throughout; frames averaged 10.1, 40.7 and 20.2 kilobits in the three sections, and the stream 711 kbit/s.
- The rate factor moved QP against complexity, part of the way. QP 23.6, 28.4 and 26.0; frames 13.7, 30.0 and 20.1 kilobits; 638 kbit/s. Nothing told it what size to hit.
- Average bitrate reached its number by feedback, and feedback lags. It started at QP 24, found the quiet section cheap and fell to about 19.5, then climbed to 28.1 in the busy section. After ten seconds it stood at 736 kbit/s, 5% over.
- Constant bitrate flattened size the most. Frames 22.1, 28.3 and 20.6 kilobits; 710 kbit/s. The quiet section got a mean QP of 20.0, because this mode spends budget the buffer could not keep for later. The model has no pictures, so it cannot say whether that lower QP would show. These are this model's numbers, not a prediction of x264 at the same settings.
The modes in x264
--qp sets constant quantizer, --crf the rate factor and --bitrate average bitrate in kbit/s; the default is --crf 23. Constant bitrate is not a mode of its own: it is one-pass average bitrate under a buffer whose maximum rate is no higher than the bitrate, which the next page explains. The rate factor is not a quality measure.
Frame types, filler and the feedback options
--qpis the QP of P frames, with I and B frames offset from it.- The buffer is given by
--vbv-bufsizeand--vbv-maxrate, and that setup turns on a minimum-rate behavior. Such a stream may still use less than the maximum rate: x264 pads with filler only under--filler, which--nal-hrd cbrturns on. --ratetol(default 1.0) sets how strongly average bitrate feedback reacts to drift; it is not a band without feedback or a guarantee around the target.--qpstep(default 4) sets the usual bound on how far QP moves between frames in average bitrate. Strong feedback widens the bound, and the buffer rule acts after it.- x264 computes each frame's quantizer scale as its complexity raised to a power, divided by a constant derived from
--crf. Its source calls the scaling of that constant arbitrary, meant to make the rate factor somewhat similar to a QP; it is not found from the video's average frame. The last page of this unit is about that power.
Trade-offs
- A quality setting gives an unpredictable size; a size target moves the quantizer. The first two modes cannot promise a bitrate. The last two raise QP on busy content, which can add error there; this model measures sizes and QP, not error.
- One pass lacks statistics for the whole sequence. A lookahead can inspect a limited window ahead, but average bitrate overspent on the quiet opening here because it had seen nothing harder. Two passes plan the budget from the whole file when it is available; they do not guarantee an exact hit.
- A minimum-rate policy can spend extra bits on easy pictures. Strict constant bitrate goes further and pads with filler when it must. Both are for channels that cannot carry more and gain nothing from less.
Sources
Read 2026-11-15, at the commit linked.
- x264 at commit c24e06c (GitHub mirror): in
encoder/ratecontrol.c, the quantizer scale for a QP,get_qscalewith complexity raised to a power and the macroblock-tree form, the constant derived from the rate factor and the comment on its scaling, the short-term average of complexity, the rate factor path and the average bitrate path, the feedback left out in the minimum-rate case, the feedback term, the bound on QP change between frames and its widening under strong feedback, the running sums updated after a frame, the buffer rule and the test that turns on the minimum-rate behavior, the decay of the running sums, the constant QP of each frame type and filler, or the buffer level capped without it; inencoder/encoder.c, filler turned on by the constant bitrate signaling mode; incommon/base.c, the default mode and rate factor,--ratetoland--qpstep,--bitrate; the options in the command-line list and--filler. - Not checked: x264's complexity measure and size predictors (the demo invents complexity and knows sizes exactly); rate control within a frame; how macroblock-tree changes the picture beyond the line cited; rate control in x265, libaom and SVT-AV1; what any of these modes does to quality on real video.