Hardware support for multimedia codecs in Firefox
Firefox needs a bit of “help” on Linux to enable the hardware support of Nvidia cards for the codecs used in video playback. Here, I’ll explain how you need to proceed.
First, you need to install a few packages:
sudo apt install -y meson gstreamer1.0-plugins-bad libffmpeg-nvenc-dev libva-dev libegl-dev libdrm-dev cmake vainfo
Afterwards clone the GIT repository, switch into the directory, compile and install the VAAPI driver:
git clone https://github.com/elFarto/nvidia-vaapi-driver.git
cd nvidia-vaapi-driver
meson setup build
meson install -C build
The following lines must be added to /etc/environment:
sudo touch /etc/environment
sudo tee --append /etc/environment <<EOF
MOZ_DISABLE_RDD_SANDBOX=1
LIBVA_DRIVER_NAME=nvidia
EOF
And these to the file /etc/libva.conf:
sudo touch /etc/libva.conf
sudo tee --append /etc/libva.conf <<EOF
LIBVA_MESSAGING_LEVEL=1
EOF
In Firefox you have to open the configuration page about:config and make the following
changes:
media.hardware-video-decoding.force-enabledauf truemedia.rdd-ffmpeg.enabledauf truegfx.x11-egl.force-enabledauf truewidget.dmabuf.force-enabledauf true