24
December
2021
16:20

Setting up hardware video acceleration: brief instructions

24 December 2021 16:20

On my netbook (AMD C-30 processor with 1 processing core, AMD Radeon HD 6250 video card - Unified Video Decoder 2.3 with support for hardware video decoding H.264 and VC-1) I configured video output acceleration, sharing my experience.

For hardware-accelerated video playback, three conditions must be met:
1) Hardware acceleration due to the graphics adapter with support for hardware acceleration and graphics adapter drivers,
2) Enable VA and VDPAU (you need to check that they are enabled),
3) Setting up the Mozilla Firefox web browser.

I followed the instructions according to the guide on https://wiki.archlinux.org/title/
Hardware_video_acceleration#ATI/AMD

In order:

1) Installed the necessary packages (since I have an AMD video card in my laptop - I used the package xserver-xorg-amdgpu, and for integrated Intel graphics you will need the package intel-prime).

For Ubuntu/Linux Mint only:

sudo apt install ubuntu-restricted-extras linux-firmware

(where the ubuntu-restricted-extras package contains video and audio codecs, fonts and more for Ubuntu,
linux-firmware - firmware for Ubuntu Linux kernel drivers).

For all Linux OS:

sudo apt-get install mpv lshw vainfo vdpauinfo libegl-mesa0 libgl1-mesa-dri libglu1-mesa libglx-mesa0 mesa-utils mesa-utils-bin mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers

(where the mpv package is the video player, lshw is the hardware report output, vainfo and vdpauinfo are information about VA and VDPAU video acceleration, the mesa-utils and mesa-utils-bin packages contain the glxinfo and glxgears utilities, the mesa-va-drivers package is Mesa VA-API drivers for video acceleration, mesa-vdpau-drivers - Mesa VDPAU drivers for video acceleration, mesa-vulkan-drivers - 3D graphics drivers).

For modern Debian and Sparky Linux, antiX based on Debian 13 "trixie":

sudo apt install firmware-linux mesa-libgallium

(where firmware-linux is a package that installs drivers and firmware through dependencies: firmware-linux-free, firmware-linux-nonfree, amd64-microcode, intel-microcode, which can be used with drivers in the Linux kernel. Gallium is an API for writing graphics drivers).

In the latest version of Debian OS sid, the mesa-va* packages for video acceleration will be used less frequently, instead a new package mesa-libgallium. This will not affect users who are running Nvidia's proprietary closed source drivers. they have their own library, libnvidia-decode.

If AMD graphics:

sudo apt-get install xserver-xorg-video-amdgpu 

If Intel graphics:

sudo apt install intel-gpu-tools
sudo intel_gpu_top

ЕслIf graphics nVidia- or use a proprietary driver with closed source code ("nvidia"), or open source -Open-Source driver "nouveau". These drivers operate on different principles - non-free and free, but provide playback of MPEG 1/2, H.264, VC-1, MPEG-4 video formats on Nvidia GeForce 8, 9, GeForce 9300, GeForce IGPs, GeForce 200, 300, 400, 500, 600, 700 series video cards. When using a processor Core2Duo 720p video playback with nouveau driver is software and gives a CPU load of 60-80% depending on the web browser. If you are satisfied with this performance, you don’t have to install the nvidia driver and stick with nouveau. Since installing the nvidia driver on Debian and Sparky Linux, antiX Linux is difficult.

Addition. the configuration of the X server, which provides graphics output to the screen, is located in the folder /usr/share/X11/xorg.conf.d. The file /etc/X11/xorg.conf may not exist; it is not needed for modern operating systems. Experience shows that the presence of this xorg.conf file is sometimes desirable (without it, the commands inxi -Gxx or inxi -G --extra 2 do not work), but it can interfere when changing a video card or driver. To create the /etc/X11/xorg.conf file, you need to reboot, select additional recovery options ("Advanced recovery options" / "Recovery mode") and enter the "root" menu, where you run the commands:

X -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf
reboot

If a cyclic reboot occurs when starting the OS, go to the recovery options ("Advanced recovery options" / "Recovery mode"), enter the root password and then delete the file:

rm /etc/X11/xorg.conf

