Apparently Intel’s VA-API is quite a pain to use and as such is not included in the main release on MPV (see mpv-#129 or mpv-#231). In other words, you won’t get hardware acceleration when using an Intel graphics card and Debian’s mpv version by default.
So, if you still want to use mpv with Intel’s hardware acceleration, you’ve got two possibilities:
- use libvdpau-va-gl, a vdpau → vaapi driver
mpvyourself and use that
Debian (testing) has packaged
libvdpau-va-gl already, so installation is quite easy:
apt-get install mpv -t unstable apt-get install libvdpau-va-gl1 -t testing apt-get install i965-va-driver -t testing # actual hardware driver
Next, configure mpv to use the vdpau backend by appending this to
Lastly you need to tell mpv to use the correct library by exporting
Most likely you want to set this in your
~/.xsession to avoid cluttering up your aliases
or having to set the variable each time.
If you omit
VDPAU_DRIVER=va_gl video output will not work. If you omit the settings in
mpv’s config file, you won’t get hardware acceleration even when setting the variable
correctly. I’m not sure why it doesn’t auto-detect vdpau support, even though
states it should.
CPU usage drops from 40-50% to 10-20%. More importantly, as the video decoding hardware is more efficient, the system temperature stays low enough to prevent the fan from spinning up. This alone is worth the effort. Compared to the amount of work I had to put in to get mplayer working with vaapi for the first time, this is a breeze.
Yay, thanks to everyone involved!
Building an updated version of mpv is much more complicated and I have failed to actually do
so. It would have been nice to compare if
libvdpau-va-gl is affecting performance.
Unfortunately I ran into problems which are most likely because of too old or incompatible
versions. I have the feeling that debugging those isn’t worth the additional performance I
might gain later.
In any case, here’s how far I’ve come:
First, check out the mpv-build repository and its subrepositories. This will take care of most source-dependencies for you:
git clone https://github.com/mpv-player/mpv-build cd mpv-build ./update
As of writing, the mpv version mpv-build pulls in is too old and does not yet have the vaapi patches. Therefore, update mpv by switching to the most recent commit in the submodule:
cd mpv && git checkout master && cd ..
Next up, install build dependencies and build mpv:
apt-get build-dep mpv # the resolver fails on my system, so I did it by hand make
When actually building the vaapi code, it fails with the following error message and I couldn’t find meaningful search results. As stated above, I don’t feel it’s worth the effort, so I stopped here.
video/out/vo_vaapi.c:142:6: error: 'VA_FOURCC_BGRA' undeclared here (not in a function) video/out/vo_vaapi.c: In function 'preinit': video/out/vo_vaapi.c:987:44: warning: comparison between pointer and integer [enabled by default] make: *** [video/out/vo_vaapi.o] Error 1