Essential rav1e command-line flags for performance tuning

This article provides a direct guide to the most critical command-line flags used to optimize the performance of the rav1e AV1 video encoder. By understanding and configuring these essential parameters, you can effectively balance encoding speed, file size, and visual quality to suit your specific hardware and project requirements.

The Speed Preset (--speed or -s)

The --speed flag is the most influential setting for rav1e performance. It accepts integer values from 0 to 10. * Lower values (0–4): Provide the highest compression efficiency and visual quality but result in extremely slow encoding speeds. These are ideal for archival purposes. * Medium values (5–7): Offer the best balance between encoding time and video quality, making them suitable for general use-cases. * Higher values (8–10): Prioritize encoding speed above all else. Use these settings for fast drafts, real-time streaming, or testing.

Constant Quality (--quantizer or -q)

Instead of targeting a specific bitrate, rav1e performs best when using constant quality mode via the --quantizer flag. It accepts values from 0 to 255. * Lower values (e.g., 50–100): Produce high-quality, larger files. * Higher values (e.g., 100–150): Produce lower-quality, highly compressed files. * A value between 80 and 120 is generally recommended as a starting point for standard high-definition video.

Multi-threading and Tiles (--tile-cols and --tile-rows)

Because rav1e does not automatically scale perfectly across high-core-count CPUs, you must use tiles to enable parallel processing. Splitting the video frame into grid tiles allows different CPU threads to encode different sections of the frame simultaneously. * --tile-cols: Splits the frame vertically into 2^N columns (e.g., a value of 1 creates 2 columns, 2 creates 4 columns). * --tile-rows: Splits the frame horizontally into 2^N rows. * Note: While increasing tiles improves speed on multi-core processors, too many tiles can slightly degrade compression efficiency.

Thread Control (--threads)

By default, rav1e will attempt to use all available CPU threads. However, explicitly defining thread allocation using the --threads flag helps prevent CPU bottlenecks and allows you to manage system resources when running multiple background tasks.

Real-Time Tuning (--low-latency)

If you are using rav1e for live streaming or real-time communication, append the --low-latency flag. This command disables frame reordering and limits the look-ahead buffer, drastically reducing latency at the cost of some compression efficiency.