[Tutorial] - Build (or download) Mpv with hardware accelerated video decoding

Mpv is a very good media player like vlc.
It don’t have GUI out the box, but there is two good ones : SMplayer and bomi.

This tutorial is about building Mpv with hardware accelerated video decoding for ubuntu mate, lubuntu and xubuntu for raspberry pi 2.

Prerequisites
We need a version libavcodec (part of ffmpeg) with hardware accelerated video decoding enabled !
You must build it or download it from that post :

Download my build of mpv
If you want to download my build of mpv with hardware acceleration video decoding.

wget http://dl.free.fr/ihMeTU1q9 -O mpv-0.15.0.tar.xz

Check the sha1 :

echo “82f2c1d7d68a91d5fff734f44892f0fb9cddf8ed mpv-0.15.0.tar.xz” | sha1sum -c -

You must have :

mpv-0.15.0.tar.xz: OK

If you don’t the archive is corrupted or hacked !
then extract the archive :

tar Jxvf mpv-0.15.0.tar.xz
cd mpv-0.15.0

Go to install mpv step

Build mpv from source
If you want to build it from sources, first of all we need to get the buidl dependancies :

sudo apt-get update
sudo apt-get build-dep mpv

The version on the ubuntu repository is too old and no provide hardware acceleration so we download the last release and extract it:

wget https://github.com/mpv-player/mpv/archive/v0.15.0.tar.gz
tar zxvf v0.15.0.tar.gz
cd mpv-0.15.0/

Then build mpv :

./bootstrap.py
./waf configure --prefix=/usr
./waf build -j4

Install mpv

sudo ./waf install

If you want to remove installation later :

sudo ./waf uninstall

Play videos
To play a video fullscreen (works really good) :

mpv video.mp4

To play windowed mode you can :

mpv --vd=lavc:h264_mmal --vo=x11 video.mp4

It is a little bit slow but better than vlc in windowed mode, you can resize and fullscreen too.
The hardware decoding works great but the X11 output is very slow on raspberry pi, maybe with some overclocking it can work great.

Note : It is a shame the sdl video output is based only on OpenGL and not X11 because we would have a good player for pi …
But I ask mpv team but they don’t want to do it :frowning:
I will try with mplayer which have sdl/x11 video output.

SMplayer GUI in ubuntu mate 15.10.1 don’t support mpv, I will write a tutorial soon to build a compatible version : http://www.smplayer.eu/
Maybe for bomi too, if I have time : https://bomi-player.github.io/

Edit : Added windowed mode
Edit2 : Added mpv download

Enjoy !

Aworan