Outdated, see here for newer guide
https://nwgat.ninja/quick-easy-compiling-mpv-for-raspberry-pi/

Install Build Tools

  • sudo apt-get install -y gperf bison flex autoconf automake make makeinfo texinfo help2man libtool libtool-bin ncurses-dev git yasm mercurial cmake cmake-curses-gui libfribidi-dev checkinstall libfontconfig1-dev libgl1-mesa-dev libgles2-mesa-dev gnutls-dev libsmbclient-dev libpulse-dev libbluray-dev libdvdread-dev libluajit-5.1-dev libjack-dev libjpeg-dev libv4l-dev libcdio-cdda-dev libcdio-paranoia-dev
  • mkdir build

Compile ffmpeg

  • wget https://github.com/FFmpeg/FFmpeg/archive/n3.0.3.tar.gz
  • tar zxvf n3.0.3.tar.gz && cd FFmpeg-n*
  • ./configure --enable-gpl --enable-mmal --enable-gnutls && make -j4
  • sudo make install
  • checkinstall (make your own deb file)

Compile libass

https://github.com/libass/libass/releases

  • cd ..
  • wget https://github.com/libass/libass/releases/download/0.13.3/libass-0.13.3.tar.gz
  • tar zxvf libass-0.13.3.tar.gz && cd libass-0.*
  • ./configure && make -j4
  • sudo make install
  • checkinstall (make your own deb file)

Compile mpv

  • cd ..
  • wget https://github.com/mpv-player/mpv/archive/v0.20.0.tar.gz
  • tar zxvf v0.*.tar.gz && cd mpv-0.*.0/
  • ./bootstrap.py
  • ./waf configure --prefix=/usr
  • ./waf build -j4
  • sudo ./waf install
  • sudo ./waf uninstall (only use if you want to uninstall mpv)
  • echo "vo=rpi:background=yes" >> $HOME/.config/mpv/mpv.conf
  • checkinstall ./waf install (make your own deb file)

play video

Play a file (Big Buck Bunny 1080p 30fps)

  • mpv http://ow.ly/10tB0C

mmal error try setting video ram to 192

  • sudo su
  • echo "gpu_mem=128" >> /boot/config.txt
  • echo "gpu_mem=256" >> /boot/config.txt (rpi2/rpi3)

note: it will default to fullscreen and borderless window, this is a limitation of raspberry pi