GStreamer In-Band Metadata for MPEG Transport Stream - Examples - Demo
GStreamer In-Band Metadata for MPEG Transport Stream |
---|
![]() |
MPEG TS Metadata Basics |
Getting Started |
User Guide |
Examples |
FAQ |
Contact Us |
![]() | Evaluation binary should be installed first to run any of the example programs in this guide. |
This page describes the example demo that in located in <GST_METADATA_DIR>/src/examples. This demo will create a 10 seconds TS video, including some metadata.
To generate the test video run the following commands:
cd <GST_METADATA_DIR>/src/examples ./gst-meta-demo
The expected output is the following:
$ ./gst-meta-demo Recording... Stopping...
This will create a video named meta.ts. To play this video and print the included metadata, run the following pipeline:
gst-launch-1.0 -e filesrc location=meta.ts ! tsdemux name=demux demux. ! queue ! h264parse ! 'video/x-h264, stream-format=byte-stream, alignment=au' ! avdec_h264 ! videoconvert ! queue ! autovideosink demux. ! queue max-size-buffers=200 max-size-time=0 max-size-bytes=0 ! 'meta/x-klv' ! metasink
Expected output

This demo uses the following pipeline:
metasrc name=src ! meta/x-klv ! mpegtsmux name=mux ! filesink location=%s videotestsrc is-live=true name=vts ! video/x-raw,width=1024,height=768,framerate=60/1 ! textoverlay name=overlay shaded-background=true ! x264enc ! mux. audiotestsrc is-live=true ! lamemp3enc ! audio/mpeg,mpegversion=1,parsed=true ! mux.
This pipeline runs in the GStreamer application; for each incoming buffer, its timestamp and buffer number are extracted to create metadata that will be inserted in the Transport Stream file. This demo example supports 3 forms to inject metadata: push-metadata signal, binary-metadata property, and metadata property.
The difference in each push method depends on the data type to be inserted as metadata; the metadata property handles strings and char arrays, the binary-metadata receives an array of bytes, and the signal receives a pointer and size to the data struct to push.