2012-01-05

Installing GStreamer under Linux

This article will describe how to install and run a simple c GStreamer application under linux.

*) Install the gstreamer development files and the alsa and vorbis support
$ sudo apt-get install libvorbis-dev flex libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

You might need to install additional packages. Your ./configure output will inform you about missing packages (ie: configure: error: Could not find).

*) Download the latest GStreamer source from
http://gstreamer.freedesktop.org/src/gstreamer/
http://gstreamer.freedesktop.org/src/gst-plugins-base/
http://gstreamer.freedesktop.org/src/gst-plugins-good/
Example:
$ wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.11.1.tar.gz
$ wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.11.1.tar.gz

$ wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.30.tar.gz


*) Make sure you have paths configured correctly in your ~/.bashrc file:
export LD_LIBRARY_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export GST_PLUGIN_PATH=/usr/local/lib
export PATH=$PATH:/usr/local/lib:/usr/local

*) Extract, compile and install the files (do this for every package accordingly)
$ tar xvf gstreamer-0.11.1.tar.gz
$ cd gstreamer-0.11.1
$ ./configure
$ make
$ sudo make install
$ cd ..
$ tar xvf gst-plugins-base-0.11.1.tar.gz
$ cd gst-plugins-base-0.11.1
$ ./configure
$ sudo make
$ sudo make install
$ cd ..
$ tar xvf gst-plugins-good-0.10.30.tar.gz
$ cd gst-plugins-good-0.10.30
$ ./configure
$ sudo make
$ sudo make install

To compile:
$ gcc `pkg-config --cflags --libs gstreamer-0.10 gstreamer-plugins-base-0.10` [filename.c] -o [output file]
In order to compile under Ubuntu 11.x (due to changes to the ordering of pkg-config statements) use:
$ gcc `pkg-config gstreamer-0.10 --cflags` [filename.c] -o [output file] `pkg-config gstreamer-0.10 --libs`

2 comments:

  1. Hi, thanks for the good tutorial. But i was thinking if i wanted to compile a program that would be using both GStreamer and OpenCV, how would that change the gcc line?.

    ReplyDelete
    Replies
    1. I will add a tutorial on this. I think the key is to use the appsink element.

      Delete