HDMI Output with ffplay

Hi ogra,
thanks for your quick reply. The opengl plug is connected (I also connected the framebuffer plug).

looks like you might need special build options for gles (though the bug only mentions intel)

you might also need libegl1-mesa-drivers in stage-packages since you do not have an X11 server or wayland compositor … alternatively you could install mir-kiosk alongside to get a wayland compositor/server to connect to and use the wayland-socket-dir and x11 plugs like in:

some more details are at:

and if you look for a completely quiet boot with splash screen there is:

EDIT: and i forgot to link the full tutorial (see step 12):

Sorry for the late reply. I was away for a while. Thanks for your support.

So I found out a few things but I am still having trouble:

  • I was using Ubuntu Core stable version which was the problem why I was not able to see anything on the screen. Seems that the edge version is required to get mir-kiosk and graphical snaps running.

  • I’ve installed mir-kiosk for wayland support and I can also see something on my screen when I try out mir-kiosk-apps

  • My mpv snap is here [1]

  • When executing the mpv snap “mpv-casept.mpv SampleVideo.mp4 --vo=wayland” I get the following message:
    [vo/wayland/wayland] failed to connect to a wayland server: check if a wayland compositor is running Error opening/initializing the selected video_out (--vo) device.

  • Executing the mpv snap with sudo gets me further and I see the first frame of the video on the screen. Afterwards no further frames are shown and in the logs the following is shown:
    [vo/wayland/wayland] can't draw, back buffer is busy

Some additional information:

  • I’ve tried to build mpv with the --enable-rpi flag but I am running into:
    You manually enabled the feature 'rpi', but the autodetection check failed. Failed to run './waf configure --enable-rpi' for 'mpv': Exited with code 1. Verify that the part is using the correct parameters and try again.

  • Do I need to follow the approach described in https://www.raspberrypi.org/forums/viewtopic.php?t=199775 and install the GLES and EGL files from the official raspberry pi github page + change the wscript file?

I am trying further to get mpv running on rpi with Ubuntu Core but maybe you have some advices for me. Thanks.

[1] MPV snap

name: mpv-casept
version: '0.27.0'
summary: a free, open source, and cross-platform media player. Unofficial snap.
description: |
  mpv is a media player based on MPlayer and mplayer2.
  It supports a wide variety of video file formats,
  audio and video codecs, and subtitle types.
