Decode video with VA-API
Use this guide to verify that a Linux machine’s hardware media engine can decode a video file through VA-API (libva), without setting up a GUI player or touching graphics or compute shaders.
Video decoding is a separate fixed-function job from rendering triangles or running CUDA/WebGPU kernels; see GPU programming for where VA-API fits alongside graphics and compute APIs.
Inspect supported drivers and codecs
Start by listing the active libva driver and hardware codec profiles:
vainfo
The opening lines name the driver answering VA-API requests: typically Intel’s iHD media driver on Intel GPUs, or Mesa’s Gallium VA-API driver on AMD GPUs.
If vainfo is missing, install your distribution’s vainfo / libva-utils package along with the media driver for your card.
On NVIDIA hardware, NVIDIA’s native Linux video stack is NVDEC and NVENC rather than VA-API; if vainfo succeeds on an NVIDIA box, it usually means the nvidia-vaapi-driver translator is installed on top of NVDEC.
Scan the profile table for your test file’s codec.
Look for matching pairs such as VAProfileH264Main with VAEntrypointVLD (hardware decode) or VAEntrypointEncSlice (hardware encode).
If your clip is H.264 and vainfo only advertises AV1, FFmpeg cannot decode that clip on the VA-API hardware path and will fail or fall back to CPU decoding.
Run a headless hardware decode test
Pick a short test clip whose codec appears in your vainfo output, then ask FFmpeg to decode it on the VA-API hardware device and discard the decoded frames:
ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -i clip.mp4 -f null -
Discarding frames to -f null - isolates the media engine from display compositing, windowing, and video scaling.
Check FFmpeg’s stderr output: you want to see VA-API active on the video stream without a device-initialization failure.
If FFmpeg logs that opening the VA-API device failed and then continues with a plain software decoder (such as h264 with no hardware surface), the command still finishes without crashing, but the CPU did the decoding rather than the GPU’s media block.
Notice the -hwaccel_output_format vaapi flag: it instructs FFmpeg to keep decoded frames inside GPU memory.
Omitting that flag still uses the hardware decoder when available, while copying every decoded frame back into system RAM — valid when a CPU filter needs the pixels, slower when you only want to verify pure hardware decode or hand frames to a hardware encoder.
What stays separate
This test verifies hardware decode only:
-
Putting pictures on screen is a separate graphics step. A player such as
mpv --hwdec=vaapi clip.mp4decodes through VA-API and hands the resulting surfaces to Vulkan, OpenGL, or KMS for presentation. -
Hardware encoding requires a matching
VAEntrypointEncSliceprofile invainfoplus an explicit VA-API encoder pipeline (such as uploading frames with-vf format=nv12,hwuploadand selecting a VA-API encoder). Confirm clean hardware decode first before debugging encode flags. -
Browser and Node environments: inside a web page, hardware video decode and encode go through WebCodecs (see GPU API lookup), not VA-API directly. Stock Node has neither WebCodecs nor a built-in VA-API binding unless your script shells out to a native tool like
ffmpeg.