Skip to content
December 11, 2015 / ftth

Compiling glimagesink for GLES (without Xorg) on RaspberryPi

The original RaspberryPi has awesome software support for many things, but when things get to multimedia capabilities, apart from the reference implementations (omxplayer, raspivid…), things tend to get messy or inconsistent, requiring you to recompile heavily patched packages.

As an example, i tried to compile the latest Gstreamer OpenGL elements without Xorg support so that it is possible to use OpenGL without the whole Xorg stack, for e.g. kiosk-style uses. Moreover, the current OpenGL/GLX/Xorg stack on the RaspberryPi is not hardware-accelerated (yet), so using GLES using the vendor SDK should offer better performance.

After a lot of fumbling, here’s a quick summary of the steps required to compile it (most of the time spent was to figure out the CFLAGS and LDFLAGS necessary  to use the SDK OpenGL headers, and complicated by a “bug/feature” with headers within the raspberrypi official sdk and the fact that Mesa libraries can be used at runtime instead of the rpi sdk):

pacman -S gstreamer base-devel
git clone git://
cd gst-plugins-bad
git checkout -b remotes/origin/1.6
./configure CFLAGS="-I/opt/vc/include -I /opt/vc/include/interface/vcos/pthreads -I /opt/vc/include/interface/vmcs_host/linux/" LDFLAGS="-L/opt/vc/lib" --disable-gtk-doc --disable-opengl --enable-gles2 --enable-egl --disable-glx --disable-x11 --disable-wayland --enable-dispmanx --with-gles2-module-name=/opt/vc/lib/ --with-egl-module-name=/opt/vc/lib/

[go grab coffee/lunch/...]

mkdir -p ~/.local/share/gstreamer-1.0/plugins
cp ./ext/gl/.libs/  ~/.local/share/gstreamer-1.0/plugins

Then, after copying the relevant .so files to ~/.local/share/gstreamer-1.0/plugins, you should finally be able to display video using gstreamer:

GST_GL_WINDOW=dispmanx GST_GL_API=gles2 GST_GL_PLATFORM=egl gst-launch-1.0 videotestsrc ! glimagesink

The environment variables are not even be necessary if only a single platform is supported (which is the case here), so you can even run

gst-launch-1.0 videotestsrc ! glimagesink


I also created an AUR package (gst-plugins-bad-rpi-nox) for easier operation — but that will still take a few hours to complete.

Many thanks to Julien Isorce and Matthew Waters for their help !



Leave a Comment
  1. Gamadril / Feb 22 2016 12:38 pm

    Are you sure it’s really hardware accelerated? Can you check this out?
    gst-launch-1.0 videotestsrc pattern=ball ! video/x-raw,width=1920,height=1080 ! glimagesink

    • ftth / Feb 22 2016 7:09 pm

      videotestsrc is not hardware accelerated (not compiled with ARM otimizations through orc), so it’s rather slow. Recompiling gst-plugins-base would be necessary for that.

      • Gamadril / Feb 23 2016 1:17 pm

        I’ve tried it with a small sample from here (jellyfish-3-mbps-hd-h264.mkv) and couldn’t get it playing properly. omxh264dec is working, glimagesink shows a slide show. could you test it on your device?

      • ftth / Feb 23 2016 9:36 pm

        The slideshow effect probably indicates you need to increase gpu_mem

    • ftth / Feb 24 2016 5:25 pm

      Btw if you are running on xorg, that’s normal.

  2. david / Mar 17 2017 11:06 pm

    I built this but I’m getting low framerates / broken frames (like I-frames went missing) etc. I have more than enough video memory and my videos are never >1280×720. I need this because I’m playing a network (rtp over udp) stream and omxplayer doesn’t like it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: