Skip to main content
Topic: Any insights on nvidia hardware video decoding? (Read 873 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Any insights on nvidia hardware video decoding?

My knowledge on the subject is sparse at best, but I recently realized that my nvidia gtx 960 (nothing amazing but a decent piece of hardware) was sitting back letting my cpu handle my youtube addiction.  This was resulting in pretty high cpu usage, ramped up fan speeds causing a lot of noise, and (I think) the odd freezing/stuttering of video during playback (audio would continue normally).

So I did a little digging and seems there's ways to get the gpu to start doing it's job.  Namely, I found this reddit post https://www.reddit.com/r/archlinux/comments/10atns4/cant_get_hardware_acceleration_working_with/ where the poster shared my concern about the gpu not doing it's job, and there was advice to use the "git nvidia vaapi driver" and to "use the direct backend."

I found the vaapi driver on the aur https://aur.archlinux.org/packages/nvidia-vaapi-driver-git but in the comments there was much discussion about another driver (libva-nvidia-driver) being superior due to being "current version" and with bug fixes.  There were also contradicting comments but essentially it boils down to these two statements: "The direct backend is currently required on NVIDIA driver series 525 due to a regression (see issue #126)." and "This backend uses headers files from the NVIDIA open-gpu-kernel-modules project."

I then made my way to the upstream git repository and found that the developer(s) had pretty good instructions on how to get the necessary files from the open-gpu-kernel-modules necessary to get it all working, so I followed the instructions there and installed the patch/driver and enabled the options in firefox and set the environment variables, as well as enabling the nvidia-drm.modeset=1 kernel parameter.

And the results are that my gpu is now doing it's job, however I notice that the first time I open youtube after booting that my whole system freezes for 5 seconds or so.

Any nvidia owners have experience with this and maybe have any insights?  Perhaps I've taken a wrong turn somewhere.

On a side-note, the next system I build will definitely have an AMD gpu :P

Re: Any insights on nvidia hardware video decoding?

Reply #1
You can give it a try watching the same videos within mpv+yt-dlp, there you can check more things that the standard youtube player allows.

mpv has also a lower cpu load when software decoding so you might not even need any hardware acceleration at all, if you won't find the solution with those custom drivers.

Re: Any insights on nvidia hardware video decoding?

Reply #2
Well I was just hoping maybe someone else had dealt with this already and could offer some insights.  Maybe it is behaving as intended, although I'm not sure.  I think the reason why my system was locking up when first starting a video had something to do with the logging (maybe), since for some reason the log file grows by 20Kb/second.  When I looked at the log file after maybe a day it was multiple gigabytes and when I looked at it in thunar I could see it growing extremely fast, 50k lines in a few minutes.  So I removed the environment variable setting the log file, and so far no lockup on video start.

Though I am wondering if logging that much is normal or if it's a sign that something is not working properly.  The github page where I got the driver from says you can set an option to make it log less, but when I looked it was already set.

Re: Any insights on nvidia hardware video decoding?

Reply #3
You could try some different Firefox based browsers, perhaps try different versions, like the Firefox development builds, see if there are any other settings in about:config that could be relevant to experiment with other values? Sometimes these kinds of things can make a difference but I don't know if it will here.

Re: Any insights on nvidia hardware video decoding?

Reply #4
NVIDIA doesn't support vaapi and to my knowledge, firefox only supports vaapi for hardware decoding on linux. So your only choice (short of writing nvdec support for firefox) is to use some guy's weird emulation layer. If you have problems with it, your best bet is to report upstream to the developer. There's not really anything we can do here.

Re: Any insights on nvidia hardware video decoding?

Reply #5
Yes true, sorry for cluttering the forums.  I was about to post an issue on the github but I just disabled logging and the locking up issue disappeared.  I may still post something, maybe post my logs and see if anyone can shed some light.

Re: Any insights on nvidia hardware video decoding?

Reply #6
Yes true, sorry for cluttering the forums.  I was about to post an issue on the github but I just disabled logging and the locking up issue disappeared.  I may still post something, maybe post my logs and see if anyone can shed some light.

Re: Any insights on nvidia hardware video decoding?

Reply #7
This package is in the Artix repos and is an optional dependency of VLC media player:
Repository      : world
Name            : libva-vdpau-driver
Description     : VDPAU backend for VA API
URL             : https://freedesktop.org/wiki/Software/vaapi
(The URL in the package description is outdated and wrong, incidentally.)
Without it you might see an error message when playing a video after starting VLC on the command line:
Failed to open VDPAU backend libvdpau_nouveau.so: cannot open shared object file: No such file or directory
I forget exactly but once I installed it and possibly some other stuff to go with it, but it didn't seem to work on my old hardware (i.e. green blocks instead of video and soon after a system lockup)  unless I hadn't set it up properly which is quite possible. It doesn't support everything iirc, but it mentions vaapi and it's supposed to provide hardware accelerated video in VLC, not sure if it would do anything for browsers.
The Arch wiki might be helpful for more details:
https://wiki.archlinux.org/title/Hardware_video_acceleration