GStreamer on Raspberry Pi

Sebastian Dröge sebastian.droege at
Wed Mar 20 04:29:21 PDT 2013

Hi everybody,

as this was a common subject on IRC and on this mailing list in the past
I decided to write some kind of guide about how to get GStreamer working
as good as possible on the Raspberry Pi. This will also be added to the
GStreamer Wiki once it works again.

I) Preparations
1) First of all get a useable Linux distribution for Raspberry Pi,
especially Raspbian would be a good choice but all this (with some minor
changes) should also work on other distributions.

2) Update the firmware to the latest available version, you can use
rpi-update for that:

3) Make sure you reserved at least 128M of memory for VideoCore, e.g.
add this to /boot/config.txt:

4) If you need VC1 or MPEG2 decoding you'll have to order license keys
for these codecs from

5) If you want VP8 and Theora decoding you'll have to boot experimental
firmware. Add this to /boot/config.txt:

6) Reboot to apply the above changes

II) Setting up a build environment
You have multiple options here, you can either 1) directly build on the
Raspberry Pi (which will be quite slow), 2) compile on your development
machine in a chroot using qemu, 3) having a hybrid chroot (including arm
and x86 binaries) or 4) doing complete cross compilation.

1) is rather obvious, nothing to explain here

2) is a bit more complicated to set up, see these instructions here for
doing it with Raspbian:

3) works the same way as 2) but you would install packages for your host
architecture (x86 or amd64 probably) inside the qemu chroot, replacing
some build tools. Especially the shell, perl, m4, make and the compiler
will make a big difference. See for
information about how to do that on Rasbian or other Debian-based
distributions. It's not trivial.

4) is the most complicated but fastest solution (once it is set up).
You'll need a complete cross compilation toolchain (including build
tools like glib-mkenums) for your host system, and all libraries and
headers for the Raspberry Pi. I wasn't able to successfully compile
GStreamer with all plugins but if someone was able to do that and want
to share the instructions that would be great :)

III) Building GStreamer
1) First install all the build dependencies of GStreamer and the
plugins. If you're using a cross compilation environment you're on your
own with that. Otherwise use the tools provided by your distribution.

On Debian-based distributions like Raspbian you can install everything
necessary with, for other distributions adjust this accordingly:

# The completely essential things
> apt-get install build-essential autotools-dev automake autoconf libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev pkg-config bison flex python git

# The optional dependencies of all the plugins
>  apt-get install libasound2-dev libgudev-1.0-dev libxt-dev libvorbis-dev libcdparanoia-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev iso-codes libgtk-3-dev libraw1394-dev libiec61883-dev libavc1394-dev libv4l-dev libcairo2-dev libcaca-dev libspeex-dev libpng-dev libshout3-dev libjpeg-dev libaa1-dev libflac-dev libdv4-dev libtag1-dev libwavpack-dev libpulse-dev libsoup2.4-dev libbz2-dev libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev libcurl4-gnutls-dev libdca-dev libdirac-dev libdvdnav-dev libexempi-dev libexif-dev libfaad-dev libgme-dev libgsm1-dev libiptcdata0-dev libkate-dev libmimic-dev libmms-dev libmodplug-dev libmpcdec-dev libofa0-dev libopus-dev librsvg2-dev librtmp-dev libschroedinger-dev libslv2-dev libsndfile1-dev libsoundtouch-dev libspandsp-dev libx11-dev libxvidcore-dev libzbar-dev libzvbi-dev liba52-0.7.4-dev libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev libsidplay1-dev libtwolame-dev libx264-dev

2) We're going to install GStreamer into /usr/local but if you want to
use an uninstalled version of GStreamer follow these instructions for
setting up the environment:

3) Clone the GStreamer GIT repositories inside some directory where you
want to compile everything.

> git clone git://
> git clone git://
> git clone git://
> git clone git://
> git clone git://
> git clone git://
> git clone git://
> git clone git://

4) Build GStreamer, orc, gst-plugins-base, gst-plugins-good,
gst-plugins-ugly and gst-libav (in that order) by running these commands
inside their directories:

> ./
> make -j3
> make install  # skip this if you used gst-uninstalled

If you use a qemu chroot on your host system you will have to pass
--disable-nls to as gettext does not work in qemu for some
reason. It can also sometimes happen that configure checks for msgfmt or
msgmerge and does not continue, in that case kill the msgfmt/msgmerge

5) Build gst-plugins-bad with RPi EGL/GLESv2 support. First of all check
where your distribution puts the EGL ( and egl/egl.h), GLESv2
( and GLES2/gl2.h) and bcm_host ( and
bcm_host.h) headers and libraries.
On Raspbian this is in /opt/vc/lib and /opt/vc/include.

Now run the following commands, replacing the directories as used on
your distribution:

> LDFLAGS='-L/opt/vc/lib' CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux' ./
> make
> make install  # skip this if you used gst-uninstalled

6) Build gst-omx, replace the directories again in the commands below

> LDFLAGS='-L/opt/vc/lib' CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux' ./ ---with-omx-target=rpi
> make
> make install  # skip this if you used gst-uninstalled

gst-omx uses a configuration file to decide which codecs are available on
a device. "make install" will install this from config/rpi/gstomx.conf to
/etc/xdg/gstomx.conf . If you use gst-uninstalled you'll have to copy it
there or to any other place that XDG_CONFIG_DIRS or XDG_CONFIG_HOME points

IV) Using GStreamer
GStreamer can be used like on any other platform. For audio output/input
PulseAudio or ALSA can be used (pulsesink, pulsesrc, alsasink, alsasrc).
For video output it is recommended to use eglglessink currently. For
embedding that into your application you can provide it with an
EGLNativeWindowType via the GstVideoOverlay interface.

Some example pipelines:

> gst-launch-1.0 filesrc location=/path/to/some/mp4/file/with/h264 ! qtdemux ! queue max-size-bytes=10000000 ! h264parse ! omxh264dec ! queue max-size-buffers=4 ! eglglessink
> gst-launch-1.0 videotestsrc num-buffers=1000 ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! queue max-size-bytes=10000000 ! matroskamux ! filesink location=test.mkv

If anything does not work or you have additional question please just
reply to this mail and let's try to make GStreamer on RPi work better
and improve this guide.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list