I find it funny how all this time I didn't know that hardware acceleration in VLC was disabled if multithreading is enabled. It really boggles my mind how this basic feature of modern video cards gets sidelined in Linux. Luckily, we have a fix for that, which should work with both VA-API and VDPAU. To disable multithreading:
Go to Tools -->Preferences -->Input/Codecs -->(select all in the lower left) -->under Input/Codecs on the left panel click on downward arrow in the first option "Video Codecs" -->click on FFmpeg -->find option called "Threads" and set it from 0 to 1 -->Save.
Now close and open VLC and play your videos. They should now be properly hardware accelerated.
In the end, you can choose between software multithreading and hardware decode. Thank FFmpeg developer for that.
Why? See this mail-list thread: https://ffmpeg.org/pipermail/ffmpeg-dev ... 87494.html
For mpv player, use --hwdec=vaapi option in the terminal, because hardware decoding is disabled by default.
This was tested using VA-API on Intel card using GNOME Wayland. Somehow, using my Radeon card (radeon drm driver) tears heavily some videos.
Why is video tearing present on Wayland is a mystery, but who cares, right?
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[HOWTO] Hardware accel via VA-API in VLC
- stevepusser
- Posts: 12930
- Joined: 2009-10-06 05:53
- Has thanked: 41 times
- Been thanked: 71 times
Re: [HOWTO] Hardware accel via VA-API in VLC
Va-api acceleration with the ffmpeg threads set to 0 (automatic) works for me with hardware decoding also set to automatic--perhaps it's smart enough to set the threading to one in that case. Don't forget that Intel users will also need to install i965-va-driver. Va-api also seems to be sensitive to versions of Mesa, libva, ffmpeg, and if they were all compiled against each other, so any of those from stretch-backports may break it--at least in my experience backporting those for MX Linux.
vlc using va-api for a test 4K HEVC video, plays smoothly while all cores are at 100% usage backporting the 4.19.37 kernel from Sid:
vlc using va-api for a test 4K HEVC video, plays smoothly while all cores are at 100% usage backporting the 4.19.37 kernel from Sid:
Code: Select all
$ vlc '/home/steve/Desktop/2160p Demo - 3840x2160 pixel_4k Video - a timelapse project by Florian Friedrich (4ksamples.com).mp4'
VLC media player 3.0.6 Vetinari (revision 3.0.6-0-g5803e85f73)
[0000564edf630140] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Could not resolve property : linearGradient4837
Could not resolve property : linearGradient4837
Could not resolve property : linearGradient4837
libva info: VA-API version 1.3.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_3
libva info: va_openDriver() returns 0
[00007fcdd8c0c200] avcodec decoder: Using Intel i965 driver for Intel(R) Coffee Lake - 2.2.0 for hardware decoding
MX Linux packager and developer
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: [HOWTO] Hardware accel via VA-API in VLC
Apologies for the off-topic post but totem provides hardware acceleration OOTB (using the gstreamer backend) and that is the video player for GNOME.Wheelerof4te wrote:This was tested using VA-API on Intel card using GNOME Wayland
deadbang
-
- Posts: 1454
- Joined: 2015-08-30 20:14
Re: [HOWTO] Hardware accel via VA-API in VLC
@stevepusser:
Could be, here is the screenshot when changing "Threads" option back to 0:
Note the 4 threads are below 10%, only Chromium with few tabs and GNOME Files were open. Plus Pulseaudio. This is on 1080p video.
Both Hardware acceleration and Video Output are set to automatic. Maybe I was wrong, here is the article I read about disabling multithreading:
https://wiki.debian.org/HardwareVideoAcceleration
EDIT:
I added some command line proof that hardware decoding is working:
EDIT2: Proof that GNOME Videos suck donkey lips:
Could be, here is the screenshot when changing "Threads" option back to 0:
Note the 4 threads are below 10%, only Chromium with few tabs and GNOME Files were open. Plus Pulseaudio. This is on 1080p video.
Both Hardware acceleration and Video Output are set to automatic. Maybe I was wrong, here is the article I read about disabling multithreading:
https://wiki.debian.org/HardwareVideoAcceleration
EDIT:
I added some command line proof that hardware decoding is working:
Code: Select all
vlc Shingeki\ no\ Kyojin\ -\ S03E13\ -\ The\ Town\ Where\ Everything\ Began.mkv
VLC media player 3.0.6 Vetinari (revision 3.0.6-0-g5803e85f73)
[000055d36f5c3570] main libvlc: VLC је покренут са подразумеваним интерфејсом. Команда „cvlc“ отвара VLC без интерфејса.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[ass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 2.3.1 (COMPLEX)
[ass] Using font provider fontconfig
libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[00007f3b84003400] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
[b][00007f3b94c14d30] avcodec decoder: Using Intel i965 driver for Intel(R) Broadwell - 2.3.0 for hardware decoding
[/b][ass] fontselect: (Arial, 700, 0) -> /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf, 0, LiberationSans-Bold
No offense, but that player sucks donkey lips.Head_on_a_Stick wrote:Apologies for the off-topic post but totem provides hardware acceleration OOTB (using the gstreamer backend) and that is the video player for GNOME.
EDIT2: Proof that GNOME Videos suck donkey lips:
- stevepusser
- Posts: 12930
- Joined: 2009-10-06 05:53
- Has thanked: 41 times
- Been thanked: 71 times
Re: [HOWTO] Hardware accel via VA-API in VLC
Maybe it needs one thread in Wayland, I don't know. I think you also need to be using the "intel" DDX video driver and not the modesetting one that Debian will default to, for Intel GPUs, but I'm not sure--is that what you're using?
I'm also using in my mpv.conf for 0.29.1 and for it to work with SVP4Linux, which is pretty cool, but I had to rebuild mpv with vapoursynth support to get that to work with SVP, too. SVP4Linux eats up a lot of CPU cycles to do its interpolating anyway, so any hardware decoding is hidden when using mpv with it.
As for a GNOME player, I forgot if I got hwdec working with gnome-mpv, but I like that better than Totem. I'll have to wait for a lot of kernels to finish building before I test that, though.
Edit: not working in gnome-mpv, but I can't find any real configuration for it. It does work with the MX Linux mpc-qt and libmpv1 0.29.1, though...lots of buttons and sliders to play with in its options.
I'm also using
Code: Select all
hwdec=auto-copy
As for a GNOME player, I forgot if I got hwdec working with gnome-mpv, but I like that better than Totem. I'll have to wait for a lot of kernels to finish building before I test that, though.
Edit: not working in gnome-mpv, but I can't find any real configuration for it. It does work with the MX Linux mpc-qt and libmpv1 0.29.1, though...lots of buttons and sliders to play with in its options.
MX Linux packager and developer
-
- Posts: 1454
- Joined: 2015-08-30 20:14
Re: [HOWTO] Hardware accel via VA-API in VLC
If you are asking for VLC, then I am indeed using modesetting driver. And it's clearly working.stevepusser wrote:Maybe it needs one thread in Wayland, I don't know. I think you also need to be using the "intel" DDX video driver and not the modesetting one that Debian will default to, for Intel GPUs, but I'm not sure--is that what you're using?
Code: Select all
inxi -G
Graphics:
Device-1: Intel HD Graphics driver: i915 v: kernel
Device-2: AMD Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430]
driver: amdgpu v: kernel
Display: wayland server: X.Org 1.20.3 driver: amdgpu
resolution: 1366x768~60Hz
OpenGL: renderer: Mesa DRI Intel Broadwell GT1 v: 4.5 Mesa 18.3.4
I like plain mpv better and I would only use it over VLC on minimal WM setups.stevepusser wrote:As for a GNOME player, I forgot if I got hwdec working with gnome-mpv, but I like that better than Totem. I'll have to wait for a lot of kernels to finish building before I test that, though.
- stevepusser
- Posts: 12930
- Joined: 2009-10-06 05:53
- Has thanked: 41 times
- Been thanked: 71 times
Re: [HOWTO] Hardware accel via VA-API in VLC
Nice to see that it also works with modesetting--thanks for testing!
So far, the players I've got it working on are:
VLC
mpv
SMPlayer using mpv backend
Kodi
MPC-Qt
QMPlay2
But I haven't even bothered testing Totem (movie player).
So far, the players I've got it working on are:
VLC
mpv
SMPlayer using mpv backend
Kodi
MPC-Qt
QMPlay2
But I haven't even bothered testing Totem (movie player).
MX Linux packager and developer