2) Reboot. We check on any video downloaded from the Internet (.mp4 file) that the system is working hardware video acceleration_ (it is advisable to take the test file with a resolution of 720p or 1080p).

Video file examples:Sample - MP4 files (https://thetestdata.com)- It is advisable to upload a 1080p video.

wget url_of_video_file.mp4

mpv --hwdec=auto "filename.mp4" 

The video clip will start playing in a full-screen window. Можно оценить частоту кадров на глаз - нет ли пропусков.
After playback ends, input focus will return to the terminal, where you need to read the last 2 lines:
If there is a mention vaapi, then hardware acceleration of the video card and driver works.
If video playback is software - there will be messages about the absence of libvdpau_va_gl.so and other errors - this means that video acceleration doesn't work.

In case of playback errors, use the inxi version of the video card and look for a solution on the Internet with drivers:

lspci | grep -i -E "display|VGA"
inxi -Gxxz

If there is no hardware video acceleration, the remaining points do not make sense; we are looking for third-party drivers (non-free).
(For example,Guide to installing drivers for nVidia video cards in Ubuntu 20.04).

Installing Nvidia graphics card driver (non-free) for Debian / Sparky Linux

For older Nvidia video cards, the outdated nvidia-340 driver is suitable, which can be downloaded from the official Nvidia website. But it is not compatible with kernels higher than 5.4.

New driver 550.163.02-2 from packages nvidia-driver, nvidia-driver-bin, nvidia-driver-full doesn't work with older video cards.Video card support/) - not lower GeForce GTX 750 Ti, GeForce GTX 750, GeForce GTX 745!

The Nvidia 340 driver only works with kernels up to and including Linux 5.4*-["Support for Linux kernels up to and including version 5.4 was added in version 340.108. No further releases in the 340. series are planned."](https://nvidia.custhelp.com/app/answers/detail/a_id/3142).

Nvidia 340 driver installation fails on Debian/Sparky 8.3 because the Nvidia 340.xx driver is not compatible with Linux kernel 6.12.
Driver 340 is no longer supported by Nvidia and contains critical vulnerabilities.
Therefore, Nvidia recommends using the Nouveau driver.


Move the NVIDIA-Linux-x86_64-340.108.run file from the Downloads folder to the user's home directory.

Before installing the driver, disable Nouveau:

cat <<EOF | sudo tee /etc/modprobe.d/nvidia-blacklists-nouveau.conf
blacklist nouveau
options nouveau modeset=0
EOF

and reboot:

sudo reboot

In the Grub2 menu

  • enter recovery mode ( Advanced options for Sparky GNU/Linux) -Sparky... (recovery mode)
    click "e"
  • add kernel parameter nomodeset in the line after quiet nosplash
  • F10
  • enter your password and run the commands:

    cd /home/user
    sh NVIDIA-Linux-x86_64-340.108.run

Accept the terms (left arrow - "Accept" - press Enter).
Select if necessary:

  • Ignore CC version check- Enter.

The installation of the Nvidia driver on Linux will begin!

If there is an error press:

  • OK (Enter)

    reboot

If for some reason you need to return to the Nouveau driver, from recovery mode (selected in the Grub2 menu):

sudo apt-get purge nvidia*
sudo apt-get install xserver-xorg-video-nouveau
sudo rm /etc/X11/xorg.conf
sudo modprobe nouveau
startx

For the antiX OS, which is a heavily modified Debian, it is not recommended to use any instructions or advice from the Internet, but only antiX forum and frequently asked questions about antiX Linux.

List of Nvidia video cards compatible with Nvidia 550 driver and new 6.x kernels
nvidia550driver_compat.txt.zip

My hardware acceleration in the video player on my Asus Eee PC laptop (with an AMD Radeon HD 6250 video card) turned on immediately.
I continue...

VAINFO check

sudo apt-get install vainfo 
vainfo

The output should show that the video card supports at least the main codecs: mpeg2 and h.264.

VAProfileH264, etc.:

libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Mesa Gallium driver 21.2.6 for AMD PALM (DRM 2.50.0 / 5.4.0-139-generic, LLVM 12.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple : VAEntrypointVLD
      VAProfileMPEG2Main : VAEntrypointVLD
      VAProfileVC1Simple : VAEntrypointVLD
      VAProfileVC1Main : VAEntrypointVLD
      VAProfileVC1Advanced : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264Main : VAEntrypointVLD
      VAProfileH264High : VAEntrypointVLD
      VAProfileNone : VAEntrypointVideoProc

If error "-1" occurs, then download and install vdpau-va-driver.

Note: VA is a special application programming interface (API) developed by Intel to use hardware acceleration. (Video Acceleration API).

VDPAU check

grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log

It should be written that VDPAU driver (in this case RADEON) installed:

[61.505](II)RADEON(0): [DRI2] DRI driver: r600
[61.505](II)RADEON(0): [DRI2] VDPAU driver: r600

Note: VDPAU is an open source software interface for video decoration on Unix. (Video Decode and Presentation API for Unix)


3)Setting up Mozilla FireFox for hardware YouTube video playback:

Check that the WebRender container is enabled and running in FireFox.

about:support

In the section "Solution log" when acceleration is turned on by the device, the following should be used:values:

  • in the column HW_COMPOSITING - available
  • in the WebRender - available column

Let's configure the configuration a little:
about:config
and then changed the keys:

  • gfx.webrender.all - true

  • gfx.x11-egl.force-enabled = true

  • layers.accelaration.force-enabled = true

  • layers.gpu-process.enabled = true

  • layers.gpu-process.force-enabled = true

  • media.ffmpeg.vaapi.enabled = true

  • media.rdd-ffmpeg.enabled = true

  • media.rdd-vpx.enabled** = false

  • media.av1.enabled = false

  • media.hardware-video-decoding.enabled = true

  • media.hardware-video-decoding.force-enabled = true

  • media.hardware-video-encoding.enabled = true

  • media.hardware-video-encoding.force-enabled = true

  • media.navigator.mediadatadecoder_vpx_enabled = true

  • media.peerconnection.video.vp9_enabled = false

  • widget.dmabuf.force-enabled = true

After the specified settings, the video is played with low CPU load.

P.S. Some instructions recommend adding an export variable in your ~/.profile file, instructions for Wayland or Xorg.
See instructions.

For example, at the end of the .bashrc file add

sudo nano ~/.bashrc 
  • for Intel graphics with libva-intel-driver driver:

    export LIBVA_DRIVER_NAME=i965

  • for Intel graphics with intel-media-driver:

    export LIBVA_DRIVER_NAME=iHD

  • for Nvidia with Nouveau driver:

    export LIBVA_DRIVER_NAME=nouveau

  • for Nvidia with Nvidia driver:

    export LIBVA_DRIVER_NAME=nvidia

  • for AMD Radeon:

    export LIBVA_DRIVER_NAME=radeonsi

4) Disable window composer compton(consumes CPU resources - note dated 07/05/2024) and reboot

 sudo apt remove compton && sudo shutdown -r now

Checking for video acceleration in Mozilla Firefox

about:support ->

  • HW_COMPOSITING,
  • HARDWARE_VIDEO_DECODING,
  • Codec Support Information -> Hardware Decoding

If video acceleration in FireFox doesn't work, you can try VLC player. In it, in the advanced settings Tools - Settings - All, you can enable Video - Video output modules - video output via OpenGL or VDPAU. You can use a YouTube video link as a source (Media - Open URL), for example https://youtube.com/shorts/vxOhtjx9Tng.

What was and became:

  • before enabling hardware video acceleration: YouTube did not play in the window (frozen frame, audio only). Single-core processor utilization is about 90%.
  • when AMD Radeon HD hardware acceleration is enabled: video is played in 480p video in a window without skipping 25fps, and in full screen video is 25 fps; video resolution 720p full screen - 25fps; maximum resolution Full HD 1080p - frame rate about 25 fps (at the beginning of playback about 10-15 seconds there are frame drops - 10-15 frames per second).

Sources:
https://wiki.archlinux.org/title/Hardware_video_acceleration
https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration
https://discourse.ubuntu.com/t/enabling-accelerated-video-decoding-in-firefox-on-ubuntu-21-04/22081
https://nouveau.freedesktop.org/VideoAcceleration.html

Date of last change: 07/07/2026



Related publications