No hardware acceleration on Debian 12

I installed Debian 12, but VLC cannot use hardware acceleration on my 11th Gen Intel core i3. Looking up the issue it appears that some VAAPI is disabled when using VLC 3.x and ffmpeg 5, which makes my computer unusable for media.

  1. is there a media player in Debian 12 that can use the hardware acceleration on intel processors?
  2. Is there some workaround to the issue? The only answer I could find is that it would be fixed when VLC developers issue a newer version.

EDIT: Installing the latest snap of VLC 4.0 doesn’t seem to fix the issue

Are you perhaps on Nvidia GPU? Something is currently borked on the kernel and the latest driver.

No I am using the integrated GPU on the intel core i3-1005G1.

You can try using MPV from the terminal and switching the decoder manually:

If a suitible hardware decoder is available, you can toggle between software & hardware decoding using Ctrl+H.

You can then create a configuration file in ./config/mpv/mpv.conf with your desired parameters (ie: hwdec=auto-safe to enable GPU acceleration if available).

On Debian 11, I had to manually install the VAAPI drivers from Intel.

You might want to try ffmpeg 4.4 also. V5 seems like it’s requiring patches in other packages here and there to avoid problems.

  1. Run your VLC player > click “Tools” / “Preferences”

  2. goto “Input/Codecs” >
    find “Hardware accelerated decoding” under Codecs.

  3. Change the default “Disable” to “Automatic”

  4. hit “Save” button. And that’s it!

that should be it.

check your gpu driver isnt set to nouveau driver

lspci | grep -i vga

should spit out something like
07:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)

lspci -s 07:00.0 -v

if what you get looks like…
07:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Gigabyte Technology Co., Ltd GP106 [GeForce GTX 1060 6GB]
Flags: bus master, fast devsel, latency 0, IRQ 100
Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
Memory at e0000000 (64-bit, prefetchable) [size=256M]
Memory at f0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities:
Kernel driver in use: nouveau ← should be nvidia
Kernel modules: nouveau <— should be nvidia

your driver is not running and you will need to sort that to get hardware acceleration working.
asuiming you have an nvidia gpu…
if your using an igpu… then you do the same thing but your igpu should show up where nouveau is listed above.

