After writing my post about VDPAU in Debian [1] I received two great comments from anonymous people. One pointed out that I should be using VA-API (also known as VAAPI) on my Intel based Thinkpad and gave a reference to an Arch Linux Wiki page, as usual Arch Linux Wiki is awesome and I learnt a lot of great stuff there. I also found the Debian Wiki page on Hardware Video Acceleration [2] which has some good information (unfortunately I had already found all that out through more difficult methods first, I should read the Debian Wiki more often.
It seems that mplayer doesn’t suppoer VAAPI. The other comment suggested that I try the mpv fork of Mplayer which does support VAAPI but that feature is disabled by default in Debian.
I did a number of tests on playing different videos on my laptop running Debian/Buster with Intel video and my workstation running Debian/Unstable with ATI video. The first thing I noticed is that mpv was unable to use VAAPI on my laptop and that VDPAU won’t decode VP9 videos on my workstation and most 4K videos from YouTube seem to be VP9. So in most cases hardware decoding isn’t going to help me.
The Wikipedia page about Unified Video Decoder [3] shows that only VCN (Video Core Next) supports VP9 decoding while my R7-260x video card [4] has version 4.2 of the Unified Video Decoder which doesn’t support VP9, H.265, or JPEG. Basically I need a new high-end video card to get VP9 decoding and that’s not something I’m interested in buying now (I only recently bought this video card to do 4K at 60Hz).
The next thing I noticed is that for my combination of hardware and software at least mpv tends to take about 2/3 the CPU time to play videos that mplayer does on every video I tested. So it seems that using mpv will save me 1/3 of the power and heat from playing videos on my laptop and save me 1/3 of the CPU power on my workstation in the worst case while sometimes saving me significantly more than that.
Conclusion
To summarise quite a bit of time experimenting with video playing and testing things: I shouldn’t think too much about hardware decoding until VP9 hardware is available (years for me). But mpv provides some real benefits right now on the same hardware, I’m not sure why.
Hi Russell,
concerning mpv and Youtube, you can use youtube-dl to download H.264 video from Youtube. Your processor should be able to decode H.264 with its integrated GPU.
I just download the best quality available.
You can check support for your card with “vainfo”. mpv has a direct integration with youtube-dl, you can use provide the URL. As for hardware decoding, this is enabled in the Debian build, use “–hwdec=auto”, but mpv discourages its use. Check the manual page. I am using it on my laptop without any issue.
As for CPU usage, mpv has a very good video output driver leveraging GPU acceleration for many operations while avoing copy operations. Don’t use vaapi as an output driver, the gpu driver can let VAAPI decodes frames and displays them (without cost, thanks to no copy operation involved).
(I’m the same person that mentioned VA-API in your last post — happy to hear this helped!)
If YouTube is your goal, have a look at the h264ify or enhanced-h264ify Chrome/Firefox addons. These block your browser from claiming to support selected codecs (e.g. VP8/VP9), thus forcing sites like YouTube to deliver the H.264 versions of the file (that they do support, just don’t prefer).
If you’re using Firefox, VA-API is not supported out of the box, though. You’ll need to run firefox with “MOZ_WEBRENDER=1 MOZ_X11_EGL=1 firefox” for video to be hardware accelerated (bugs still may lie, though). https://bugzilla.mozilla.org/show_bug.cgi?id=1677203 tracks the latest progress there. I’m not sure what the latest on Chromium/Chrome + VA-API is, I’m a Firefox user myself.
mpv in Debian supports VA-API fine, I’ve been using it for ages. My config is:
$ cat .config/mpv/mpv.conf
profile=opengl-hq
hwdec=vaapi