Skip to content
systemcoding.dev
Media

Find Elements and Their Properties With gst-inspect-1.0

Use gst-inspect-1.0 to list GStreamer plugins, read an element's pads, caps and properties, and find which package provides a missing decoder.

7 min read
Summarize in AI
Flat illustration of video frames passing through a codec, with the FFmpeg, GStreamer and VLC media player logos.

Every GStreamer problem starts with the same three questions. Does this element exist on my machine? What pads and formats does it have? What properties can I set on it? gst-inspect-1.0 answers all three, and it is the tool you will run more than any other after gst-launch-1.0. This post walks through its output for a real element, shows how to search the registry, and explains how to read the plugin and feature lists that confuse beginners. It uses GStreamer 1.26 and the plugin names of the 1.x series.

Three levels of output

gst-inspect-1.0 takes no argument, a plugin or element name, or a file. The behaviour changes with what you give it:

CommandShows
gst-inspect-1.0every plugin, with its elements, one line each
gst-inspect-1.0 videoconvertfull detail of one element
gst-inspect-1.0 coreelementsdetail of one plugin and the elements it contains

If the name matches an element and a plugin, the element wins. The list form is long, so filter it with a shell tool:

Shell
gst-inspect-1.0 | grep -i h264
Text
libav:  avdec_h264: libav H.264 decoder
libav:  avenc_h264_omx: libav OpenMAX IL H.264 video encoder
openh264:  openh264dec: OpenH264 video decoder
openh264:  openh264enc: OpenH264 video encoder
typefindfunctions: video/x-h264: h264, x264, 264
videoparsersbad:  h264parse: H.264 parser
x264:  x264enc: x264enc

The format is plugin: element: description. The exact list depends on which packages you installed, so your output will be shorter or longer. The prefix before the first colon is the plugin name, which is also the name you need when you look for a package. The first lesson here is that avdec_h264, openh264dec and others are alternative implementations of the same job: decoding H.264.

Read one element

Inspect an element you know:

Shell
gst-inspect-1.0 videotestsrc

The output has labelled sections. This is an abridged version of the first part:

Text
Factory Details:
  Rank                     none (0)
  Long-name                Video test source
  Klass                    Source/Video
  Description              Creates a test video stream
  Author                   David A. Schleef <[email protected]>

Plugin Details:
  Name                     videotestsrc
  Description              Creates a test video stream
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideotestsrc.so
  Version                  1.26.2
  License                  LGPL
  Source module            gst-plugins-base
  Binary package           GStreamer Base Plug-ins (Ubuntu)

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstVideoTestSrc

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { (string)I420, (string)YV12, (string)YUY2, ... }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Read these in order:

  • Factory Details tell you the Rank, which decides whether auto-plugging elements such as decodebin pick this element ahead of others, and the Klass, which classifies it as a source, decoder, encoder or sink.

  • Plugin Details tell you the file on disk, the Source module (gst-plugins-base, -good, -bad, -ugly or gst-libav) and the License. The source module is how you decide which package to install, and the licence matters for distribution.

  • Pad Templates give the pad names, availability and caps. A source element has only a src template, which is how you confirm a role.

Read the properties

Further down, the output lists every property with its type, range and default:

Text
Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "videotestsrc0"
  is-live             : Whether to act as a live source
                        flags: readable, writable
                        Boolean. Default: false
  num-buffers         : Number of buffers to output before sending EOS (-1 = unlimited)
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1
  pattern             : Type of test pattern to generate
                        flags: readable, writable
                        Enum "GstVideoTestSrcPattern" Default: 0, "smpte"
                           (0): smpte            - SMPTE 100% color bars
                           (1): snow             - Random (television snow)
                           (2): black            - 100% Black
                           (3): white            - 100% White
                           (18): ball            - Moving ball

For each property, check the flags first. readable, writable means you can set it. controllable means it can be changed during playback through a control binding. mutable_playing means a property can change while the element runs, and the lack of it means you must set it before PLAYING. Then read the type: the enum list gives the legal names and numbers, which you can use in gst-launch-1.0 as pattern=ball or pattern=18. The Range tells you why num-buffers=-5 is rejected.

