Thank you. This is priceless.<br><br><div class="gmail_quote">On Wed, Mar 20, 2013 at 7:29 AM, Sebastian Dröge <span dir="ltr"><<a href="mailto:sebastian.droege@collabora.co.uk" target="_blank">sebastian.droege@collabora.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everybody,<br>
<br>
as this was a common subject on IRC and on this mailing list in the past<br>
I decided to write some kind of guide about how to get GStreamer working<br>
as good as possible on the Raspberry Pi. This will also be added to the<br>
GStreamer Wiki once it works again.<br>
<br>
<br>
I) Preparations<br>
---------------<br>
1) First of all get a useable Linux distribution for Raspberry Pi,<br>
especially Raspbian would be a good choice but all this (with some minor<br>
changes) should also work on other distributions.<br>
See <a href="http://www.raspberrypi.org/downloads" target="_blank">http://www.raspberrypi.org/downloads</a><br>
<br>
2) Update the firmware to the latest available version, you can use<br>
rpi-update for that: <a href="https://github.com/Hexxeh/rpi-update" target="_blank">https://github.com/Hexxeh/rpi-update</a><br>
<br>
3) Make sure you reserved at least 128M of memory for VideoCore, e.g.<br>
add this to /boot/config.txt:<br>
gpu_mem=128<br>
<br>
4) If you need VC1 or MPEG2 decoding you'll have to order license keys<br>
for these codecs from <a href="http://www.raspberrypi.com/license-keys/" target="_blank">http://www.raspberrypi.com/license-keys/</a><br>
<br>
5) If you want VP8 and Theora decoding you'll have to boot experimental<br>
firmware. Add this to /boot/config.txt:<br>
start_file=start_x.elf<br>
fixup_file=fixup_x.elf<br>
<br>
6) Reboot to apply the above changes<br>
<br>
II) Setting up a build environment<br>
----------------------------------<br>
You have multiple options here, you can either 1) directly build on the<br>
Raspberry Pi (which will be quite slow), 2) compile on your development<br>
machine in a chroot using qemu, 3) having a hybrid chroot (including arm<br>
and x86 binaries) or 4) doing complete cross compilation.<br>
<br>
1) is rather obvious, nothing to explain here<br>
<br>
2) is a bit more complicated to set up, see these instructions here for<br>
doing it with Raspbian:<br>
<a href="http://superpiadventures.com/2012/07/development-environment/" target="_blank">http://superpiadventures.com/2012/07/development-environment/</a><br>
<br>
3) works the same way as 2) but you would install packages for your host<br>
architecture (x86 or amd64 probably) inside the qemu chroot, replacing<br>
some build tools. Especially the shell, perl, m4, make and the compiler<br>
will make a big difference. See <a href="http://wiki.debian.org/Multiarch" target="_blank">http://wiki.debian.org/Multiarch</a> for<br>
information about how to do that on Rasbian or other Debian-based<br>
distributions. It's not trivial.<br>
<br>
4) is the most complicated but fastest solution (once it is set up).<br>
You'll need a complete cross compilation toolchain (including build<br>
tools like glib-mkenums) for your host system, and all libraries and<br>
headers for the Raspberry Pi. I wasn't able to successfully compile<br>
GStreamer with all plugins but if someone was able to do that and want<br>
to share the instructions that would be great :)<br>
<br>
III) Building GStreamer<br>
----------------------<br>
1) First install all the build dependencies of GStreamer and the<br>
plugins. If you're using a cross compilation environment you're on your<br>
own with that. Otherwise use the tools provided by your distribution.<br>
<br>
On Debian-based distributions like Raspbian you can install everything<br>
necessary with, for other distributions adjust this accordingly:<br>
<br>
# The completely essential things<br>
> apt-get install build-essential autotools-dev automake autoconf libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev pkg-config bison flex python git<br>
<br>
# The optional dependencies of all the plugins<br>
> 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<br>
<br>
2) We're going to install GStreamer into /usr/local but if you want to<br>
use an uninstalled version of GStreamer follow these instructions for<br>
setting up the environment:<br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html#developing-uninstalled-gstreamer" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html#developing-uninstalled-gstreamer</a><br>
<br>
3) Clone the GStreamer GIT repositories inside some directory where you<br>
want to compile everything.<br>
<br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gstreamer" target="_blank">anongit.freedesktop.org/git/gstreamer/gstreamer</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/orc" target="_blank">anongit.freedesktop.org/git/gstreamer/orc</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-plugins-base" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-plugins-base</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-plugins-good" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-plugins-good</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-plugins-bad</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-libav" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-libav</a><br>
> git clone git://<a href="http://anongit.freedesktop.org/git/gstreamer/gst-omx" target="_blank">anongit.freedesktop.org/git/gstreamer/gst-omx</a><br>
<br>
4) Build GStreamer, orc, gst-plugins-base, gst-plugins-good,<br>
gst-plugins-ugly and gst-libav (in that order) by running these commands<br>
inside their directories:<br>
<br>
> ./autogen.sh<br>
> make -j3<br>
> make install # skip this if you used gst-uninstalled<br>
<br>
If you use a qemu chroot on your host system you will have to pass<br>
--disable-nls to autogen.sh as gettext does not work in qemu for some<br>
reason. It can also sometimes happen that configure checks for msgfmt or<br>
msgmerge and does not continue, in that case kill the msgfmt/msgmerge<br>
process.<br>
<br>
5) Build gst-plugins-bad with RPi EGL/GLESv2 support. First of all check<br>
where your distribution puts the EGL (libEGL.so and egl/egl.h), GLESv2<br>
(libGLESv2.so and GLES2/gl2.h) and bcm_host (libbcm_host.so and<br>
bcm_host.h) headers and libraries.<br>
On Raspbian this is in /opt/vc/lib and /opt/vc/include.<br>
<br>
Now run the following commands, replacing the directories as used on<br>
your distribution:<br>
<br>
> 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' ./autogen.sh<br>
> make<br>
> make install # skip this if you used gst-uninstalled<br>
<br>
6) Build gst-omx, replace the directories again in the commands below<br>
<br>
> 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' ./autogen.sh ---with-omx-target=rpi<br>
> make<br>
> make install # skip this if you used gst-uninstalled<br>
<br>
gst-omx uses a configuration file to decide which codecs are available on<br>
a device. "make install" will install this from config/rpi/gstomx.conf to<br>
/etc/xdg/gstomx.conf . If you use gst-uninstalled you'll have to copy it<br>
there or to any other place that XDG_CONFIG_DIRS or XDG_CONFIG_HOME points<br>
to.<br>
<br>
<a href="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables" target="_blank">http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables</a><br>
<br>
<br>
IV) Using GStreamer<br>
-------------------<br>
GStreamer can be used like on any other platform. For audio output/input<br>
PulseAudio or ALSA can be used (pulsesink, pulsesrc, alsasink, alsasrc).<br>
For video output it is recommended to use eglglessink currently. For<br>
embedding that into your application you can provide it with an<br>
EGLNativeWindowType via the GstVideoOverlay interface.<br>
<br>
Some example pipelines:<br>
<br>
> 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<br>
><br>
> 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<br>
<br>
<br>
If anything does not work or you have additional question please just<br>
reply to this mail and let's try to make GStreamer on RPi work better<br>
and improve this guide.<br>
<br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>