How to Set rav1e Tile Parallelism in FFmpeg

This article explains how to configure tile-parallelism in the rav1e AV1 encoder using FFmpeg. You will learn the exact command-line parameters needed to divide your video frames into tiles, enabling multi-threaded parallel encoding to significantly speed up your AV1 export times.

To configure tile-parallelism in rav1e via FFmpeg, you must use the -rav1e-params private option. This option allows you to pass specific parameters directly to the underlying librav1e library.

The two key parameters for configuring tiles are:

  • tile-rows: The number of horizontal tile divisions (expressed as a power of 2, e.g., 1 means \(2^1 = 2\) rows, 2 means \(2^2 = 4\) rows).
  • tile-cols: The number of vertical tile divisions (expressed as a power of 2, e.g., 1 means \(2^1 = 2\) columns, 2 means \(2^2 = 4\) columns).

Basic Command syntax

Here is a standard FFmpeg command template utilizing tile-parallelism with rav1e:

ffmpeg -i input.mp4 -c:v librav1e -rav1e-params tile-rows=1:tile-cols=1 -tile-parallel 1 output.mp4

Parameter Breakdown

  • -c:v librav1e: Selects the rav1e AV1 encoder.
  • -rav1e-params tile-rows=1:tile-cols=1: Splits the video frame into a 2x2 grid (4 tiles total). The values are logarithmic (base 2), so a value of 1 yields 2 partitions, and a value of 2 yields 4 partitions.
  • -tile-parallel 1: Enables parallel encoding of the defined tiles. This is crucial for forcing the encoder to process the tiles concurrently.

Choosing the Right Tile Configuration

The number of tiles you should configure depends on your CPU core count and the resolution of your video. Each tile can be processed by a separate thread.

  • For 1080p Video: A 1x2 grid (tile-rows=0:tile-cols=1, resulting in 2 tiles) or a 2x2 grid (tile-rows=1:tile-cols=1, resulting in 4 tiles) is recommended.
  • For 4K Video: A 2x2 grid (tile-rows=1:tile-cols=1, 4 tiles) or a 2x3 grid (tile-rows=1:tile-cols=2 (which is \(2^1 \times 2^2\) = 8 tiles)) works best to utilize higher CPU core counts.

Note that increasing the tile count beyond your available CPU threads will not yield extra performance and may slightly reduce compression efficiency.