Gstreamer Creating C Code Applications

From RidgeRun Developer Connection
Jump to: navigation, search

Gstreamer C Code Application

The gst-launch test utility is handy for verifying a GStreamer pipeline is setup correctly. However gst-launch is not a good choice to use in a shipping embedded Linux product. Instead, a GStreamer application is needed. One choice is to use GStreamer Deamon, which you can control using D-Bus. Another option is to role your own application.

This wiki documents how to create a GStreamer C code application using the Ridgerun's SDK. The applications is located in $(DEVDIR)/myapps, uses the Ridgerun classes for GStreamer, autotools, and general sdk installation into target. Like all GStreamer C code application, the application uses glib. The example applicatin was tested using the Turrialba SDK running on a Leopardboard368 using a MT9P031 Aptina sensor.

The example applicatin can be better understood by referring to the GStreamer documentation.

The source code to the GStreamer C code application can be retrieved using:

git clone video-capture-application

Gstreamer applications can have parsers, callbacks according to signals, read values from command lines and many other capabilities. In this case this is just a simple application that runs the following pipeline:

videotestsrc num-buffers=300 ! 'video/x-raw-yuv,format=(fourcc)NV12,width=640, height=480' ! dmaiaccel ! dmaienc_h264 ! queue ! qtmux ! filesink location=$FILENAME

where the FILENAME is the first command line parameter.

Application source code directory structure

├── Config
├── Makefile
└── src
         ├── README
         └── src

                  ├── video_capture_application.c
                  └── video_capture.h

Compiling Application

ARM Compilation

The RidgeRun SDK makes it easy to cross compile for the ARM:

cd $DEVDIR/myapps
git clone video-capture-application
cd video-capture-application

When the application is installed it can be run at the target with the following command:


After 300 frames have been processed, the file will contain the video.

x86 Compilation

You doin't need the RidgeRun SDK to build for the host. You do need GStreamer development libraries installed.

cd $HOME/work
git clone video-capture-application
cd video-capture-application/src

After compiling the application can be executed as any regular binary:


After 300 frames have been processed, the file will contain the video.