Configure libvpx-vp9 Threads in FFmpeg

Optimizing video encoding speed with the VP9 codec in FFmpeg requires properly configuring CPU threading parameters. This guide explains how to use the -threads and -row-mt parameters within the libvpx-vp9 encoder to maximize your CPU utilization and significantly reduce encoding times without sacrificing video quality.

Understanding VP9 Threading Parameters

Unlike older codecs, the libvpx-vp9 encoder does not automatically utilize all available CPU cores efficiently just by setting the -threads parameter. To achieve true multi-threading, you must combine the threads count with row-based multi-threading and tiling parameters.

1. The -threads Parameter

This parameter defines the maximum number of threads the encoder is allowed to use.

-threads <number_of_threads>

2. The -row-mt Parameter (Crucial for Speed)

By default, VP9’s multi-threading is limited. Enabling row-based multi-threading (-row-mt 1) is the most important step to drastically improve encoding speed on multi-core processors.

-row-mt 1

3. Tile Columns and Rows (-tile-columns and -tile-rows)

VP9 divides video frames into “tiles” to process them in parallel. Threads are distributed across these tiles. The parameters use a \(log_2\) scale:

For a 1080p or 4K video, using -tile-columns 2 (4 tiles) is standard.


Here is how to combine these parameters for optimal encoding performance.

Standard Multi-Threaded Encoding (for 4 to 8 thread CPUs)

Use this setup for standard 1080p encoding on modern consumer processors:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -threads 8 -row-mt 1 -tile-columns 2 -tile-rows 1 output.webm

High-Performance Encoding (for 16+ thread CPUs)

For high-end CPUs (like AMD Ryzen 9 or Intel Core i9) encoding 4K video, increase the tile columns to allow more threads to work simultaneously:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 6M -threads 16 -row-mt 1 -tile-columns 3 -tile-rows 1 output.webm

Summary of Threading Limits

To ensure your -threads setting is actually used, match it to your tile settings: * With -tile-columns 1 (2 tiles), the maximum effective thread count is 2 (unless -row-mt 1 is active, which allows more threads to work on rows within those tiles). * With -tile-columns 2 (4 tiles) and -row-mt 1, you can efficiently utilize 8 to 12 threads. * With -tile-columns 3 (8 tiles) and -row-mt 1, you can efficiently utilize 16 or more threads.