grade: devel
confinement: devmode

    command: usr/local/bin/mpv
      LIBGL_DRIVERS_PATH: $SNAP_DATA/usr/lib/arm-linux-gnueabihf/dri
    plugs: [framebuffer, x11, opengl, unity7, pulseaudio, home, network, removable-media, optical-drive, wayland, alsa]

    content: wayland-socket-dir
    interface: content
    target: $SNAP_DATA/wayland
    default-provider: mir-kiosk:wayland-socket-dir

    source: https://github.com/mpv-player/mpv/archive/v0.27.0.tar.gz
    plugin: waf
    prepare: |
      - libasound2
      - libass5
      - libatomic1
      - libbluray1
      - libc6
      - libcdio-cdda1
      - libcdio-paranoia1
      - libcdio13
      - libdrm2
      - libdvdnav4
      - libdvdread4
      - libegl1-mesa
      - libgbm1
      - libgl1-mesa-glx
      - libgles2-mesa-dev
      - libjack-jackd2-0
      - libjpeg8
      - liblcms2-2
      - liblua5.2-0
      - libpulse0
      - librubberband2v5
      - libsdl2-2.0-0
      - libsmbclient
      - libsndio6.1
      - libuchardet0
      - libv4l-0
      - libva-drm1
      - libva-wayland1
      - libva-x11-1
      - libva1
      - libvdpau1
      - libwayland-client0
      - libwayland-cursor0
     - libwayland-egl1-mesa
      - libx11-6
      - libxext6
      - libxinerama1
      - libxkbcommon0
      - libxrandr2
      - libxss1
      - libxv1
      - zlib1g
      - build-essential
      - libasound2-dev
      - libass-dev
      - libbluray-dev
      - libcdio-paranoia-dev
      - libdvdnav-dev
      - libdvdread-dev
      - libegl1-mesa-dev
      - libenca-dev
      - libgbm-dev
      - libgl1-mesa-dev
      - libguess-dev
      - libjack-dev
      - libjpeg-dev
      - liblcms2-dev
      - liblua5.2-dev
      - libpulse-dev
      - librubberband-dev
      - libsdl2-dev
      - libsmbclient-dev
      - libsndio-dev
      - libswscale-dev
      - libuchardet-dev
      - libv4l-dev
      - libva-dev
      - libvdpau-dev
      - libwayland-dev
      - libx11-dev
      - libxinerama-dev
      - libxkbcommon-dev
      - libxrandr-dev
      - libxss-dev
      - libxv-dev
      - libgles2-mesa-dev
      - pkg-config
      - python
      - python-docutils
    after: [ffmpeg]
    source: git://source.ffmpeg.org/ffmpeg.git
    source-tag: n3.2.4
    plugin: autotools
      - --disable-ffprobe
      - --enable-gpl
      - --enable-libass
      - --enable-libfreetype
      - --enable-libmp3lame
      - --enable-libopus
      - --enable-libtheora
      - --enable-libvorbis
      - --enable-libvpx
      - --enable-libx264
      - --enable-libx265
      - --enable-nonfree
      - --enable-opengl
      - --enable-static
      - --enable-omx
      - --enable-omx-rpi
      - --enable-libxcb
      - --enable-libfreetype
      - --enable-gnutls
      - --disable-opencl
      - autoconf
      - automake
      - build-essential
      - cmake
      - g++
      - git
      - libass-dev
      - libfreetype6-dev
      - libmp3lame-dev
      - libopus-dev
      - libsdl2-dev
      - libtheora-dev
      - libtool
      - libva-dev
      - libvdpau-dev
      - libvorbis-dev
      - libvpx-dev
      - libx264-dev
      - libx265-dev
      - libxcb-shm0-dev
      - libxcb-xfixes0-dev
      - libxcb1-dev
      - make
      - pkg-config
      - texinfo
      - yasm
      - zlib1g-dev
      - libluajit-5.1-dev
      - libfontconfig1-dev
      - libfribidi-dev
      - python-docutils
      - libjpeg-dev
      - libgnutls28-dev
      - libomxil-bellagio-dev
      - libssl-dev
      usr/local/bin: usr/bin

I am not sure if mir-kiosk actually allows apps that are not running as service (i assume you need write access to the socket, which likely is root owned), probably someone from the mir team can clearify this … @greyback @alan_g ?

The socket is owned by root, but the permissions allow any user to connect.

Hmm, then it should theoretically find the socket if the wayland-socket-dir interface has been properly connectded…

That ought to be easy to verify with:

snap run --shell mpv-casept



