Libaom AV1 cpu-used Parameter Explained
The -cpu-used parameter in the libaom AV1 encoder
wrapper controls the trade-off between encoding speed and compression
efficiency. By adjusting this setting, users dictate how exhaustively
the encoder searches for optimal compression paths using Rate-Distortion
Optimization (RDO). Lower values force the encoder to evaluate more
compression tools and partition possibilities, yielding higher quality
per bit at the cost of significantly longer encode times, while higher
values employ heuristics to speed up processing at the expense of
compression density.
The Role of -cpu-used
In the standard libaom AV1 implementation, -cpu-used
accepts integer values generally ranging from 0 to
8 (with values up to 11 supported in specific
real-time configurations). Despite its name, the parameter does not
adjust how many CPU cores or threads the encoder uses; thread allocation
is handled separately by parameters like -threads and
-row-mt. Instead, -cpu-used acts as a
speed-versus-efficiency preset.
How Compression Efficiency is Adjusted
When video is compressed with AV1, the encoder must make thousands of
decisions per frame regarding how to divide images, predict motion, and
transform residuals. The -cpu-used setting directly governs
the depth and complexity of these algorithms:
- Block Partitioning: AV1 supports recursive block
partitioning from 128x128 down to 4x4 pixels, including non-square
rectangular splits. At low
-cpu-usedsettings (e.g.,0to2), libaom tests nearly every possible split combination via full RDO. At higher settings (e.g.,5to8), early termination heuristics prune unlikely split candidates, drastically reducing computation while slightly lowering compression efficiency. - Motion Estimation: Lower values allow extensive motion search ranges, complex sub-pixel interpolation, and evaluation of compound prediction modes (such as warped motion and global motion). Higher values restrict search windows and limit the candidate pool for reference frames.
- Intra and Inter Prediction Modes: AV1 includes
directional intra modes, angle deltas, and multi-reference inter modes.
A low
-cpu-usedvalue tests numerous mode candidates to find the most bit-efficient prediction. A higher value skips subtle directional variations based on earlier statistical evaluations. - Loop Filters and In-Loop Restoration: Features like the Constrained Directional Enhancement Filter (CDEF) and Wiener/Subspace filters can be fine-tuned or evaluated coarsely depending on this setting. Higher presets reduce the iterations spent optimizing filter strengths.
Efficiency Across the Value Spectrum
- Presets 0 to 2 (Exhaustive Search): These values produce the highest possible compression efficiency, but they introduce extreme computational overhead. Encoding can be tens of times slower than higher presets, often for negligible gains (typically 1–3% bitrate savings over preset 3 or 4). Preset 0 is generally reserved for research.
- Presets 3 to 4 (High Efficiency / Archival): These values offer an optimal balance for archival purposes. They preserve most advanced RDO mechanisms while pruning redundant evaluation paths, delivering near-maximum compression within manageable timeframes.
- Presets 5 to 6 (Standard VOD Sweet Spot): For practical video-on-demand (VOD) encoding, preset 5 or 6 is standard. They strike the optimal curve between speed and compression, yielding significantly faster encoding passes while maintaining compression efficiency superior to older codecs like VP9 and H.264.
- Presets 7 to 8 (Fast / Real-Time Encoding): These settings disable extensive RDO evaluations and rely heavily on aggressive spatial-temporal heuristics. While compression efficiency drops noticeably—requiring higher bitrates to match the visual fidelity of lower presets—encoding speeds increase drastically, making them suitable for fast turnaround or real-time workflows.