Encode VP9 Profile 2 10-Bit Video in FFmpeg

This guide provides a straightforward, step-by-step tutorial on how to encode video using the Google VP9 Profile 2 (10-bit color) codec in FFmpeg. You will learn the exact command-line arguments required to target 10-bit color depth, set the appropriate pixel format, and configure your encoding settings for optimal quality and compatibility.

Understanding VP9 Profile 2

The VP9 codec is divided into different profiles based on color depth and chroma subsampling. To achieve 10-bit color depth with standard 4:2:0 chroma subsampling, you must target Profile 2. Encoding in 10-bit is highly beneficial for high-dynamic-range (HDR) content and for reducing color banding in gradients.

To trigger VP9 Profile 2 in FFmpeg, you must use the libvpx-vp9 encoder and specify a 10-bit pixel format, such as yuv420p10le.

The Standard FFmpeg Command

The most effective way to encode to VP9 Profile 2 is by using the Constrained Quality (CQ) mode. This mode guarantees a consistent level of quality throughout the video.

Here is the recommended command:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -pix_fmt yuv420p10le -profile:v 2 -crf 30 -b:v 0 -c:a libopus output.webm

Command Breakdown

For the highest quality results, especially if you have a target file size or bitrate in mind, a 2-pass encoding method is recommended.

Pass 1:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -pix_fmt yuv420p10le -profile:v 2 -b:v 2M -speed 4 -pass 1 -an -f null /dev/null

(On Windows, replace /dev/null with NUL)

Pass 2:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -pix_fmt yuv420p10le -profile:v 2 -b:v 2M -speed 1 -pass 2 -c:a libopus -b:a 128k output.webm

Key Parameters for 2-Pass: