GStreamer Overview

GStreamer is a development framework for creating applications like media players, streaming media broadcasters and video editors.

GStreamer is designed to make it easier to write applications easily that handle audio, video, or both. Pluggable components can be mixed and matched into arbitrary pipelines, which consist of a chain of processing elements.

Purpose

GStreamer is an open source multimedia framework that allows you to write any streaming multimedia application, not just audio or video. GStreamer can handle any data flow.

GStreamer core provides the following features:
  • Plug-in handling

  • Media type negotiation

  • Clocking and data flow

GStreamer also provides APIs to write applications using various plug-ins such as source plug-in, transform plug-in and sink plug-in. The framework uses these plug-ins to perform various roles such as encoding, decoding and media processing.

Figure 1. GStreamer plug-ins

Description

Some GStreamer concepts are as follows:
  • Element

    An element is an object that performs some action on a multimedia stream. Examples of such actions are reading a file, decoding or encoding data and capturing data from a hardware device.

  • Bin

    A bin is a subclass of element. A bin acts as a container for other elements, so multiple elements combine into one logical unit.

  • Pipeline

    A pipeline is a set of data processing elements connected in series, so the output from one element is the input for the next element.

    In GStreamer the pipeline is a specialized bin subclass that provides execution of all contained elements. Normally, applications create one pipeline that will manage all the elements contained within it.

Note: Elements can be added to and removed from pipelines based on the use-case being handled. For example a use-case such as playing an MP3 file using GStreamer.

An element can provide a number of pads, which can be either source or sink pads. A pad is a plug or port on an element to link with other elements. The pads are responsible for data flow between the elements. Source pads supply data, and sink pads consume data. Basically, pads are used to negotiate compatibility and allow data flow between elements.

An element can be in one of four different states during the application request:
  • Null

  • Ready

  • Pause

  • Play

In the Null and Ready states, the element is not processing any data. The processing of data happens only in the Play state. The Pause state is used to fill all connected elements in the data pipeline so the Play state change happens quickly.

GStreamer also provides higher level utilities and components to detect automatically the media type of an application, and to create the best possible pipeline for a use-case. This process is called auto plugging.

GStreamer applications

GStreamer is used in many types of applications including:

  1. Media playback and streaming

  2. Media recording

  3. Media transcoding

  4. Video editing

For example the diagram below shows how a Media Player uses GStreamer:

Figure 2. Media playback using GStreamer

See also