Interaction map: which settings fight and which need each other
An encoder's settings are not independent. Some switch others off, some do nothing unless another is set, and some pull the same quantity in opposite directions. x264 resolves many of these cases itself when it starts, often without a message. This page lists selected rules it applies, read from the code that checks the parameters.
What needs what
Set one thing, see what else moves
Choose a setting to see selected rules it can trigger, each with the line of x264's source that applies it. A row states its condition where it has one, and other options or later checks can change the outcome, so a row is not a prediction of one encode. "With a warning" marks a rule that prints a message when it applies.
| Setting affected | Rule |
|---|
- Six of the 44 rules listed print a warning when they apply, all about the buffer model or a missing lookahead. The other 38 change or disable something without a message.
- Lossless coding has the most rules, 10, none with a warning. Two are the constant quantizer's, which lossless coding becomes.
- What is requested, what a tuning assigns and what takes effect can differ.
--tune psnrassigns adaptive quantization off. Macroblock-tree is still requested, so validation switches adaptive quantization's offset storage back on at strength 0, and macroblock-tree can still use it. - Macroblock-tree is the tool most often switched off: by constant quantizer, by a lookahead of 0, by
--qcomp 1or--keyint 1, and by the zerolatency tuning. - A psychovisual strength can be set and do nothing. With
--submebelow 6 or--trellis 0the value stays as given and the code that uses it does not run.
Where each tool enters the cost
Most of these tools act on the same decision rule, the cost J = D + λ × R of rate-distortion optimization, which is why they interact. This table says where each one enters, as the pages on each tool established it for x264.
| Tool | What it moves |
|---|---|
| Rate control | Each frame's quantization parameter (QP), and λ with it |
| Adaptive quantization | QP, and λ, block by block, from the block's own energy |
| Macroblock-tree | QP, and λ, block by block, from how much later frames use the block |
| Psychovisual optimization | D: adds a term for lost texture energy |
| Trellis quantization | The levels, chosen by D + λ × R inside a block |
| Motion search | Its own, cheaper cost: a difference measure plus λ times the vector's bits |
Adaptive quantization and macroblock-tree each contribute a per-block quantizer adjustment within the active rate control mode, under x264's own rules for when each applies, which is why macroblock-tree stores its offsets through adaptive quantization. An active psychovisual term changes the costs of candidates in the paths that use it, and x264 lowers the chroma offset when one is in effect.
Trade-offs
- Quiet fixes keep encodes from failing and hide what ran. When comparing two encodes, record the effective configuration and the warnings, not only the command line. x264 hands its parameters back through its interface, can write an options string into the stream's user data, and writes one at the head of a two-pass statistics file. None of these says which tools ran on a given frame.
- A tuning or profile is a bundle of these changes. x264's command line applies the preset and tuning first and your own options after them, wherever they sit on the line. First-pass shortcuts, profile restrictions and validation come later and can still change the request or refuse it:
--profile baselinestops with an error on input it cannot hold. - These are x264's rules. x265 and the AV1 encoders have their own, which were not read.
Sources
Read 2026-11-15, at the commit linked. The order of the command line, the stored offsets a second pass reads, the three records of the settings and the lossless test were read 2026-11-16.
- x264 at commit c24e06c (GitHub mirror):
validate_parametersinencoder/encoder.c, where every rule in the table that links to that file was read, including the comment that macroblock-tree needs adaptive quantization on; the tunings andx264_param_apply_profileincommon/base.c, with the requests a profile refuses. Each row of the table links to its own line. Inx264.c, the preset and tuning applied before other options, then the first-pass shortcuts and the profile. The second pass reading macroblock-tree's stored offsets and the options line of the statistics file inencoder/ratecontrol.c; the parameters handed back inencoder/encoder.c; the options string in user data inencoder/set.c. The lossless test is on the stored quantizer, which for constant rate factor is the rate factor plus the bit-depth offset, so--crf 0reaches it at 8 bits. - Not checked: x264's rules for options this course does not explain (interlacing, slices, threads, intra refresh, the Blu-ray and AVC-Intra modes); the same rules in x265, libaom and SVT-AV1; the lossless branch at bit depths over 8; when x264 writes its options string into a stream; clipping of the two per-block adjustments; the chroma lambda offset, which an earlier draft of this table listed and which was not re-read.