Wednesday, August 12, 2015

A closer look at GStreamer pipelines

One common issue people have with GStreamer is to understand what is the actual dynamic pipeline built via gst-launch command-line tool. There's a neat mechanism to extract the information from the pipeline, including the full media graph and all plugins/pads parameters. Here's how.

GStreamer can dump media graphs in Graphviz .dot format, in a location pointed by GST_DEBUG_DUMP_DOT_DIR env-var:

$ export GST_DEBUG_DUMP_DOT_DIR=/tmp

Now run gst-launch in the console, it will automatically create .dot files in /tmp, one per state transition:

$ gst-launch playbin2 uri=file:///test.mp4

Now we we can convert the .dot files to to PNG images:

$ cd /tmp
$ for i in *.dot; do dot -Tpng -O $i; done

There's a ton of useful info in the media graphs, make sure to check them out!

All credits go to GStreamer team's online docs: