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:
- Intel Media Driver: Install the modern
intel-media-driver(often packaged asintel-media-va-driver-non-freeorintel-media-driverdepending on your distribution). - VA-API and OneVPL/MSDK: Ensure
libvaand the Intel oneVPL (or the older Intel Media SDK) runtime libraries are installed. - FFmpeg with QSV Support: Your FFmpeg binary must be
compiled with the
--enable-libmfxor--enable-libvplconfiguration flags.
To ensure FFmpeg defaults to the correct Intel driver, set the following environment variable in your terminal:
export LIBVA_DRIVER_NAME=iHDYou can verify that your hardware supports VP9 decoding by running:
vainfo | grep VP9Look 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.mp4Parameter Explanation
-hwaccel qsv: Enables the Intel Quick Sync Video hardware acceleration framework.-c:v vp9_qsv: Explicitly selects the Intel hardware-accelerated VP9 decoder instead of the default software decoder.-i input.webm: Specifies the input VP9 video file.-c:v h264_qsv: Selects the hardware-accelerated H.264 encoder. You can substitute this withhevc_qsvorav1_qsvif your GPU supports those formats.-b:v 5M: Sets the output video bitrate to 5 Mbps.
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.mp4Using this syntax minimizes CPU overhead, ensuring that both the VP9 decoding and the subsequent encoding are processed entirely on the Intel graphics hardware.