How to Set libaom CPU-Used Parameter?
Optimizing the cpu-used parameter in the libaom AV1
encoder is essential for balancing encoding speed and visual quality.
This article covers what the cpu-used parameter does, how
its values affect your encoding workflow, and practical command-line
examples for both VoD (Video on Demand) and real-time streaming
scenarios.
Understanding the cpu-used Parameter
The cpu-used parameter (often set via the
--cpu-used flag in FFmpeg or aomenc) dictates
the effort the encoder expends on compression efficiency versus
processing speed. In libaom, this parameter typically accepts integer
values ranging from 0 to 9.
- Lower Values (0–3): Prioritize maximum compression efficiency and visual quality at the expense of extremely slow encoding times. These are typically reserved for archival purposes.
- Medium Values (4–6): Offer the best balance for general Video on Demand (VoD) encoding, significantly reducing encoding time while retaining high quality.
- Higher Values (7–9): Prioritize speed over efficiency, making them ideal for real-time streaming, live broadcasting, or rapid prototyping.
Choosing the Right Value for Your Workflow
The optimal setting depends heavily on your hardware capabilities, time constraints, and project requirements.
| Preset Range | Target Workflow | Quality vs. Speed Tradeoff |
|---|---|---|
| 0 – 2 | Archival / Maximum Quality | Extremely slow; minor quality gains for massive time costs. |
| 3 – 4 | High-Quality VoD | Slow; excellent efficiency for final delivery. |
| 5 – 6 | Standard VoD / Default | Recommended sweet spot for a balanced, modern encode. |
| 7 – 9 | Real-Time / Live Streaming | Fast; sacrifices compression efficiency to maintain high frame rates. |
Practical FFmpeg Implementation Examples
When using FFmpeg with libaom-av1, you can pass the
parameter using -cpu-used.
Standard High-Quality VoD Encode
For standard video encoding where you want a great balance of file size and quality, a value of 4 or 5 is highly recommended:
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -cpu-used 4 -c:a libopus output.mkvReal-Time Live Streaming Encode
For live streaming scenarios where encoding must keep up with real-time playback, higher presets like 8 or 9 are necessary alongside a constant bitrate (CBR) configuration:
ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -maxrate 2M -bufsize 4M -cpu-used 8 -usage realtime output.mkvBy adjusting this single parameter, you can tailormake the AV1 encoding process to fit your specific deadline and hardware constraints.