How to enable Hardware acceleration
Disclaimer: Sorry but it's an answer for VLC, not mpv player. I believe there are bugs or lack of support in mpv player because in my setup, while VLC is working fine with low CPU, mpv player doesn't. You may face the FFmpeg multithreading issue (see point 4).
I've really struggled to get this working, and I'm a bit disapointed of the limited NVIDIA GTX 10*0 (Pascal) HEVC support compared to AMD.
0. Check HEVC profile support
Edit: NVIDIA VDPAU driver now supports HEVC Main 10 profile on Linux since version 450.51+
Check media file HEVC profile: You can check your file HEVC profile by right-clicking on your file > Properties
> Audio/Video
tab > Video
> Codec
.
Check driver HEVC profiles support: Switch to the NVIDIA proprietary drivers (see below) and run:
$ vdpauinfo
Information string: NVIDIA VDPAU Driver Shared Library 367.57 [crop]
Decoder capabilities:
name level macbs width height
----------------------------------------------------
[crop]
HEVC_MAIN 153 262144 8192 8192
HEVC_MAIN_10 --- not supported ---
HEVC_MAIN_STILL --- not supported ---
HEVC_MAIN_12 --- not supported ---
HEVC_MAIN_444 --- not supported ---
$ vdpauinfo
Information string: NVIDIA VDPAU Driver Shared Library 450.80.02 [crop]
Decoder capabilities:
name level macbs width height
----------------------------------------------------
[crop]
HEVC_MAIN 153 262144 8192 8192
HEVC_MAIN_10 153 262144 8192 8192
HEVC_MAIN_STILL --- not supported ---
HEVC_MAIN_12 153 262144 8192 8192
HEVC_MAIN_444 --- not supported ---
1. Switch to NVIDIA proprietary drivers
You need at least version R367 (nvidia-367
).
software-properties-gtk &
Go to Additional drivers
tab, check NVIDIA binary driver
and Apply
the changes.
2. Enable hardware acceleration in VLC
Of course, you must enable hardware acceleration in VLC > Tools
> Preferences
(Simple
) > Input / Codecs
> Hardware-acceleration decoding
= Auto
. For NVIDIA, you can choose VDPAU video decoder
explicitely.
3. Update VLC to 2.2.4 or 3.0
There are several bugs in VLC 2.2.2 (Ubuntu 16.04), fixed in later versions (see: changelog), that lead to this misleading error:
$ vlc --version
VLC media player 2.2.2 Weatherwax
$ vlc <file>
[crop]
[00007fa4b42cc5d8] vdpau_avcodec generic error: unsupported codec 1211250229 or profile 1
That's clearly a misleading and buggy error. Hard to tell, but 1211250229
does mean AV_CODEC_ID_HEVC
(can be checked by compiling with rustc
this rusty code). And we've seen from vdpauinfo
that HEVC profile 1
(= Main
) is supported.
At this time, VLC 2.2.4 is not available from the official VLC PPA (check stable version here). So upgrade to VLC 3.0 from the master branch (check master version here) but keep in mind it's a nightly release:
$ sudo add-apt-repository ppa:videolan/master-daily
$ sudo apt update
$ sudo apt install vlc
$ vlc --version
[crop]
VLC version 3.0.0-git Vetinari
4. Temporarily disable VLC FFmpeg multithreading
As this is not enough, you may now face this issue:
$ vlc <file> --verbose
[crop]
[00007f6bc4ccc688] avcodec decoder warning: thread type 1: disabling hardware acceleration
Explainations on this thread at VLC forum:
It means you're using FFmpeg, which no longer allows enabling hardware acceleration and threading at the same time. You need to use libav [but] this is decided while compiling VLC. You can't change it at run-time.
On the same thread, there's a workaround: In VLC > Tools > Preferences (All) > Input / Codecs > Video codecs > FFmpeg, change the value of Threads
from 0
(auto) to 1
.
And you're done!
But that's a manual workaround: keep in mind that to watch videos not GPU-accelerated, you should reset the VLC FFmpeg Threads
setting to use all your CPU cores... or compile VLC from source with libav.
Related videos on Youtube
Behrooz Ramezani
Updated on September 18, 2022Comments
-
Behrooz Ramezani almost 2 years
I installed Ubuntu 16.04 and I have an NVIDIA GTX 1070 OC. I added this PPA:
ppa:graphics-drivers/ppa
And I installed the nvidia-370 package for my GTX 1070 OC. Then I played a 4K video file with HEVC Codec and excepted for hardware acceleration to be enabled to hardware decoding HEVC codec, but mpv player was using the software decoding mod. How can i fix this issue?
-
doug over 7 yearsWhile that gpu should support hevc decoding maybe install vdpauinfo & ck. for support with
vdpauinfo
(- will list supported ) If good run mpv with--hwdec=vdpau --vo=vdpau
options, see if it uses hw decoding. -
Behrooz Ramezani over 7 yearsoutput vdpauinfo paste.ubuntu.ir/hnfl
-
Behrooz Ramezani over 7 yearsand this output mpv when play 4k HEVC codec paste.ubuntu.ir/ixqa mpv use software decoding mod
-
-
jesjimher over 3 yearsVDPAU 1.4 added support for HEVC_MAIN_10