Gstreamer cheat sheet

From MyLabWiki
Revision as of 15:34, 19 June 2010 by Alex (Talk | contribs)

Jump to: navigation, search

This page contains various shortcuts to achieving specific functionality using Gstreamer. These functionalities are mostly related to my Digital Video Transmission experiments. There is no easy to read "user manual" for gstreamerbut the online the plugin documentation[1] often contains command line examples in addition to the API docs. Other sources of documentation:

  • The manual page for gst-launch
  • The gst-inspect tool
  • Online tutorials

The Gstreamer documentation is also available in Devhelp.

Video Test Source

Webcam Capture

Resizing and Cropping

videocrop

For quick cropping from 4:3 to 16:9, the aspectratiocrop[2] plugin can be used:

 gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=15/1 ! aspectratiocrop aspect-ratio=16/9 ! ffmpegcolorspace ! xvimagesink


videobox

videoscale


Filtering

gamma

videobalance

Network Streaming

Encoding and Muxing

Decoding and Demuxing

Compositing

Picture in Picture

TBD

videomixer[3]

four videos combined into one video matrix

Text Overlay

The texoverlay[4] plugin can be used to add text to the video stream:

 gst-launch videotestsrc ! video/x-raw-yuv,width=640,height=480,framerate=15/1 ! textoverlay text="Hello" ! ffmpegcolorspace ! ximagesink

It has many options for text positioning and alignment. User can also specify font properties as a Pango font description string, e.g. "Sans Italic 24".

TODO: A few font description examples.

Time Overlay

Elapsed time can be added using the timeoverlay[5] plugin:

 gst-launch videotestsrc ! timeoverlay ! xvimagesink

Timeoverlay inherits the properties of textoverlay so the text properties can be set using the same properties:

 gst-launch videotestsrc ! timeoverlay halign=right valign=bottom text="Stream time:" shaded-background=true ! xvimagesink

Alternatively, cairotimeoverlay[6] can be used but it doesn't seem to have any properties:

 gst-launch videotestsrc ! cairotimeoverlay ! xvimagesink

Instead of elapsed time, the system date and time can be added using the clockoverlay[7] plugin:

 gst-launch videotestsrc ! clockoverlay ! xvimagesink

Clockloverlay also inherits the properties of textoverlay. In addition to that clockoverlay also allows setting the time format:

 gst-launch videotestsrc ! clockoverlay halign=right valign=bottom shaded-background=true time-format="%Y.%m.%D" ! ffmpegcolorspace ! ximagesink

Complete Examples

TBD

References

  1. Gstreamer documentation http://gstreamer.freedesktop.org/documentation/
  2. GStreamer Good Plugins 0.10 Plugins Reference Manual – aspectratiocrop
  3. GStreamer Good Plugins 0.10 Plugins Reference Manual – videomixer
  4. GStreamer Base Plugins 0.10 Plugins Reference Manual – textoverlay
  5. GStreamer Base Plugins 0.10 Plugins Reference Manual – timeoverlay
  6. GStreamer Good Plugins 0.10 Plugins Reference Manual – cairotimeoverlay
  7. GStreamer Base Plugins 0.10 Plugins Reference Manual - clockoverlay