FFmpeg librav1e Speed Preset Mapping Guide

This article explains how FFmpeg maps its standard, text-based speed presets to the internal numeric speed levels of the librav1e AV1 encoder. We will break down the specific translation values, explain the differences between using the generic -preset and encoder-specific -speed options, and provide practical examples for optimizing your encoding workflow.

The Rav1e Speed Scale Explained

Unlike traditional encoders like libx264 or libx265 which natively use text-based presets, the rav1e encoder operates on a strict numeric scale ranging from 0 to 10: * Speed 0 (Slowest): Offers the highest compression efficiency and quality but requires the longest processing time. * Speed 10 (Fastest): Offers the fastest encoding speeds at the expense of compression efficiency and visual quality.

To make the encoder accessible to users accustomed to standard FFmpeg workflows, FFmpeg’s librav1e wrapper translates standard string presets into these numeric values.

FFmpeg -preset to librav1e Mapping

When you use the standard -preset option in FFmpeg, the wrapper maps the string values to rav1e’s 0–10 scale as follows:

FFmpeg -preset Value Internal librav1e Speed Level Purpose / Use Case
placebo 0 Maximum possible compression, extremely slow (mostly experimental).
veryslow 1 Ultra-high quality archiving.
slower 2 High-quality archiving where time is not a major constraint.
slow 3 or 4 Balanced high-quality encoding (exact mapping depends on the FFmpeg version).
medium 5 The default balance of speed and efficiency.
fast 6 Faster encoding for everyday use.
faster 7 Rapid encoding with acceptable quality loss.
veryfast 8 High-speed encoding, suitable for fast turnarounds.
superfast 9 Draft-quality testing and high-speed streaming.
ultrafast 10 Maximum speed, lowest quality; useful for debugging or real-time capture.

Direct Control: The -speed Option

While using -preset is convenient, FFmpeg allows you to bypass this mapping entirely and communicate directly with librav1e using the private -speed option. This is often preferred because it avoids any translation ambiguity.

To set the speed directly, use the following syntax in your FFmpeg command:

ffmpeg -i input.mp4 -c:v librav1e -speed 5 output.mkv

Alternatively, you can pass the speed parameter using the generic -rav1e-params flag:

ffmpeg -i input.mp4 -c:v librav1e -rav1e-params speed=5 output.mkv

Performance and Quality Considerations

When selecting a preset or speed level for librav1e, keep these behaviors in mind:

  1. The Diminishing Returns of Low Speeds: Speeds below 3 (like slower and veryslow) require immense CPU resources and take significantly longer to encode. The file-size savings compared to Speed 4 or 5 are often negligible for casual use.
  2. Real-Time Thresholds: For real-time 1080p encoding, speeds of 8 (veryfast) to 10 (ultrafast) are typically required, depending on your CPU hardware.
  3. The Default State: If you do not specify a -preset or a -speed value in your FFmpeg command, the wrapper defaults to Speed 6 (fast), which provides a reasonable starting point for most modern systems.