@getty23 I can’t help much with RPi (don’t have one), but I understand there are some oddities with its graphics. It might be better to isolate those issues by getting this working on amd64 first. (Use the Ubuntu Core VM from https://community.ubuntu.com/t/snaps-to-develop-a-web-kiosk-on-ubuntu-core-using-wayland/).

There are no oddities with RPi graphics regarding “just running” GL/GLES stuff on mir, glamour works perfectly fine here …

there might be issues with HW acceleration though (specfically for video playback and decoding), and this might need some special work later. but the snap should still start and run fine (despite the possibility of it being a slideshow like experience) as long as everything is properly connected …

Thanks for your replies.
I checked on the permissions:

snap run --shell mpv-casept.mpv
getty23@localhost:/home/getty23$ ls -hl $XDG_RUNTIME_DIR
ls: cannot open directory '/var/snap/mpv-casept/x1/wayland': Permission denied

While with sudo I get:

sudo snap run --shell mpv-casept.mpv
root@localhost:/home/getty23# ls -hl $XDG_RUNTIME_DIR
total 4.0K
drwx------ 2 root root 4.0K Aug  2 04:22 pulse
srw-rw-rw- 1 root root    0 Aug  7 05:09 wayland-0
-rw-r----- 1 root root    0 Aug  6 04:50 wayland-0.lock

My snap plugs are connected:

mir-kiosk:wayland             mpv-casept 
mir-kiosk:wayland-socket-dir  mpv-casept

Regarding the graphics I am also puzzled because even if hw acceleration is not yet working it should play the video slow but I just see the first frame and afterwards for each frame in the log it is printed: [vo/wayland/wayland] can't draw, back buffer is busy. The frames are not dropped but just this message is shown.

you will need to run the snap as root, to get access to the directory containing the wayland socket - I’m refactoring the snap interface design to make this problem go away.

It looks like MPV is getting a wayland connection when you run as root, but something is wrong when swapping frames. Could be a Mir/wayland issue.

Trying mpv with Mir on stock Xenial is crashing for me, need to figure that out first. Why it isn’t crashing for you is a curiosity for me!

Thanks for the support. Let me know if I can support in this issue.

Currently I am trying to integrate mmal, libEGL and libGLESv2 in my snap directly from the raspberry firmware (as described here https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=199775 in step12) because mmal is needed if I build ffmpeg with --enable-mmal and I think the EGL and GLESv2 libraries will help mvp. Though I am having trouble how to integrate it in my snap:

Could you advice me what the best method?

i started playing with the vc libs before (note though that this is all fully untested but it builds):

name: vc-libs
version: '0.1'
summary: Raspberry Pi VC4 libs
description: |
  userspace libs, typically found in /opt/vc

grade: stable
confinement: strict

  - build-on: amd64
    run-on: armhf

      bind: $SNAP/opt/vc

    plugin: nil
    override-build: |
      git clone --depth=1 https://github.com/raspberrypi/userland.git .
      ./buildme "$SNAPCRAFT_PART_INSTALL"
      - cmake
      - g++-arm-linux-gnueabihf

using the part should put the libs into $SNAP/opt/vc … note that layouts are still an experimental feature (i.e. it will cause a manual review in the store and you need to explicitly enable it on your core image) in case you want to use the fancy layouts re-mapping i use above … but perhaps it helps to just add $SNAP/opt/vc/lib to LD_LIBRARY_PATH in a wrapper of your app.

Thanks for providing the part. This really helped to integrate it into my snap.

I just have a library reference problem. For my ffmpeg part I enabled mmal (–enable-mmal) but I am still running into the error “ERROR: mmal not found” (more information here: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/ffb9025f39b274abfc4ad2b264205a44cc0238a4:/configure line 4680).

I build the ffmpeg part after vclibs, I have the layout included (though I am not sure if it applies to the build process already) and I tried multiple things to set additional paths for the ffmpeg part. For example

   prepare: |

Maybe you have a hint for me how to make the libs for mmal available for the ffmpeg build. Sorry for asking so many questions but I am still learning on snap ;). Thanks for your great support!

i think the vc libs will actually only help at runtime mmal.h should actually be shipped with the kernel headers, try adding linux-headers-raspi2 to your build-packages

for openmax support (i.e. if you also want to set --enable-omx-rpi, you also want libomxil-bellagio-dev in build-packages)

I tried that before but with this library I am running in the same problem. Although in this post they are also stating that this might be the right library: https://stackoverflow.com/questions/40175644/ffmpeg-hardware-acceleration-on-raspberry-pi/40182218#40182218

I now got it compiled with libraspberrypi-dev by adding the optional ppa: ppa:ubuntu-raspi2/ppa (https://wiki.ubuntu.com/ARM/RaspberryPi)

The ‘libomxil-bellagio-dev’ I already included.

Now I am facing two problems:

  • I added the optional ppa manually (not via snap). What’s the best way to do it via snap?
  • When I run mpv now I get
[vo/rpi] Could not get DISPMANX objects.
* failed to add service - already in use?

I am currently trying to analyse it. If you already have an idea, just let me know.

if you include the -dev libs in build-packages you need their non-dev equivalents in stage-packages

also see: