Friday, February 26, 2016

Compile & Install Gstreamer on Raspberry Pi


Prerequisite


sudo apt-get install libglib2.0-dev bison flex libtool 
autoconf automake autopoint gtk-doc-tools libx264-dev liborc-0.4-dev 
nasm yasm cmake libmicrohttpd-dev libjansson-dev libnice-dev librtmp-dev
Download these
* gstreamer/gstreamer
* gstreamer/gst-plugins-base
* gstreamer/gst-plugins-good
* gstreamer/gst-plugins-bad
* gstreamer/gst-plugins-ugly
from GStreamer source, at the time writing this post, the latest version I use is 1.4.1
For gst-plugins-basegst-plugins-good and gst-plugins-ugly, simply
./autogen.sh
make -j
sudo make install
For gst-plugins-bad, there’s a little problem during normal installation. In old times, gst-plugins-gl was required for gst-plugins-bad and now it is merged into gst-plugins-bad, at least they claim so, but somehow there’s some bug in there at this moment, which causegst-plugins-bad could not find gst-plugins-gl and gst-plugins-gl cannot be installed due to the fact that the author thinks there’s no need to install it since it has been merged intogst-plugins-bad.
So we need some hack for this. Fortunately, this thread has already worked it out. Follow those steps and you should get rid off the trouble.

Edit environment variable

in ~/.bashrc add a line
export LD_LIBRARY_PATH=/usr/local/lib
and reload bash file:
exec bash

Test command:

If you’ve installed rpicamsrc:
gst-launch-1.0 rpicamsrc bitrate=2000000 rotation=90 ! video/x-h264,width=1080,height=760,framerate=25/1 ! h264parse ! udpsink host=localhost port=5000
else:
raspivid  -t 0 -h 720 -w 1080 -fps 25 -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=0.0.0.0 port=5000

No comments:

Post a Comment