Presets as search pruning
A preset is a coordinated bundle of speed and compression choices. Many of them limit how many reference frames, block sizes, vectors and modes x264 tries, or how carefully it compares them: in that part, a faster preset is the same search with more of it pruned away. Others turn coding tools on or off, or change how quality is allocated across the picture and over time.
Step through x264's presets
The slider moves through x264's ten presets, fastest first. The bars are the five settings that are numbers; the dark tick on each track is medium's value, which is the default, and a bar is teal above it and coral below. Each bar has its own scale: its length compares a setting with medium's value, not one kind of work with another. Lookahead frames is the configured --rc-lookahead, not the encoder's total delay. The table lists the settings that are choices; a value that differs from medium's is in bold. Decision level is --subme, which sets both sub-pixel motion refinement and how candidates are compared.
| Setting | Value |
|---|---|
| Motion search | |
| Extra partition analyses | |
| Trellis | |
| B frame placement | |
| Direct prediction | |
| Weighted P prediction | |
| Mixed references | |
| Macroblock-tree | |
| Fast skip | |
| Arithmetic coder | |
| Deblocking filter | |
| 8×8 transform | |
| Adaptive quantization | |
| Weighted B prediction | |
| Scene-cut test |
Reading the steps:
- From medium to slow, the search widens and no tool is added. Five settings change: 5 reference frames for 3, decision level 8 for 7, 50 lookahead frames for 40, trellis on all mode decisions, and automatic choice of direct prediction.
- The slow end keeps widening the same search. veryslow reaches 16 references, 8 B frames, a 24-pixel range and the multi-hexagon pattern. placebo's last step selects the transformed exhaustive motion search, raises the decision level to 11, which turns off a set of mode-analysis shortcuts, and turns off fast skip (the shortcut, not skip itself). It still has search limits, and its motion search screens positions before the transformed comparison.
- The fast end removes tools as well as searches. ultrafast differs from medium in 17 of the 20 settings. Among them it turns off the arithmetic coder, the deblocking filter, the 8×8 transform, B frames, adaptive quantization, macroblock-tree, weighted prediction and the scene-cut test.
- Some settings are never assigned. No preset sets the rate control mode, its rate factor or quantizer target, or the psychovisual strengths. The resulting quantizers, quality and bitrate can still change through the other settings, and one stored value need not act the same in every preset: x264 uses the psychovisual rate-distortion strength only from decision level 6.
Why pruning costs bits, not correctness
Many of the settings above limit which candidates the encoder considers or how it measures them. A candidate that is not tried cannot be chosen, so a narrower search sometimes codes a block in a way that takes more bits or leaves more error than the best available. The stream stays valid, because the decoder is only told what was chosen. Some settings do something else. The arithmetic coder and the deblocking filter change which bitstream tools and decoder processes are used, and adaptive quantization and macroblock-tree change how quantizers are allocated.
Trade-offs
- The widest searches may spend much of their time on candidates that rarely win. This table explains the settings; it does not measure the speed or compression gained at each step.
- Explicit options can override a preset's values, and settings interact. x264's command line applies the preset before the other options and profile restrictions after them. Decision levels 10 and 11 need trellis on all mode decisions and adaptive quantization; without them x264 lowers the level to 9, so overriding one value can change another.
- Slower presets generally seek better compression efficiency for more encoding effort. At a matched measured quality that can mean fewer bits; at a matched bitrate, better quality. The size and order of the gains depend on the content and the test, and equal rate factors do not establish equal quality across presets. Rate control is the subject of the next unit.
Sources
Read 2026-11-15, at the commit linked.
- x264 at commit c24e06c (GitHub mirror): in
common/base.c, the defaults (references, B frames, lookahead, partitions, motion search, range, decision level, mixed references, weighted prediction, 8×8 transform, trellis, macroblock-tree, adaptive quantization) and the ten presets: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo; the mode-analysis shortcuts off at decision level 11 and 16×16 intra analysis, which no partition flag gates; what each partition flag turns on; inencoder/encoder.c, the psychovisual strength used only from level 6 and levels 10 and 11 lowered to 9; the screening in the transformed exhaustive search; inx264.c, presets applied before the other options, then the fast first pass and the profile;--presetin the command-line list. - Not checked: what each profile restricts and what the tunings set; the order of these steps for a program that calls the library itself; what "simple" and "smart" weighted prediction and the direct prediction modes do; x265's and SVT-AV1's presets, which a later page takes up; the speed and compression of any preset, which need measurement on real video.