In order to have a hardware-accelerated mpv on my RPi 3 (running Raspbian 8.0) I followed this Tutorial using the »Build it yourself« section and the scripts from this mpv repository. However, when I play a video file I get this errors:

$ mpv https://www.youtube.com/watch?v=NpOtkhBcc8k
Playing: https://www.youtube.com/watch?v=NpOtkhBcc8k
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) 'DASH audio' (aac) (external)
[vo/opengl] glGetString(GL_VERSION) returned NULL.
[vo/opengl] Suspected software renderer or indirect context.
AO: [alsa] 44100Hz stereo 2ch s16
Using hardware decoding (rpi).
VO: [opengl] 1280x720 mmal
[vo/opengl] Using HW-overlay mode. No GL filtering is performed on the video!
[osd/libass] PlayResX undefined, setting to 640
AV: 00:00:02 / 01:36:11 (0%) A-V:  0.000 Dropped: 33/48 Cache: 10s+1MB

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

AV: 00:00:23 / 01:36:11 (0%) A-V: -0.000 Dropped: 364/231 Cache: 10s+6MB

In addition, the playback is slow.

mpv 0.21.0-git-e6b85c9 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on Fri Nov 18 15:18:17 CET 2016
ffmpeg library versions:
   libavutil       55.40.100
   libavcodec      57.66.105
   libavformat     57.57.100
   libswscale      4.3.101
   libavfilter     6.67.100
   libswresample   2.4.100
ffmpeg version: N-82556-g127cc6d

$ glxinfo | grep -i opengl
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.7, 128 bits)
OpenGL version string: 3.0 Mesa 11.1.0
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

Ffmpeg build options:


How can I get properly running video playback? Are the errors in the terminal output related to my issues?

1 Answer 1


You are on the right track by using mmal hardware decoding and the mpv-build repo (which makes things a lot easier). I found out a config that works pretty well for me, although it's specifically tuned to work explicitly without X11 via an ssh environment within the linux framebuffer. (I think all of this will work for anyone though). So to fully answer the question for anyone that stumbles around here, you'll have to make the following adjustments to your pi (assuming that you're running the newest raspbian):

$ sudo apt-get update; sudo apt-get upgrade
$ sudo rpi-update # (this will update video/opengl/gpu/whatever drivers, probably an good idea)
$ sudo raspi-config

Then go to advanced options > memory split and select a split of somewhere around 192. Rebooting now is probably a good idea. Then you'll need to do something like this in the mpv-build directory that you've linked to in your post:

# Possibly add these exports to your .bashrc so you don't have to enter them everytime
$ export LIBRARY_PATH=/opt/vc/lib
$ export PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig/
# you might prefer some different options, but the coverage of these is pretty okay
# (obviously you will need the libmp3lame and x264 packages as well)
#  v4l2-m2m hardware decoding is disabled because mmal is faster, and because it's too slow regardless
$ echo "--enable-libx264
--disable-v4l2-m2m" > ffmpeg_options
$ ./rebuild -j4
$ sudo scripts/mpv-install # to install mpv somewhere, mine is in /usr/local/bin/

Now, most guides so far lack a little in with sort of mpv configuration you have to use . Given the discussion on the mpv github, the developers don't seem to have a lot of interest in coming up with specific hacks for the pi all the time. So the normal way of calling mpv with --vo=libmpv/--vo=gpu won't work all that well, even if you provide --hwdec==mmal (which will try to use your GPU). (the results vary from errors to weirdly layered video output) Instead, I found the best way to use your GPU is the following:

$ mpv --hwdec=mmal --vo=rpi [VIDEO_FILE]

It's an good idea to add these two options to a file named "mpv.conf" within ~/.config so that you don't have to type them all the time. You'll probably find many of the other mpv configuration options interesting as well. Given that the developers might properly support the --vo=gpu option in the future, the exact way of calling mpv could change. The mpv FAQ states that --hwdec=rpi should be used instead for example, which is incorrect given that it leaves the GPU unused, but it could be the way it'll work in the future.

Another strong recommendation is installing youtube-dl for internet video support. The python package manager pip probably has the newest version, mpv will pick it up immediately I think. (otherwise just recompile mpv)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.