GStreamer on Raspberry Pi
Rob
robert.swain at gmail.com
Sat Jun 8 07:35:03 PDT 2013
Hello,
I have put together a set of files to use with jhbuild on the rpi. I find
jhbuild much easier to use in general (it does more for you without you
having to do anything) than gst-uninstalled, but each to their own. :)
On your rpi with raspbian and being logged in as your regular user, the
following steps can be used in place of 4, 5, 6 from Sebastian's
instructions:
# Set up some required directories
mkdir -p ~/src/gstreamer/jhbuild
mkdir -p ~/src/gstreamer/install/include
mkdir ~/bin
# Install jhbuild
sudo apt-get install jhbuild
# Get some necessary files (also attached in case they disappear from the
web space)
wget -O ~/src/gstreamer/jhbuild/gstreamer.modules
http://people.collabora.com/~robswain/rpi/gstreamer.modules
wget -O ~/src/gstreamer/jhbuild/gstreamer.jhbuildrc
http://people.collabora.com/~robswain/rpi/gstreamer.jhbuildrc
wget -O ~/bin/gst-jhbuild
http://people.collabora.com/~robswain/rpi/gst-jhbuild
# Set up the environment
# (Put the following lines in your ~/.bashrc
if [ -n "$UNDER_JHBUILD" ]; then
PS1="[jhb] $PS1"
fi
export PATH=${HOME}/bin:${PATH}
# ... to here
# Load the updated envrionment configuration
source ~/.bashrc
Now you should be 'good to go.' In the gstreamer.jhbuildrc file, I have
added the CPPFLAGS and LDFLAGS for the gst-plugins-bad and gst-omx modules
so you can fire off a build using the following command and come back the
next day and with a bit of luck, it should all be compiled:
gst-jhbuild build -acf
If you later want to drop into a shell for doing anything with this build
of GStreamer, you can just run:
gst-jhbuild shell
That command sets up all the necessary environment to use GStreamer without
installing it. If you run "gst-inspect-1.0" it will list all the plugins
from your jhbuild environment. Of course you can also run the commands from
section IV of Sebastian's instructions.
I hope that helps someone. :)
Best regards,
Rob
On 20 March 2013 12:29, Sebastian Dröge <sebastian.droege at collabora.co.uk>wrote:
> 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.
> See http://www.raspberrypi.org/downloads
>
> 2) Update the firmware to the latest available version, you can use
> rpi-update for that: https://github.com/Hexxeh/rpi-update
>
> 3) Make sure you reserved at least 128M of memory for VideoCore, e.g.
> add this to /boot/config.txt:
> gpu_mem=128
>
> 4) If you need VC1 or MPEG2 decoding you'll have to order license keys
> for these codecs from http://www.raspberrypi.com/license-keys/
>
> 5) If you want VP8 and Theora decoding you'll have to boot experimental
> firmware. Add this to /boot/config.txt:
> start_file=start_x.elf
> fixup_file=fixup_x.elf
>
> 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:
> http://superpiadventures.com/2012/07/development-environment/
>
> 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 http://wiki.debian.org/Multiarch 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:
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html#developing-uninstalled-gstreamer
>
> 3) Clone the GStreamer GIT repositories inside some directory where you
> want to compile everything.
>
> > git clone git://anongit.freedesktop.org/git/gstreamer/gstreamer
> > git clone git://anongit.freedesktop.org/git/gstreamer/orc
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-base
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-good
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-libav
> > git clone git://anongit.freedesktop.org/git/gstreamer/gst-omx
>
> 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:
>
> > ./autogen.sh
> > 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 autogen.sh 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
> process.
>
> 5) Build gst-plugins-bad with RPi EGL/GLESv2 support. First of all check
> where your distribution puts the EGL (libEGL.so and egl/egl.h), GLESv2
> (libGLESv2.so and GLES2/gl2.h) and bcm_host (libbcm_host.so 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' ./autogen.sh
> > 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' ./autogen.sh
> ---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
> to.
>
>
> http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
>
>
> 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.
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130608/0eadd0ad/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gst-jhbuild
Type: application/octet-stream
Size: 102 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130608/0eadd0ad/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstreamer.jhbuildrc
Type: application/octet-stream
Size: 1143 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130608/0eadd0ad/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstreamer.modules
Type: application/octet-stream
Size: 3943 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130608/0eadd0ad/attachment-0005.obj>
More information about the gstreamer-devel
mailing list