[SOLVED] Media player with hardware acceleration

Hello dear community,

I’m wondering if someone has a good media player recommendation that support hardware acceleration on Linux?

I’ve tried with VLC but it seems support for the VA API was dropped and might only be added back in version 4 which doesn’t has a release date at the moment: https://groups.google.com/g/linux.debian.bugs.dist/c/EHnaFzmCiAY

I’m using Fedora and also tried the built-in Gnome media player but this one also doesn’t seem to leverage hardware acceleration.

I’ve seen that it might be possible to install some packages that act as a translation layer between the VDPAU API and the VA-API to enable apps to use the VDPAU API but that also didn’t worked in the end for me.

Anyone has some recommandations/experience regarding this?

Right now I managed to enable hardware acceleration on Chromium and I’m mostly streaming my files through a media server to work around this but if someone has a better solution please let me know.


Edit: Found a working solution: mpv --hwdec=auto {filename}, you can install mpv from Gnome software GUI or dnf.
Execute echo hwdec=auto > .config/mpv/mpv.conf to enable hardware acceleration by default.

1 Like

Are you sure hardware accelerated playback does not work in VLC? I’m running the latest version from Arch repositories on my AMD board and it can play 4K HDR with no problems (not sure of framerare but it’s at least 25fps).

You can always trust mpv for the job.

1 Like

@jjacobi what distribution are you on?

Speaking from a Gentoo perspective, VLC needs to be built with VAAPI in order to support it and there may be discrepancies with ffmpeg.

Have you taken a look at VLC VAAPI - VideoLAN Wiki ?

I think you’ll have better support with VAAPI over VDAPU in my opinion.

1 Like

Make sure that your current setup actually supports decoding via vaapi.
Some distros dropped hardware accellerated en-decoding of popular yet patented codecs such as AVC/H264 on AMD hardware (dumbest decision ever and I hate it!).

what does vainfo say? does it actually list the codec you are testing?

In case it is missing, you may need to compile mesa yourself or switch to a built that includes these decoders…

P.S. as for the video player recommendation: i use baka-mplayer

Are you sure hardware accelerated playback does not work in VLC? I’m running the latest version from Arch repositories on my AMD board and it can play 4K HDR with no problems (not sure of framerare but it’s at least 25fps).

Yes, I have a 12th Gen Intel Framework laptop, I’m able to use the command sudo intel_gpu_top to see if hardware acceleration is being used or not and I can confirm it’s not, I’m still able to watch 4k files on VLC but it’s using way more resources than it should resulting in additional noise, heat, and less battery life when on the go.

You can always trust mpv for the job.

I just did give it a try but it doesn’t seem to use hardware acceleration for me :frowning:

what distribution are you on?

Fedora 39

Speaking from a Gentoo perspective, VLC needs to be built with VAAPI in order to support it and there may be discrepancies with ffmpeg.

Have you taken a look at VLC VAAPI - VideoLAN Wiki ?

No, I didn’t know about this, might give it a try ideally I was hoping that I would be able to find an out-of-the-box solution but I might have to give up regarding this.

Make sure that your current setup actually supports decoding via vaapi.

I think this is working fine, I managed to make hardware acceleration work on the Chromium and some other software I’m using (such as moonlight) and vainfo returns a bunch of supported codec such as the h264 that I’m using for my tests:

 VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
 VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
 VAProfileH264ConstrainedBaseline:	VAEntrypointFEI
 VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP

This is how intel_gpu_top looks like when hardware acceleration is being used, notice the slight usage of the video engine that is being reported, when this is case the computer handles way better videos, resulting in better battery life and less heat:

1 Like

@jjacobi I’m not terribly familiar with Fedora but @Ceremony brought up a good point about Mesa compiled with VAAPI support. Honestly it would surprise me if Fedora shipped mesa w/o VAAPI support but I’ve seen weirder things.

Have you tried a snap or flatpack of VLC w/ VAAPI?

Did you use --hwdec=auto? Or on of the specific --hwdec?

It should show something like this in the logs

Using hardware decoding (vaapi).

Unfortunately, they had to for legal reasons, because Fedora being backed by a rather big company, you know…

To manually switch mesa to one provived by rpmfusion you could read up here:

https://fedoraproject.org/wiki/Firefox_Hardware_acceleration

Using mpv you could, apart from what @Thomas_Weissschuh mentioned, toggle hardware acceleration during playback with “ctrl+h”.

2 Likes

Curios if VLC from snap has VAAPI support, has anybody tried?

I just tried with mpv --hwdec=auto {filename} and it seems to work now, thanks! :tada:

@jjacobi I’m not terribly familiar with Fedora but @Ceremony brought up a good point about Mesa compiled with VAAPI support. Honestly it would surprise me if Fedora shipped mesa w/o VAAPI support but I’ve seen weirder things.

I don’t think this was the problem given that I was able to use hardware acceleration based on VAAPI on other software. (Chromium, moonlight).

Have you tried a snap or flatpack of VLC w/ VAAPI?

Curios if VLC from snap has VAAPI support, has anybody tried?

I didn’t find a specific snap version/channel that is built with VAAPI support, I tried with the stable, edge, and beta channels on snap and for all of them, hardware acceleration didn’t work.

@jjacobi I found this if you wanted to give it a go

If anything you might narrow down the root cause

Anyway, this situation was interesting, learned something about Fedora :slight_smile: