Skip to content

Hardware accelerated video

Joni Lapilainen edited this page Jun 23, 2021 · 3 revisions

Requirements

Hardware accelerated video usually requires firmware built into kernel.
Install linux-firmware(-git) and see Radeon for detailed instructions.

Nouveau users will usually need to extract firmware blob from NVidia binary.
See https://nouveau.freedesktop.org/VideoAcceleration.html for instructions.

Intel hardware requires separate drivers installed.
Some Intel GPUs require additional firmware, some don't.

Installation

Video acceleration via VA-API can be enabled by installing libva:

butch install libva libva-utils

Libva is optional dependency for mesalib, ffmpeg, mpv etc.
If you have those installed, rebuild is necessary.

For Nouveau and Intel

butch rebuild mesalib-standard ffmpeg mpv

Intel hardware requires installation of additional drivers.
GMA 4500:

butch install intel-vaapi-driver-g45

Other Intel hardware:

butch install intel-vaapi-driver-std

or

butch install intel-media-driver

depending on your hardware.

See commit log of these packages to see which hardware is supported on which driver.

Alternatively, you can install intel-vaapi-driver meta package.
It defaults to intel-vaapi-driver-std. If you want another driver variant, add it to your $DEPS.

For Radeon:

butch rebuild mesalib-radeon ffmpeg mpv

If you have correct firmware in kernel and rebuild was successfully finished,
you can run vainfo which will display your driver and supported profiles.

Using

Play video with acceleration:

mpv -vo vaapi --hwdec=vaapi file.mkv

or

mpv -vo gpu --hwdec=vaapi file.mkv

MPEG-4 acceleration is disabled by default. It can be enabled with envvar:

export VAAPI_MPEG4_ENABLED=true

With hardware acceleration, CPU usage of my old Pentium4 dropped from
100% to 1% and it can actually decode 1080p content from Youtube flawlessly.

More info and troubleshooting

Arch Linux wiki page about Hardware video acceleration
Gentoo wiki page about VA-API