Recipes: on-demand ladder, low-latency live, high-quality, grain
A recipe is a short list of settings chosen for one job, with a reason for each. This page gives four: a rung of an on-demand ladder, a low-latency live stream, a high-quality lossy copy for storage, and a grainy source. Each is written for x264, because that is the encoder this course has read most closely. The values marked as examples are places to start looking, not answers.
Build a command line
Choose a scenario. Where the input's frame rate, a maximum rate and a duration matter, set them and the command line follows: the keyframe interval is the frame rate times the seconds, and the buffer is sized from the rate. The frame rate is an assumption about the input, which has to be constant-rate at that figure: the command neither checks nor changes it. The maximum rate is --vbv-maxrate, the fill rate of x264's buffer model, not a cap on every short stretch of the stream. For the ladder rung the seconds are the segment length; for live they are the longest spacing between keyframes. Controls a scenario does not use are switched off.
| Option | Why it is there |
|---|
- At 30 frames a second and 4-second segments, the ladder rung has a fixed keyframe interval of 120 frames. At 60 frames a second and 6-second segments it is every 360.
- For a maximum rate of 5 Mbit/s its buffer is 10000 kbit, a capacity equal to two seconds at that rate. That is not how long a burst can last: in a simple budget count, a full buffer spent at 15 Mbit/s while it refills at 5 is empty in one second. The live recipe's is 5000 kbit.
- The ladder rung and the live stream each set 6 options; the lossy copy sets 2. The fewer constraints a job has, the more it leaves to the defaults.
Why these and not others
- The ladder rung fixes its keyframes by turning the scene-cut test off, not by
--min-keyint. x264 limits the shortest keyframe distance to half of--keyintplus one, so setting the two equal does not hold the spacing. The price is that a real scene cut gets no keyframe of its own. Matching keyframes across rungs also needs the same frames and timestamps in every rung, and a packager that cuts on them. - Live gives up the tools that need the future. The zerolatency tuning sets the lookahead and B frames to zero and switches macroblock-tree off, among other changes, so coding a frame does not wait on those tools. The buffer limits how far the rate can stray; the delivery chain still decides much of the delay.
- The lossy copy has no rate control beyond the rate factor. No cap, no buffer, and x264's default keyframe interval. A low rate factor is not lossless, and lossless coding would only be exact for the pictures the encoder is given, after any change of chroma format or bit depth.
- Grain is a choice between two formats' tools. x264 has no grain synthesis in the decoder; its tuning favors keeping grain in the coded pictures. An AV1 encoder can model grain and signal it for the decoder to synthesize. The options, and the separate switches for denoising, are on the AV1 settings map; their behavior was not read for this course.
Trade-offs
- A recipe is a starting point. The content decides the numbers, which is the argument of per-title encoding.
- Every recipe leaves the defaults in charge of everything it does not name, and x264 may change some of what it does name: see the interaction map.
- None of this was measured. Before adopting a recipe, compare it with its alternatives as a test, on your own content.
Sources
Read 2026-11-15, at the commit linked. The lines on minimum-rate behavior, filler and the default chroma format were read 2026-11-16.
- x264 at commit c24e06c (GitHub mirror): the limit on the shortest keyframe distance in
encoder/encoder.c;--no-scenecutin the option list; the zerolatency tuning and the grain tuning incommon/base.c, with the default chroma format; inencoder/ratecontrol.c, the minimum-rate behavior a maximum rate at or below the target turns on and filler written only when it is switched on. What every other option does is cited on the page its row links to. - libaom at commit 1b7f9ef (GitHub mirror):
--denoise-noise-level. SVT-AV1 at commit d0d5c7e (GitHub mirror):--film-grain. Names only; the AV1 settings map cites the rest. - Not checked: any of the four recipes on real video; segment alignment in a packager; delay in a real live chain; what a streaming service or archive requires; x265 and AV1 versions of the first three recipes.