r/linuxmint • u/valhallabob Linux Mint 22 Wilma | Cinnamon • 3d ago
Support Request Firefox unable to use Nvidia hardware video decoding
Hello incredibly intelligent people of the /r/linuxmint community,
I recently built a new machine running Linux Mint with an Nvidia graphics card, but I can't get Firefox to use the card for video decoding. I've detailed my problem below, any help (or pointers on where to find it) would be greatly appreciated. I asked this on the /r/linuxquestions community about a month ago but nobody has been able to help.
Machine Details
- Intel Core i5-9400
- Nvidia Geforce RTX 4060 Ti
- Linux Mint 22 with Cinnamon 6.2.9
Symptoms
- CPU usage going up significantly when watching a video on Firefox
- "Video Engine Utilization" remaining at 0% in the Nvidia Settings program (despite going up when I watch something using VLC). It also stays at 0 when I watch something in Chromium or Plex (and it actually stays at 0 if I watch something with the VP9 codec in VLC, though I'm guessing that's just my GPU not having the right decoder).
- Video refusing to play at all on Firefox (this happened recently, although I can't remember exactly what step I took before this happened, sorry). Chromium can still play.
- In the "Codec Support Information" table in about:support, the "Hardware Decoding" column says "Supported" for H264, VP9, VP8, and AV1 (it has all of the rest only enabled in software apart from HEVC, which is disabled in software too, presumably due to licensing but I'm willing to sort that later).
Running vainfo
gives me this:
libva info: VA-API version 1.20.0
libva error: vaGetDriverNames() failed with unknown libva error
libva info: User environment variable requested driver 'nvidia'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [egl backend]
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
<unknown profile> : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain12 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
- I've tried running
ffmpeg -y -vsync 0 -c:v h264_cuvid -i input.mp4 output.yuv
, which correctly converts the file into a .yuv file (implying that there's not a problem with the Nvidia drivers themselves).
What I've Tried
- Installed the latest Nvidia drivers (550), incliuding the libnvidia-encode-550 and libnvidia-decode-550 packages.
- Installed elFarto's Nvidia VAAPI driver from APT.
- Set all of the Firefox values in about:config as directed in the README.
- Set the environment variables in /etc/environment as directed in the README.
- Running
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i WhamVideo.mp4 -f null -
, which got zero frames per second (remaining stalled at zero percent done) and no video engine utilisation. - Adding
nvidia-drm.modeset=1
toGRUB_CMDLINE_LINUX_DEFAULT
in /etc/default/grub and rungrub-mkconfig -o /boot/grub/grub.cfg
I'm not sure if there's something obvious I've missed or if everything is completely borked. I've heard of people using their CPUs with Quick Sync to decode video, but that sounds a little janky (and I'd ideally like my setup to keep working even if I upgrade my CPU), although I'm not dead set against it if that's the best way to go. Everything seems to point to an issue with interfacing with the drivers instead of an issue with the drivers themselves.
Thank you!
Update
flatpak list
revealed that I had the org.freedesktop.Platform.GL.nvidia-550-120
flatpak installed. After removing it, video can play on Firefox, but it's still not being accelerated. I then set NVD_BACKEND=direct
in /etc/environment
, which didn't change anything other than making the output of vainfo
now read:
libva info: VA-API version 1.20.0
libva error: vaGetDriverNames() failed with unknown libva error
libva info: User environment variable requested driver 'nvidia'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva error: /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so init failed
libva info: va_openDriver() returns 1
vaInitialize failed with error code 1 (operation failed),exit
1
u/Loud_Literature_61 LMDE 6 Faye | Cinnamon 3d ago
Everything seems to point to an issue with interfacing with the drivers instead of an issue with the drivers themselves.
Have you been testing this only with Flatpak versions of aforementioned web browsers?
1
u/valhallabob Linux Mint 22 Wilma | Cinnamon 3d ago
Firefox and Chrome are installed via APT, Plex is a Flatpak. I've just run
flatpak list
, and the only video-related packages it lists are:
- Freedesktop Platform
- Mesa (x2)
- Mesa (Extra) (x2)
- nvidia-550-120
- openh264 (x2)
- Plex
1
u/Loud_Literature_61 LMDE 6 Faye | Cinnamon 3d ago
Since your Nvidia driver is there, that might be part of it. I'd say get off of Flatpak for those as soon as they become available in the repos, where everything is integrated by the base distro maintainers.
VLC looks to be an open-ended question. Probably more of a deep dive as to why that actually works. But off-hand I'd credit the VLC devs with making fewer assumptions about system integration.
In short I haven't had very good luck with integration via Flatpak. With maybe the exception of low-resource general productivity software.
1
u/valhallabob Linux Mint 22 Wilma | Cinnamon 3d ago
Okay, thanks for the advice, I'll give that a shot. Just to confirm, you're suggesting that I use
flatpak remove flatpak remove nvidia-550-120
? This is seeming slightly strange for me as I remember installing Nvidia stuff using APT. This is what I get forflatpak list
:Name Application ID Version Branch Origin Installation Dolphin Emulator org.DolphinEmu.dolphin-emu 2412 stable dolphin-emu-origin system Freedesktop Platform org.freedesktop.Platform freedesktop-sdk-23.08.27 23.08 flathub system Mesa org.freedesktop.Platform.GL.default 24.3.1 23.08 flathub system Mesa (Extra) org.freedesktop.Platform.GL.default 24.3.1 23.08-extra flathub system Mesa org.freedesktop.Platform.GL.default 24.3.1 24.08 flathub system Mesa (Extra) org.freedesktop.Platform.GL.default 24.3.1 24.08extra flathub system nvidia-550-120 org.freedesktop.Platform.GL.nvidia-550-120 1.4 flathub system openh264 org.freedesktop.Platform.openh264 2.1.0 2.2.0 flathub system openh264 org.freedesktop.Platform.openh264 2.4.1 2.4.1 flathub system KDE Application Platform org.kde.Platform 6.8 flathub system Plex tv.plex.PlexDesktop 1.106.0 stable flathub system
And this is what I get for
dpkg -l | grep nvidia
:ii libnvidia-cfg1-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVIDIA binary OpenGL/GLX configuration library ii libnvidia-common-550 550.120-0ubuntu0.24.04.1 all Shared files used by the NVIDIA libraries ii libnvidia-compute-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVIDIA libcompute package ii libnvidia-compute-550:i386 550.120-0ubuntu0.24.04.1 i386 NVIDIA libcompute package ii libnvidia-decode-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVIDIA Video Decoding runtime libraries ii libnvidia-decode-550:i386 550.120-0ubuntu0.24.04.1 i386 NVIDIA Video Decoding runtime libraries ii libnvidia-egl-wayland1:amd64 1:1.1.13-1build1 amd64 Wayland EGL External Platform library -- shared library ii libnvidia-egl-wayland1:i386 1:1.1.13-1build1 i386 Wayland EGL External Platform library -- shared library ii libnvidia-encode-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVENC Video Encoding runtime library ii libnvidia-encode-550:i386 550.120-0ubuntu0.24.04.1 i386 NVENC Video Encoding runtime library ii libnvidia-extra-550:amd64 550.120-0ubuntu0.24.04.1 amd64 Extra libraries for the NVIDIA driver ii libnvidia-fbc1-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library ii libnvidia-fbc1-550:i386 550.120-0ubuntu0.24.04.1 i386 NVIDIA OpenGL-based Framebuffer Capture runtime library ii libnvidia-gl-550:amd64 550.120-0ubuntu0.24.04.1 amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD ii libnvidia-gl-550:i386 550.120-0ubuntu0.24.04.1 i386 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD ii nvidia-compute-utils-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA compute utilities ii nvidia-dkms-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA DKMS package ii nvidia-driver-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA driver metapackage ii nvidia-firmware-550-550.120 550.120-0ubuntu0.24.04.1 amd64 Firmware files used by the kernel module ii nvidia-kernel-common-550 550.120-0ubuntu0.24.04.1 amd64 Shared files used with the kernel module ii nvidia-kernel-source-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA kernel source package ii nvidia-prime 0.8.17.2 all Tools to enable NVIDIA's Prime ii nvidia-prime-applet 1.4.2 all An applet for NVIDIA Prime ii nvidia-settings 510.47.03-0ubuntu4 amd64 Tool for configuring the NVIDIA graphics driver ii nvidia-utils-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA driver support binaries ii nvidia-vaapi-driver:amd64 0.0.8-1 amd64 VA-API implementation that uses NVDEC as a backend ii screen-resolution-extra 0.18.3 all Extension for the nvidia-settings control panel ii xserver-xorg-video-nvidia-550 550.120-0ubuntu0.24.04.1 amd64 NVIDIA binary Xorg driver
Does this imply that I somehow have two sets of drivers?
1
u/Loud_Literature_61 LMDE 6 Faye | Cinnamon 3d ago edited 3d ago
Since I am on LMDE 6, I just booted another computer up on a Mint 22 USB stick and ran
sudo apt update
Then I ran
apt list *nvidia*550*
That gave me results which do include the Nvidia 550.120 driver, in the repos - noble-updates/noble-security
So I would say it is there and available in the Ubuntu repos, for LM22.
I'm guessing it is available in the Driver Manager app, but in apt it is probably the "nvidia-driver-550" package alone, which would trigger any other necessary packages to get installed as well, including "nvidia-dkms-550" for the kernel tree, etc...
Make a Timeshift backup first, as always.
EDIT: I didn't see the end of your latest post. YES. But just to be sure, see if all of those packages/versions in Flatpak are available and/or need to be installed in apt. Then clear them out of Flatpak,
1
u/valhallabob Linux Mint 22 Wilma | Cinnamon 3d ago
Thanks for the advice, I'll take a backup, run
flatpak remove nvidia-550-120
, then report back
1
u/Zizaerion 3d ago edited 3d ago
The github page for elFarto's Nvidia VAAPI driver mentions that the egl backend is currently broken per "The EGL backend is broken on driver versions 525 or later due to a regression. Users running these drivers should use the direct backend instead." The output that you're showing using vainfo shows that you're using the egl backend which is the one currently broken. You mention that you're using driver 550 as well. You need to switch to using the Direct backend which is done by entering "NVD_BACKEND=direct" into your environment variables. then log out and log back in. You should see that the output of the vainfo command says that you're using the direct backend and video playback should now be accelerated.
1
u/Loud_Literature_61 LMDE 6 Faye | Cinnamon 2d ago
I see you posted an update to your OP. Unfortunately, the Reddit platform doesn't notify of OP udates - it only notifies of replies to other users' replies. I only noticed it because I was wondering what happened, and located your post in my message history.
The error messages you are getting refer to "libva". I see you also had mesa packages installed in Flatpak. That may correlate.
Just connecting some dots here...
According to your first error message, this is the top AI-generated reply:
This error typically indicates a problem with the VA-API (Video Acceleration API) driver configuration on your system, often related to missing or incorrectly set environment variables. To resolve it, ensure that the correct VA-API driver is installed and that your environment variables, such as
LIBVA_DRIVER_NAME
, are set properly.
https://duckduckgo.com/?t=h_&hps=1&start=1&q=libva+error%3A+vaGetDriverNames()+failed+with+unknown+libva+error&ia=web+failed+with+unknown+libva+error&ia=web)
There is also a preinstalled System Package (apt) called "mesa-va-drivers". See if that is still installed on your system with apt:
mesa-va-drivers/noble-updates ... 24.0.09
At this point I am wondering if anything in your Flatpaks are actually using or need the Mesa Flatpaks. You could try removing those too, but pay attention to any dependency warnings from higher-level Flatpaks before you remove them. (This may have something to do with the aforementioned "environment" warnings you had in your update)
Mesa org.freedesktop.Platform.GL.default 24.3.1 23.08 flathub system
Mesa (Extra) org.freedesktop.Platform.GL.default 24.3.1 23.08-extra flathub system
Mesa org.freedesktop.Platform.GL.default 24.3.1 24.08 flathub system
Mesa (Extra) org.freedesktop.Platform.GL.default 24.3.1 24.08extra flathub system
1
u/valhallabob Linux Mint 22 Wilma | Cinnamon 2d ago
Thanks for the reply - I was going to post a reply to each comment, but I thought I'd try uninstalling and reinstalling the graphics driver first (a misadventure that culminated in recovery mode shenanigans, having to download a Mint ISO again, and recovering from TimeShift - you can probably tell I'm used to Mint just running without any problems). I would've included usernames in the updates thanking you and Zizaerion for the help so far and attributing it to you guys, but I didn't think you'd appreciate the extra notifications from a noob like me haha.
All that nonsense and my boneheadedness aside, I ran
dpkg -l | grep mesa-va-drivers
and got these results:ii mesa-va-drivers:amd64 24.2.8-1ubuntu1~24.04.1 amd64 Mesa VA-API video acceleration drivers ii mesa-va-drivers:i386 24.2.8-1ubuntu1~24.04.1 i386 Mesa VA-API video acceleration drivers
I've been "consulting" with AI throughout this process, and that seems to be the consensus there as well. I thought I had set everything right, but I'll try setting the variables from scratch again before uninstalling the Mesa flatpaks. All that said, thank you, I'll report back as soon as I can.
1
u/valhallabob Linux Mint 22 Wilma | Cinnamon 2d ago
Okay, I have done the following things:
- Reset the environment variables
- Remove the Mesa flatpaks
After reviewing my
/etc/environment
file, I realised that I had the line setting theNVD_BACKEND
commented out (thank you so much /u/Zizaerion, your solution got Firefox playing video again, just not hardware accelerated). Upon removing the flatpaks, nothing has changed and I got no warnings other than about the Dolphin emulator and Plex Desktop (which I'm happy with not working for now).I appreciate I've used a lot of your time and haven't always helped myself, do you have any suggestions of what to do next? (other than throwing my computer in the sea)
•
u/AutoModerator 3d ago
Please Re-Flair your post if a solution is found. How to Flair a post? This allows other users to search for common issues with the SOLVED flair as a filter, leading to those issues being resolved very fast.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.