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`

3 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
  2. I have installed gstreamer for running audio files in different formats (.wav, .ogg, and .mp3). From my current installation, .wav and .ogg files are being played, but .mp3 is not. While running .mp3, I get an error as
    Error: "Your GStreamer installation is missing a plug-in."

    When I checked the directory of installed directory, I found following installations:

    1. gstreamer-1.0 in /usr/lib. This file contained one .so file.
    2. gstreamer-1.0 and gstreamer-0.10 in /usr/lib/x86_64-linux-gnu. These two files contained quite a few .so files.
    3. gstreamer1.0 and gstreamer0.10 in /usr/lib/x86_64-linux-gnu. These two files contained no .so files.

    How should I get rid of multiple gstreamer-files?
    And, how should I set the LIBRARY_PATH in .bashrc file? Any help would be highly appreciated.

    ReplyDelete