I went on to install all vaapi drivers I could find. I enabled non-free and non-free-firmware.
I settled on the intel-media-va-driver-non-free because it’s non-free and I assumed most compatible. I also installed vainfo
It doesn’t work. No VAAPI option is shown within VLC’s “Tools → Preferences → Input / Codecs” Menu (Only “Automaitc”, “VPDAU video decoder” and “Disable”

I launched vlc from the command line, then opened a sample HEVC .mp4 file. Output is as follows:

VLC media player 3.0.18 Vetinari (revision 3.0.13-8-g41878ff4f2)
[0000563b55cea550] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000563b55d8c940] main playlist: playlist is empty
uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu
uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu
uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu
[00007f2f1c004960] gl gl: Initialized libplacebo v4.208.0 (API v208)
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[00007f2f1c004960] gl gl: Initialized libplacebo v4.208.0 (API v208)
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[00007f2f30c18930] avcodec decoder: Using OpenGL/VAAPI backend for VDPAU for hardware decoding
[hevc @ 0x7f2f30cf0400] Failed setup for format vdpau: hwaccel initialisation returned error.
[00007f2f30c18930] avcodec decoder error: existing hardware acceleration cannot be reused
[00007f2f1c004960] gl gl: Initialized libplacebo v4.208.0 (API v208)
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[00007f2f1c004960] gl gl: Initialized libplacebo v4.208.0 (API v208)
[hevc @ 0x7f2f30f56a80] Could not find ref with POC 23
[hevc @ 0x7f2f31018f80] Could not find ref with POC 25
[hevc @ 0x7f2f30cf0400] Could not find ref with POC 27
[hevc @ 0x7f2f30dd2000] Could not find ref with POC 29
[hevc @ 0x7f2f30e945c0] Could not find ref with POC 31
[hevc @ 0x7f2f30f56a80] Could not find ref with POC 33
[hevc @ 0x7f2f31018f80] Could not find ref with POC 35
[hevc @ 0x7f2f30cf0400] Could not find ref with POC 37
[hevc @ 0x7f2f30dd2000] Could not find ref with POC 39
[hevc @ 0x7f2f30e945c0] Could not find ref with POC 41
[hevc @ 0x7f2f30f56a80] Could not find ref with POC 43
[hevc @ 0x7f2f31018f80] Could not find ref with POC 45
[hevc @ 0x7f2f30cf0400] Could not find ref with POC 47
[hevc @ 0x7f2f30dd2000] Could not find ref with POC 49
[hevc @ 0x7f2f30e945c0] Could not find ref with POC 51
[hevc @ 0x7f2f30f56a80] Could not find ref with POC 53
[hevc @ 0x7f2f31018f80] Could not find ref with POC 55
[hevc @ 0x7f2f30cf0400] Could not find ref with POC 57
[hevc @ 0x7f2f30e945c0] Could not find ref with POC 1
[hevc @ 0x7f2f30f56a80] Could not find ref with POC 3
[hevc @ 0x7f2f31018f80] Could not find ref with POC 5
[hevc @ 0x7f2f30cf0400] Could not find ref with POC 7
[hevc @ 0x7f2f30dd2000] Could not find ref with POC 9
`

…And the errors continue as long as playback continues

lspci -s 07:00.0 -v gives no output at all

lspci | grep -i vga outputs:
00:02.0 VGA compatible controller: Intel Corporation Iris Plus Graphics G1 (Ice Lake) (rev 07)

Since the -s argument selects a specific PCI device, replace 07:00.0 with 00:02.0 in that command to select the correct device.

lspci output for my machine
$ lspci -s 00:02.0 -v
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07) (prog-if 00 [VGA controller])
	Subsystem: Microsoft Corporation UHD Graphics 620
	Flags: bus master, fast devsel, latency 0, IRQ 134
	Memory at a0000000 (64-bit, non-prefetchable) [size=16M]
	Memory at 90000000 (64-bit, prefetchable) [size=256M]
	I/O ports at 3000 [size=64]
	Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: i915
	Kernel modules: i915

BTW, I recall the non-free va-driver not working properly.

I don’t have ffmpeg 5 installed, but this is the output I have on my Debian 11 8250u-based tablet:

VAAPI packages installed
i965-va-driver/oldstable,now 2.4.1+dfsg1-1 amd64 [installed,automatic]
  VAAPI driver for Intel G45 & HD Graphics family

intel-media-va-driver/oldstable,now 21.1.1+dfsg1-1 amd64 [installed]
  VAAPI driver for the Intel GEN8+ Graphics family

libigdgmm11/oldstable,now 20.4.1+ds1-1 amd64 [installed,automatic]
  Intel Graphics Memory Management Library -- shared library

libvdpau-va-gl1/oldstable,now 0.4.2-1+b1 amd64 [installed,automatic]
  VDPAU driver with OpenGL/VAAPI backend
vainfo output
$ vainfo
libva info: VA-API version 1.10.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
ffmpeg & vlc output
$ ffmpeg
ffmpeg version 4.3.6-0+deb11u1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
...
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100

$ vlc
VLC media player 3.0.18 Vetinari (revision 3.0.13-8-g41878ff4f2)
[00005575695b25b0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000557569651130] main playlist: playlist is empty
[00007eff88003f40] gl gl: Initialized libplacebo v2.72.0 (API v72)
libva info: VA-API version 1.10.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
[00007eff98c19380] avcodec decoder: Using Intel iHD driver for Intel(R) Gen Graphics - 21.1.1 () for hardware decoding

I hope this is somewhat helpful.

EDIT: I just noticed that you’re testing with an HEVC video. I don’t have any files encoded in that format so I can’t test them, I was only able to test h264 encoded videos.

EDIT2: Alright, I just tested the Tractor x265 example, and VLC has no problem using the hardware decoder with it.

270308 – multimedia/vlc: Mark VAAPI as BROKEN is your issue

2 Likes

Thanks for the heads-up on that. I wonder if this issue effects MPV-based players as well, or just VLC?

i assumed you would get that you have to change th hardware id to match the output of the lspci command…
my bad.

lspci -s 00:02.0 -v

will give the right output.

Is there something I can do to be able to playback media on this PC using Debian 12? Is another player going to work? mpv doesn’t work either (although it has way less dropped frames), and VLC 4.0 nightly doesn’t seem to have fixed the issue (although it is quite beta at the moment, showing various weird behaviors). VLC 4.0 was installed as a snap package, I’m not sure if I need to install something else along with it

What resolution is your video file? I did some napkin math using the processor specs, and calculated that software 4k30 video playback would have less than 10 clock cycles per pixel. :slightly_frowning_face:

That’s really hard to achieve, even with highly optimized players like MPV. I think your best bet would be either trying lower-res versions of your videos, or reverting back to Debian 11 until FFMPEG is patched.

One other thing is that when I used flatpak, I had to install other libraries along with my application to get updated functionality.

I’m not sure if this applies to snap, perhaps someone will chime in who knows more about it than I do.

Anything 720p and 1080p should work just fine unless performance is severely hampered in some way. 4k will be a bit of struggle specially if it’s AV1 or/and if you make use of shaders or 3D for rendering output.

Yes, it’s only the 4k’s that lag terribly. It doesn’t make much of a difference if I transcode them to lower bitrates.

If I stay on Debian bookworm (12), does it not mean that I will not get a newer version of ffmpeg and/or VLC? So it will never get fixed. Am I wrong?

Can there be another solution? I really want to stay on bookworm.

When putting new stuff on a “stable” distro, the phrase “here be dragons” is appropriate. My personal experience tells me this will either be very easy, or will turn into a fractal hydra of a problem, where each surface level issue depends on one or more prerequisite issues to be discovered and solved first, ultimately spending days where it may not even work out in the end.

I strongly recommend a backup before experimenting.

→ The absolute first thing I would try either the snap or the flatpack. No sure how up to date those are. This should be easy to do and “just work”. It may not however resolve your stutter problem, but are easy to remove in such a case.

Another thing that could be tried is using the “Nix” package manager on debian. This lets you choose (latest or specific prior) versions of a package, without creating a dependency hell because each package is isolated in it’s own folder (/nix/store/verylonghash-package-version.num/). This likewise is done with all the dependencies it needs and the program is linked to what it needs. This is a bit more technically involved, but should be a fairly clean solution when used for those few select packages you need to be recent. You will need to remember that this is now a second package manager on your system you’ll have to update occasionally in addition to apt. A quick and simple rundown is here. “Nix the package manager” is related to but not to be confused with the “Nix language”, or “NixOS” which is a full distro based on that package manager.

Or maby there’s a backport that can be used? Never messed around with this personally, not familiar with it.

Finally you could attempt to compile the source code, but this seems like it would accomplish the same thing as trying to just install a more recent vlc.deb from the arch repo or something, that could require newer dependencies to install. Which would fail or end up creating a “franken-debian” mess, typically resulting in a wipe and reinstall to bury your tears and shame.

1 Like

Unless you want to fix the code in VLC no, usually MPV is highly regarded so it might support VAAPI using FFmpeg 6.0 but I haven’t looked into it.

Would you guys say that primarily Debian is leaning towards more of a server distro or desktop distro? Because this certainly seems like a server first, desktop second kind of experience.

Desktop is hard and in general Debian makes a good effort in keeping packages up to date however it takes quite a bit of time before it goes into stable.

2 Likes