When you want only one property for a script, grep it:

Shell
gst-inspect-1.0 x264enc | grep -A4 "  bitrate"
Text
  bitrate             : Bitrate in kbit/sec
                        flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
                        Unsigned Integer. Range: 1 - 2048000 Default: 2048

Signals and actions

Elements also expose signals (events the element emits, such as pad-added on a demuxer) and action signals (functions you call on the element). They appear under "Element Signals" and "Element Actions". A property that looks missing is often a signal. For example, appsink reports new frames through the new-sample signal, not through a property, and its documentation entry shows both.

Find a missing element

When a pipeline says no element "x264enc", gst-inspect-1.0 x264enc confirms it with:

Text
No such element or plugin 'x264enc'

That output means the plugin is not installed or failed to load. Check whether it failed to load with a debug level, which prints the dependency error:

Shell
GST_DEBUG=2 gst-inspect-1.0 x264enc

A line such as Failed to load plugin '/usr/lib/.../libgstx264.so': libx264.so.164: cannot open shared object file explains it: the plugin is present but a shared library is missing. Fix it by installing the package that provides the library. Without the debug line you would assume the plugin itself is absent.

To find which package provides an element, use the plugin set naming from the output of another machine, or your distribution's file search. On Debian-based systems:

Shell
apt-file search libgstx264.so
Text
gstreamer1.0-plugins-ugly: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx264.so

The result points to gstreamer1.0-plugins-ugly. The -ugly set holds encoders and decoders with licensing concerns.

Inspect a file's plugin

You can inspect a plugin file that is not in the registry yet, which is useful when you build your own:

Shell
gst-inspect-1.0 ./build/libgstmyfilter.so

If the file loads, you get the plugin and element details. If it does not load, the error message names the missing symbol or library. Using GST_PLUGIN_PATH pointing to the build directory also registers it for every tool.

Check what an element can accept

A frequent question is "can this encoder take my pixel format". The pad templates answer it. An excerpt from x264enc:

Text
Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { (string)Y444, (string)Y42B, (string)I420, (string)YV12, (string)NV12, (string)Y444_10LE, ... }

If your source gives YUY2 and the list does not include it, you need a videoconvert between them. This is the lookup that turns a not-negotiated error into a one-line fix.

Use inspect to design a pipeline before you write it

Reading an element's output is also a planning tool. Suppose you want to record audio from a microphone to an Ogg file. You know the sink should be filesink, and you look for the other parts one question at a time. Which source captures from the sound server? List with a filter:

Shell
gst-inspect-1.0 | grep -i -E "src.*audio|audio.*src"

Which encoder produces Vorbis, and what does its sink pad accept? Inspect it:

Shell
gst-inspect-1.0 vorbisenc | sed -n '/Pad Templates/,/Element Properties/p'
Text
Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      audio/x-raw
                 format: F32LE
                   rate: [ 1, 200000 ]
               channels: [ 1, 255 ]
  SRC template: 'src'
    Availability: Always
    Capabilities:
      audio/x-vorbis

The sink pad takes raw 32-bit float audio at nearly any rate, so an audioconvert before it covers the format, and the source pad produces audio/x-vorbis, which oggmux accepts. Reading two outputs gives you the whole pipeline: source, audioconvert, vorbisenc, oggmux, filesink. You never had to guess a name from memory, which is how most wrong pipelines begin.

Rank, and why decodebin chose that decoder

When decodebin has several decoders for the same media type, it tries the one with the highest rank first. You can see ranks in gst-inspect-1.0 output. If an unwanted decoder wins, for example a software decoder beating a hardware one, you can change the order at run time with the environment variable GST_PLUGIN_FEATURE_RANK, which takes element:rank pairs:

Shell
GST_PLUGIN_FEATURE_RANK=avdec_h264:0 gst-play-1.0 clip.mp4

That lowers the rank of avdec_h264 to zero, so decodebin picks another H.264 decoder if one exists. It is a quick way to test whether a hardware decoder plays the file, without editing code.

Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.