VP9 QSV Hardware Decoding in FFmpeg on Linux

This guide explains how to leverage Intel Quick Sync Video (QSV) for hardware-accelerated VP9 decoding and transcoding using FFmpeg on Linux. You will learn the necessary driver prerequisites, how to verify your system configuration, and the exact FFmpeg command-line syntax required to decode VP9 videos using Intel hardware acceleration.

Prerequisites and Driver Setup

To use QSV hardware acceleration on Linux, you need an Intel processor with integrated graphics that supports VP9 hardware decoding (Intel Core 6th generation “Skylake” or newer for VP9 8-bit, and 7th generation “Kaby Lake” or newer for VP9 10-bit).

Ensure your Linux system has the following software installed:

  1. Intel Media Driver: Install the modern intel-media-driver (often packaged as intel-media-va-driver-non-free or intel-media-driver depending on your distribution).
  2. VA-API and OneVPL/MSDK: Ensure libva and the Intel oneVPL (or the older Intel Media SDK) runtime libraries are installed.
  3. FFmpeg with QSV Support: Your FFmpeg binary must be compiled with the --enable-libmfx or --enable-libvpl configuration flags.

To ensure FFmpeg defaults to the correct Intel driver, set the following environment variable in your terminal:

export LIBVA_DRIVER_NAME=iHD

You can verify that your hardware supports VP9 decoding by running:

vainfo | grep VP9

Look for VAProfileVP9Profile0 and VAProfileVP9Profile2 with VAEntrypointVLD in the output, which indicates hardware decoding support.

The FFmpeg Transcoding Command

To transcode a VP9 video using the hardware-accelerated vp9_qsv decoder, use the following FFmpeg command. This example decodes a VP9 .webm file in hardware and transcodes it to an H.264 .mp4 file using the h264_qsv hardware encoder:

ffmpeg -hwaccel qsv -c:v vp9_qsv -i input.webm -c:v h264_qsv -b:v 5M output.mp4

Parameter Explanation

High-Performance Zero-Copy Pipeline

To achieve maximum performance, you should keep the decoded video frames entirely inside the GPU memory (VRAM) without copying them back to system memory (RAM). You can force a pure hardware pipeline using the following command:

ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v vp9_qsv -i input.webm -c:v h264_qsv -b:v 5M output.mp4

Using this syntax minimizes CPU overhead, ensuring that both the VP9 decoding and the subsequent encoding are processed entirely on the Intel graphics hardware.