Linux FFmpeg Hardware Acceleration Guide

This article provides a straightforward, technical guide on how to identify and verify the available hardware acceleration methods for FFmpeg on a Linux system. It covers the essential commands to list supported hardware encoders and decoders, check your specific GPU capabilities, and troubleshoot common driver issues to ensure your video processing is fully hardware-accelerated.

Step 1: List FFmpeg’s Built-In Hardware Support

Before checking your system’s actual hardware, you can ask FFmpeg to report which hardware acceleration APIs it was compiled to support. Run the following command in your terminal:

ffmpeg -hwaccels

This will output a list of hardware acceleration methods that your specific installation of FFmpeg understands. Common outputs on Linux include:

Step 2: Verify Your System GPU and Drivers

Just because FFmpeg supports an API doesn’t mean your hardware or drivers are ready. You need to check what GPU you have and if the correct libraries are installed.

For Intel and AMD Graphics (VAAPI)

Most Linux distributions use VAAPI for Intel and integrated/dedicated AMD cards. To check if VAAPI is properly configured on your system, install the vainfo utility via your package manager and run it:

vainfo

If successful, this command will print your graphic driver information followed by a list of supported entrypoints (e.g., VAProfileH264Main : VAEntrypointEncSlice means your hardware supports H.264 encoding).

For NVIDIA Graphics (CUDA/NVENC)

If you are using an NVIDIA GPU with the proprietary drivers, you can verify that your system sees the graphics card and check the driver version by running:

nvidia-smi

To see if FFmpeg can specifically access the NVIDIA encoders and decoders, you can filter FFmpeg’s full codecs list for NVIDIA-specific tools:

ffmpeg -codecs | grep nv

Step 3: Check Specific Codec Support in FFmpeg

To see the exact hardware-accelerated decoders and encoders available for use right now in your FFmpeg binary, you can use the -decoders and -encoders flags.

Find Hardware Decoders (Decoding/Playback)

To see which hardware decoders are available (for example, for HEVC/H.265 or H.264), run:

ffmpeg -decoders | grep -E "vaapi|nvdec|cuvid|qsv"

Find Hardware Encoders (Encoding/Compression)

To see which hardware encoders are available for compressing video, run:

ffmpeg -encoders | grep -E "vaapi|nvenc|qsv"

The output will show codes like h264_nvenc (NVIDIA H.264 encoder) or hevc_vaapi (Intel/AMD HEVC encoder), confirming that you can now run your FFmpeg commands with hardware acceleration enabled.