FFmpeg rav1e Speed and Quality Settings

This article explains how to configure the speed and quality parameters for the rav1e AV1 encoder when using FFmpeg. You will learn how to use specific command-line flags to control the encoding presets, set the constant quality level, and balance compression efficiency with processing time.

To encode video with rav1e in FFmpeg, you must specify the encoder using -c:v librav1e. Controlling the output requires adjusting two primary variables: encoding speed (presets) and output quality (quantizer or bitrate).

Controlling Encoding Speed

The speed of the rav1e encoder is managed using the -preset option.

For example, to run a high-quality but slow encode, use a lower preset:

ffmpeg -i input.mp4 -c:v librav1e -preset 3 output.mkv

For a fast test encode, use a higher preset:

ffmpeg -i input.mp4 -c:v librav1e -preset 8 output.mkv

Controlling Video Quality

To control the visual quality of the output, you can choose between Constant Quality (QP) mode or Target Bitrate mode.

Constant Quality mode ensures that every frame of the video meets a specific quality threshold, regardless of how much bitrate is required to achieve it. This is done using the -qp flag.

Example command using Constant Quality:

ffmpeg -i input.mp4 -c:v librav1e -qp 100 -preset 5 output.mkv

2. Target Bitrate Mode

If you need your output file to fit within a specific size constraint, you can set a target bitrate using the -b:v flag instead of using -qp.

Example command using Target Bitrate:

ffmpeg -i input.mp4 -c:v librav1e -b:v 2M -preset 6 output.mkv

Combining Settings for Optimal Results

For most use cases, a combination of a medium-range preset and a constant quality value yields the best results. The following command balance speed and quality for a standard archival or streaming export:

ffmpeg -i input.mp4 -c:v librav1e -preset 5 -qp 90 -c:a copy output.mkv

In this command: * -c:v librav1e selects the rav1e AV1 encoder. * -preset 5 provides a balanced encoding speed. * -qp 90 ensures a high level of visual fidelity. * -c:a copy copies the audio stream without re-encoding to save time and preserve original audio quality.