Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Hardware Video Acceleration

Jeremy Pardo edited this page May 11, 2020 · 8 revisions

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 - proprietary APIs for hardware video acceleration used by NVIDIA Fermi, Kepler, Maxwell and Pascal generation GPUs.

Verification

Required packages (according to your GPU) will be installed by archboot. 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 vainfo:

$ vainfo
-----------------------------------------------------------------------
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.3
vainfo: Supported profile and entrypoints
    VAProfileMPEG2Simple            :   VAEntrypointVLD
    VAProfileMPEG2Simple            :   VAEntrypointEncSlice
    VAProfileMPEG2Main              :   VAEntrypointVLD
    VAProfileMPEG2Main              :   VAEntrypointEncSlice
    VAProfileH264ConstrainedBaseline:   VAEntrypointVLD
    VAProfileH264ConstrainedBaseline:   VAEntrypointEncSlice
    VAProfileH264ConstrainedBaseline:   VAEntrypointEncSliceLP
    VAProfileH264Main               :   VAEntrypointVLD
    VAProfileH264Main               :   VAEntrypointEncSlice
    VAProfileH264Main               :   VAEntrypointEncSliceLP
    VAProfileH264High               :   VAEntrypointVLD
    VAProfileH264High               :   VAEntrypointEncSlice
    VAProfileH264High               :   VAEntrypointEncSliceLP
    VAProfileH264MultiviewHigh      :   VAEntrypointVLD
    VAProfileH264MultiviewHigh      :   VAEntrypointEncSlice
    VAProfileH264StereoHigh         :   VAEntrypointVLD
    VAProfileH264StereoHigh         :   VAEntrypointEncSlice
    VAProfileVC1Simple              :   VAEntrypointVLD
    VAProfileVC1Main                :   VAEntrypointVLD
    VAProfileVC1Advanced            :   VAEntrypointVLD
    VAProfileNone                   :   VAEntrypointVideoProc
    VAProfileJPEGBaseline           :   VAEntrypointVLD
    VAProfileJPEGBaseline           :   VAEntrypointEncPicture
    VAProfileVP8Version0_3          :   VAEntrypointVLD
    VAProfileVP8Version0_3          :   VAEntrypointEncSlice
    VAProfileHEVCMain               :   VAEntrypointVLD
    VAProfileHEVCMain               :   VAEntrypointEncSlice

VAEntrypointVLD means that your card is capable to decode this format, VAEntrypointEncSlice means that you can encode to this format.

In this example the i965 driver is used, as you can see in this line:

libva info: Trying to open /usr/lib/dri/**i965**_drv_video.so

If the following error is displayed when running vainfo:

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

Verify if the VDPAU driver is loaded correctly and retrieve a full report of the configuration by running vdpauinfo:

$ vdpauinfo
-----------------------------------------------------------------------
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types

420    16384 16384  NV12 YV12
422    16384 16384  UYVY YUYV
444    16384 16384  Y8U8V8A8 V8U8Y8A8

Decoder capabilities:

name                        level macbs width height

MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152

If error is displayed when running vdpauinfo, you need to configure the correct driver, see Configuring VDPAU.