0

I would like to build mpv from source for the raspberry pi. This is turning out to be quite difficult.

Error

pi@raspberrypi:~ $ ./mpv-build/mpv/build/mpv --hwdec=mmal --vo=rpi --log-file=~/mpv.log small.mp4 Playing: small.mp4 (+) Video --vid=1 (*) (h264 560x320 30.000fps) (+) Audio --aid=1 --alang=eng (*) (aac 1ch 48000Hz) Using hardware decoding (mmal). VO: [rpi] 560x320 mmal libEGL warning: DRI2: failed to authenticate [vo/rpi] Could not create EGL surface! [vo/rpi] EGL/GLES initialization for OSD renderer failed. Could not initialize video chain. Video: no video [ao/oss] Can't open audio device /dev/dsp: No such file or directory [ao] Failed to initialize audio driver 'oss' Could not open/initialize audio device -> no sound. Audio: no audio Exiting... (Errors when loading file) 

Setup & Procedure

OS: Raspbian Stretch 2018-06-27

Hardware: Raspberry Pi 3B/3B+

sudo apt-get update -y sudo apt-get upgrade -y sudo rpi-update 

in raspi-config, go to advanced > memory split: 256

reboot now

sudo apt-get install -y gperf bison flex autoconf automake make 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 libjpeg-dev libv4l-dev libcdio-cdda-dev libcdio-paranoia-dev libmp3lame-dev libx264-dev git clone https://github.com/mpv-player/mpv-build.git cd mpv-build export LIBRARY_PATH=/opt/vc/lib export PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig/ export CPATH=/opt/vc/include # export LDFLAGS="-L/opt/vc/lib" echo "--enable-libx264 --enable-omx-rpi --enable-libmp3lame --enable-mmal --enable-gpl --enable-nonfree --disable-v4l2-m2m" > ffmpeg_options echo "--enable-rpi " > mpv_options ./update ./rebuild -j4 sudo scripts/mpv-install 

Things I've tried

  1. Links like this

    sudo ln -s libbrcmEGL.so libEGL.so sudo ln -s libbrcmGLESv2.so libGLESv2.so

  2. Links like this, (source)

    sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so sudo ldconfig

Neither worked, so then I rebooted and did some more searching. I found some posts saying it was an opengl problem so I tried to install new opengl packages

sudo apt-get install -y libglu1-mesa-dev freeglut3-dev mesa-common-dev

That didn't work, so I thought maybe it couldn't find packages I already had installed. I tried exporting the variables that were used in the install

export LIBRARY_PATH=/opt/vc/lib export PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig/ export CPATH=/opt/vc/include

still nope.

Next I found a guide saying there needed to be an rpi-update. I had run one at the beginning, but I decided to try again.

sudo rpi-update

no luck!

Found another post that led to this

sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1 sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2

After this point desperation and frustration sink in and further attempts go undocumented. Needless to say, nothing I tried worked, which leads me to post here

2
  • why not sudo apt install mpv? Commented Jul 14, 2018 at 1:47
  • It doesn't really work for rpi. It needs FFmpeg to be installed with hardware acceleration (the mmal in title) or it's basically unusable, like 1 frame per second. Commented Jul 14, 2018 at 1:49

2 Answers 2

1

I have an RPi3B+ I just installed mpv and ffmpeg 3.4.1 by following this well-written tutorial:

https://www.raspberrypi.org/forums/viewtopic.php?t=199775

It worked. I suggest you follow the tutorial to the letter. If it says "reboot", then do that. Don't think "Oh not necessary yet."

Actually, I only wanted to update ffmpeg, but in the end I achieved my goal (updated ffmpeg), but I am also very impressed with the performance of mpv now that it is using the Rpi's hardware acceleration.

Hope this helps.

2
  • Hi and welcome. It would be better if you edited and included the process and any code, from the link, in your answer. As it stands this is a bit of a link only answer. If the link dies then your answer will not be of much use to anyone, unfortunately. Commented Jul 17, 2018 at 19:36
  • Awesome, this worked for me. It's unfortunate the mpv-build tools don't work directly Commented Jul 18, 2018 at 23:13
0

"In normal circumstances there is NEVER a need to run rpi-update as it always gets you to the leading edge firmware and kernel and because that may be a testing version it could leave your RPi unbootable". https://www.raspberrypi.org/forums/viewtopic.php?p=916911#p916911 Even the rpi-update documentation now warns "Even on Raspbian you should only use this with a good reason. This gets you the latest bleeding edge kernel/firmware."

sudo apt-get update; sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel will put it back to the latest supported kernel/bootcode.

2
  • Thanks, I'll try this. The reason I ran rpi update is that several times it came up from other posters that it may be required for mpv compilation. Here are a few examples from a forum post 1, post 2 Commented Jul 14, 2018 at 1:58
  • Reverting did not change the error message Commented Jul 14, 2018 at 2:02

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.