Hardware video acceleration
Hardware video acceleration makes it possible for the video card to decode/encode video, thus offloading the CPU and saving power.
There are several ways to achieve this on Linux:
- Video Acceleration API (VA-API) is a specification and open source library to provide both hardware accelerated video encoding and decoding, developed by Intel.
- Video Decode and Presentation API for Unix (VDPAU) is an open source library and API to offload portions of the video decoding process and video post-processing to the GPU video-hardware, developed by NVIDIA.
- NVDECODE/NVENCODE - NVIDIA's proprietary APIs for hardware video acceleration, used by NVIDIA GPUs from Fermi onwards.
For pre-2007 video cards see XvMC. For comprehensive overview of driver and application support see #Comparison tables.
Installation
Intel
Intel graphics open-source drivers support VA-API:
- HD Graphics series starting from Broadwell (2014) and newer are supported by intel-media-driver.
- GMA 4500 (2008) and newer GPUs, including HD Graphics up to Coffee Lake (2017) are supported by libva-intel-driver.
- GMA 4500 H.264 decoding is supported by libva-intel-driver-g45-h264AUR, see Intel#Hardware accelerated H.264 decoding on GMA 4500.
- Haswell refresh to Skylake VP9 decoding and Broadwell to Skylake hybrid VP8 encoding is supported by intel-hybrid-codec-driverAUR.
- Skylake or later also need linux-firmware.
Also see VAAPI supported hardware and features.
NVIDIA
Nouveau open-source driver supports both VA-API and VDPAU:
- GeForce 8 series and newer GPUs up until GeForce GTX 750 are supported by libva-mesa-driver and mesa-vdpau.
- Requires nouveau-fwAUR firmware package, presently extracted from the NVIDIA binary driver.
NVIDIA proprietary driver supports via nvidia-utils:
- VDPAU on GeForce 8 series and newer GPUs;
- NVDECODE on Fermi and newer GPUs ;
- NVENCODE on Kepler and newer GPUs.
ATI/AMD
ATI and AMDGPU open-source drivers support both VA-API and VDPAU:
- VA-API on Radeon HD 2000 and newer GPUs is supported by libva-mesa-driver.
- VDPAU on Radeon R300 and newer GPUs is supported by mesa-vdpau.
AMDGPU PRO proprietary driver is built on top of AMDGPU driver and supports both VA-API and VDPAU.
Translation layers
- libva-vdpau-driver — A VDPAU-based backend for VA-API.
- https://cgit.freedesktop.org/vaapi/vdpau-driver || libva-vdpau-driver, libva-vdpau-driver-chromiumAUR, libva-vdpau-driver-vp9-gitAUR
- libvdpau-va-gl — VDPAU driver with OpenGL/VAAPI backend. H.264 only.
Verification
Your system may work perfectly out-of-the-box without needing any configuration. Therefore it is a good idea to start with this section to see that it is the case.
Verifying VA-API
Verify the settings for VA-API by running , which is provided by :
VAEntrypointVLD means that your card is capable to decode this format, means that you can encode to this format.
In this example the driver is used, as you can see in this line:
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.3
If the following error is displayed when running :
libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit
You need to configure the correct driver, see #Configuring VA-API.
Verifying VDPAU
Install vdpauinfo to verify if the VDPAU driver is loaded correctly and retrieve a full report of the configuration:
Configuration
Although the video driver should automatically enable hardware video acceleration support for both VA-API and VDPAU, it may be needed to configure VA-API/VDPAU manually. Only continue to this section if you went through #Verification.
The default driver names, used if there is no other configuration present, are guessed by the system. However, they are often hacked together and may not work. The guessed value will be printed in the Xorg log file, which is if rootless, or if Xorg is running as root. To search the log file for the values of interest:
In this case is the default for both VA-API and VDPAU.
This does not represent the configuration however. The values above will not change even if you override them.
Configuring VA-API
You can override the driver for VA-API by using the LIBVA_DRIVER_NAME environment variable:
- Intel graphics:
- For libva-intel-driver use .
- For intel-media-driver use .
- NVIDIA:
- AMD:
- For AMDGPU driver use .
Configuring VDPAU
You can override the driver for VDPAU by using the environment variable.
The correct driver name depends on your setup:
- For Intel graphics you need to set it to .
- For the open source AMD driver set it to the proper driver version depending on your GPU, see #Verification.
- For the open source Nouveau driver set it to .
- For NVIDIA's proprietary version set it to
nvidia.
Configuring applications
Multimedia frameworks:
Video players:
- Browser plugins#Adobe Flash Player
- Kodi#Hardware video acceleration
- MPlayer#Hardware video acceleration
- mpv#Hardware video acceleration
- VLC media player#Hardware video acceleration
Web browsers:
Troubleshooting
Failed to open VDPAU backend
You need to set variable to point to correct driver. See #Configuring VDPAU.
VAAPI init failed
An error along the lines of is encountered. This can happen because of improper detection of Wayland. One solution is to unset $DISPLAY so that mpv, MPlayer, VLC, etc. do not assume it is X11. Another mpv-specific solution is to add the parameter .
Video decoding corruption or distortion with AMDGPU driver
When experiencing video decoding corruption or distortion with AMDGPU driver, set as environment variable or .
Comparison tables
VA-API drivers
| Codec | (VDPAU adapter) |
libva-nvidia-driverAUR (NVDECODE adapter) | |||
|---|---|---|---|---|---|
| Decoding | |||||
| MPEG-2 | See #VDPAU drivers | See #NVIDIA driver only | |||
| H.263/MPEG-4 Visual4 | Radeon HD 6000 and newer | 6 | |||
| VC-1 | rowspan=2 | See #NVIDIA driver only | |||
| H.264/MPEG-4 AVC | |||||
| H.265/HEVC 8bit | Radeon R9 Fury and newer | ||||
| H.265/HEVC 10bit | 6 | ||||
| VP8 | See #NVIDIA driver only | ||||
| VP9 8bit | rowspan=2 | See #VDPAU drivers5 | |||
| VP9 10bit | Kaby Lake and newer | Kaby Lake and newer | rowspan=2 | 6 | |
| AV1 8-bit & 10-bit | 7 | ||||
| Encoding | |||||
| MPEG-2 | Broadwell and newer except Broxton/Apollo Lake |
rowspan=7 | rowspan=7 6 | ||
| H.264/MPEG-4 AVC | |||||
| H.265/HEVC 8bit | |||||
| H.265/HEVC 10bit | Kaby Lake and newer | Kaby Lake and newer | |||
| VP8 | rowspan=3 | ||||
| VP9 8bit | Kaby Lake and newer | rowspan=2 | |||
| VP9 10bit | |||||
- 1 Up until GeForce GTX 750.
- 2 Supported by instead.
- 3 Hybrid VP8 encoder and VP9 decoder supported by intel-hybrid-codec-driverAUR.
- 4 MPEG-4 Part 2 is disabled by default due to VAAPI limitations. Set the environment variable to try to use it anyway.
- 5 Experimental VP9 support provided by libva-vdpau-driver-vp9-gitAUR instead.
- 6 NVIDIA CUDA adapter codec support is in active development and susceptible to change .
- 7 Not guaranteed to work. Requires FireFox 98+ .
VDPAU drivers
| Codec | Color depth |
(VA-API adapter) | ||
|---|---|---|---|---|
| Decoding | ||||
| MPEG-2 | 8bit | GeForce 8 and newer | rowspan=3 | |
| H.263/MPEG-4 Visual | 8bit | |||
| VC-1 | 8bit | |||
| H.264/MPEG-4 AVC | 8bit | Radeon HD 2000 and newer GeForce 8 and newer1 |
GeForce 8 and newer | See #VA-API drivers |
| H.265/HEVC | 8bit | Radeon R9 Fury and newer | rowspan=6 | |
| 10bit | 4 | |||
| VP9 | 8bit | |||
| 10bit | 4 | |||
| AV1 | 8bit | 5 | ||
| 10bit | 4 | |||
- 1 Up until GeForce GTX 750.
- 2 Except GeForce 8800 Ultra, 8800 GTX, 8800 GTS (320/640 MB).
- 3 Except GeForce GTX 970 and GTX 980.
- 4 NVIDIA implementation is limited to 8-bit streams .
- 5 Starting with driver version 510.
NVIDIA driver only
| Codec | nvidia-utils | |
|---|---|---|
| NVDECODE | NVENCODE | |
| MPEG-2 | rowspan=3 | rowspan=2 |
| VC-1 | ||
| H.264/MPEG-4 AVC | ||
| H.265/HEVC 8bit | rowspan=2 | |
| H.265/HEVC 10bit | ||
| VP8 | rowspan=4 | |
| VP9 8bit | ||
| VP9 10bit | ||
| AV1 8bit & 10bit | Ampere and newer3 | |
- 1 Except GM108 (not supported)
- 2 Except GM108 and GP108 (not supported)
- 3 Except A100 (not supported)
Application support
| Application | Decoding | Encoding | Documentation | |||
|---|---|---|---|---|---|---|
| VA-API | VDPAU | NVDECODE | VA-API | NVENCODE | ||
| FFmpeg | FFmpeg#Hardware video acceleration | |||||
| GStreamer | 1 | 1 | GStreamer#Hardware video acceleration | |||
| Kodi | Kodi#Hardware video acceleration | |||||
| mpv | mpv#Hardware video acceleration | |||||
| VLC media player | VLC media player#Hardware video acceleration | |||||
| MPlayer | 2 | MPlayer#Hardware video acceleration | ||||
| Flash | 3 | 3 | Browser plugins#Adobe Flash Player | |||
| Chromium | 4 | 4 | Chromium#Hardware video acceleration | |||
| Firefox | Firefox#Hardware video acceleration | |||||
| GNOME/Web | colspan=3 | ? | ? | GNOME/Web#Video | ||
- 1 GStreamer uses a whitelist of VA-API drivers. To ignore the whitelist, see GStreamer#Ignore driver whitelist.
- 2 VA-API support provided by instead.
- 3 VDPAU is supported only by NPAPI plugin. PPAPI plugin to NPAPI browser experimental adapter is available that provides partial VA-API and VDPAU acceleration.
- 4 Xorg only. Wayland is not supported. XWayland exhibits choppiness .