How to Set rav1e Encoder Speed in FFmpeg
This article provides a quick guide on how to configure the speed
parameter for the rav1e AV1 video encoder using FFmpeg. You
will learn the correct command-line syntax, the range of available speed
values, and how to balance encoding velocity against compression
efficiency to get the best results for your video projects.
To adjust the encoding speed of the rav1e encoder in
FFmpeg, you must use the -speed private option. The speed
scale for rav1e ranges from 0 to 10, where
lower numbers prioritize compression efficiency (resulting in smaller
files but extremely slow encode times) and higher numbers prioritize
processing speed (resulting in faster encodes but lower compression
efficiency).
The FFmpeg Command Syntax
Here is the basic command template to set the speed parameter:
ffmpeg -i input.mp4 -c:v librav1e -speed 5 output.mp4Understanding the Speed Values
- 0 (Slowest): Offers the maximum compression efficiency and visual quality. This level is extremely resource-intensive and is typically used only for archival purposes or benchmarking.
- 5 to 6 (Balanced default): This range is the recommended sweet spot for general use, offering a reasonable compromise between encoding time and output quality.
- 10 (Fastest): The fastest encoding speed. This is ideal for rapid testing or real-time streaming experiments, though it will result in larger file sizes.
Combining Speed with Quality Controls
When configuring the speed, you should also define your quality
target. In FFmpeg, rav1e supports quality control using the
Quantizer Parameter (-qp). The -qp scale
ranges from 0 to 255 (where lower values mean higher quality).
For example, to encode a video with a balanced speed of 6 and a high-quality target QP of 80, use the following command:
ffmpeg -i input.mp4 -c:v librav1e -speed 6 -qp 80 output.mp4