How to Enable VP9 Row-Based Multithreading
This article explains how to enable and configure row-based multi-threading for the libvpx-vp9 encoder to significantly accelerate video encoding speeds on modern multi-core processors. You will learn the specific FFmpeg parameters required to activate this feature, how it interacts with tile-based threading, and how to optimize your settings for the best balance of speed and video quality.
Understanding Row-Based Multi-Threading in VP9
Traditionally, the VP9 encoder (libvpx-vp9) relied on column-based tiling to distribute encoding workloads across multiple CPU threads. While effective, this approach required dividing the video frame into distinct vertical tiles, which could degrade compression efficiency and video quality if too many tiles were used.
Row-based multi-threading (Row-MT) solves this limitation. When enabled, it allows the encoder to process rows of blocks within a single tile concurrently using a dependency-graph approach. This drastically improves CPU utilization on modern processors with high core counts (such as AMD Ryzen or Intel Core i7/i9/Xeon) without requiring a high number of tile columns, thereby preserving visual quality.
How to Enable Row-MT in FFmpeg
To enable row-based multi-threading in FFmpeg, you must use the
-row-mt 1 flag along with appropriate threading and tiling
parameters.
Here is a standard FFmpeg command template:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -tile-columns 2 -threads 8 -row-mt 1 output.webmKey Parameter Breakdown
-row-mt 1: This is the crucial switch. Setting it to1enables row-based multi-threading. Setting it to0(the default in older libvpx versions) disables it.-tile-columns <value>: Specifies the number of tile columns to create, represented as a power of 2 (\(2^N\)).-tile-columns 1= 2 columns-tile-columns 2= 4 columns (recommended for 1080p)-tile-columns 6= 64 columns (maximum value)
-threads <value>: Sets the maximum number of threads the encoder is allowed to use. For Row-MT to work effectively, this should be set to match or slightly exceed the number of logical cores you want to dedicate to the encoding process.
Recommended Settings for Common Resolutions
To achieve the best encoding speeds, adjust your tile columns based on the resolution of your source video:
- 1080p (FHD): Use
-tile-columns 2(4 tiles) and-threads 8(or higher) with-row-mt 1. - 4K (UHD): Use
-tile-columns 3(8 tiles) and-threads 16(or higher) with-row-mt 1. - 720p and below: Use
-tile-columns 1(2 tiles) and-threads 4with-row-mt 1.
By pairing -row-mt 1 with these tiling configurations,
you will see a substantial reduction in encoding times on modern
multi-core systems while maintaining excellent VP9 compression
efficiency.