GstSEIMetadata - User Guide
Adding metadata support to your application involves two main tasks: on the sending side injecting metadata on the pipeline and for the receiving side extracting the metadata. In this section, we will review how to achieve this.
To inject metadata it's possible to use the RidgeRun's Gstreamer element seiinject. In the pipeline you can simply set the seiinject metadata property with the data you want to inject or use the seimetatester element that adds GstMeta messages to the buffer. Then use seiinject, which will take those meta messages and insert their data in the h264 / h265 buffer.
To extract metadata it's possible to use the RidgeRun's Gstreamer element seiextract. Once you have the pipeline with a seiextract element, it is going to take the metadata in the h264/h265 buffer and add it as a GstMeta to the output buffer. The seiextract element, also includes a signal property for the metadata message.
SeiInject element
The expected output of running
gst-inspect-1.0 seiinject
is the following:
Factory Details:
Rank none (0)
Long-name SEI Inject Meta-data
Klass Generic
Description Adds meta-data as SEI NAL units
Author Mauricio Montero <mauricio.montero@ridgerun.com>
Plugin Details:
Name sei
Description Gstreamer plugin to add meta-data as SEI NAL units
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libsei.so
Version 0.5.4
License Proprietary
Source module gst-sei
Binary package gst-sei
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstSeiInject
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-h264
stream-format: { (string)byte-stream, (string)avc }
video/x-h265
stream-format: { (string)byte-stream, (string)hvc1 }
SRC template: 'src'
Availability: Always
Capabilities:
video/x-h264
stream-format: { (string)byte-stream, (string)avc }
video/x-h265
stream-format: { (string)byte-stream, (string)hvc1 }
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Pad Template: 'sink'
SRC: 'src'
Pad Template: 'src'
Element Properties:
metadata : A metadata string to be pushed.
flags: readable, writable
String. Default: null
metadata-binary : A binary blob to push as metadata.
flags: readable, writable
Boxed pointer of type "GByteArray"
name : The name of the object
flags: readable, writable, 0x2000
String. Default: "seiinject0"
parent : The parent of the object
flags: readable, writable, 0x2000
Object of type "GstObject"
qos : Handle Quality-of-Service events
flags: readable, writable
Boolean. Default: false
Important properties
- metadata: It is possible to use this property to insert a message. For example the following pipeline uses the seiinject element to insert the message "Hello World" as metadata, note that it only adds it to the first buffer.
H264
gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v
H265
gst-launch-1.0 videotestsrc ! x265enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h265 -v
- metadata-binary: property used to insert metadata as binary see C Example
SeiMetatimestamp element
The expected output of running
gst-inspect-1.0 seimetatimestamp
is the following:
Factory Details:
Rank none (0)
Long-name Helper element to insert a test GstSeiMeta to buffers.
Klass Generic
Description Helper element to insert a test GstSeiMeta to buffers.
Author Mauricio Montero <mauricio.montero@ridgerun.com>
Plugin Details:
Name sei
Description Gstreamer plugin to add meta-data as SEI NAL units
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libsei.so
Version 0.5.4
License Proprietary
Source module gst-sei
Binary package gst-sei
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstSeiMetaTimestamp
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
ANY
SRC template: 'src'
Availability: Always
Capabilities:
ANY
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Pad Template: 'sink'
SRC: 'src'
Pad Template: 'src'
Element Properties:
name : The name of the object
flags: readable, writable, 0x2000
String. Default: "seimetatimestamp0"
parent : The parent of the object
flags: readable, writable, 0x2000
Object of type "GstObject"
qos : Handle Quality-of-Service events
flags: readable, writable
Boolean. Default: false
timestamp-source : Source clock for timestamp calculation
flags: readable, writable
Enum "GstSeiMetaTimestampSources" Default: 0, "pipeline"
(0): pipeline - Pipeline clock (use only when pipelines ares using the same clock)
(2): sysclk - System clock
(1): buffer - Buffer timestamp
(3): reference - Reference timestamp
As shown in the description, this element adds a GstMeta to each buffer. An example of how to use this would be the following pipeline with the seiinject and seimetatimestamp elements.
gst-launch-1.0 videotestsrc ! x264enc ! seimetatimestamp ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v
Note: This element currently only supports H264 encoded buffers.
SeiExtract element
The expected output of running
gst-inspect-1.0 seiextract
is the following:
Factory Details:
Rank none (0)
Long-name SEI Extract Metadata
Klass Generic
Description Extracts metadata from SEI NAL units
Author Fernando Herrera <fernando.herrera@ridgerun.com>
Plugin Details:
Name sei
Description Gstreamer plugin to add meta-data as SEI NAL units
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libsei.so
Version 0.5.4
License Proprietary
Source module gst-sei
Binary package gst-sei
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstSeiExtract
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-h264
stream-format: { (string)byte-stream, (string)avc }
video/x-h265
stream-format: { (string)byte-stream, (string)hvc1 }
SRC template: 'src'
Availability: Always
Capabilities:
video/x-h264
stream-format: { (string)byte-stream, (string)avc }
video/x-h265
stream-format: { (string)byte-stream, (string)hvc1 }
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Pad Template: 'sink'
SRC: 'src'
Pad Template: 'src'
Element Properties:
name : The name of the object
flags: readable, writable, 0x2000
String. Default: "seiextract0"
parent : The parent of the object
flags: readable, writable, 0x2000
Object of type "GstObject"
qos : Handle Quality-of-Service events
flags: readable, writable
Boolean. Default: false
signal-new-metadata : Send a signal on new metadata
flags: readable, writable
Boolean. Default: false
Element Signals:
"new-metadata" : void user_function (GstElement* object,
guint arg0,
gpointer arg1,
gpointer user_data);
Important Properties
- signal-new-metadata: It is a boolean that if set to TRUE sends a signal when metadata is received.
The following pipeline use the seiextract element to add a GstMeta with the message "Hello World" to the output buffer.
H264
gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! seiextract ! filesink location=seiinject_videotestsrc.h264 -v
H265
gst-launch-1.0 videotestsrc ! x265enc ! seiinject metadata="Hello World" ! seiextract ! filesink location=seiinject_videotestsrc.h265 -v
SeiLatencytester element
The expected output of running
gst-inspect-1.0 seilatencytester
is the following:
Factory Details:
Rank none (0)
Long-name Helper element to measure latency using the GstSeiMeta from buffers.
Klass Generic
Description Helper element to measure latency using the GstSeiMeta from buffers.
Author Jimena Salas <jimena.salas@ridgerun.com>
Plugin Details:
Name sei
Description Gstreamer plugin to add meta-data as SEI NAL units
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libsei.so
Version 0.5.4
License Proprietary
Source module gst-sei
Binary package gst-sei
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstSeiLatencyTester
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
ANY
SRC template: 'src'
Availability: Always
Capabilities:
ANY
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Pad Template: 'sink'
SRC: 'src'
Pad Template: 'src'
Element Properties:
name : The name of the object
flags: readable, writable, 0x2000
String. Default: "seilatencytester0"
parent : The parent of the object
flags: readable, writable, 0x2000
Object of type "GstObject"
qos : Handle Quality-of-Service events
flags: readable, writable
Boolean. Default: false
timestamp-source : Source clock for timestamp difference calculation (must match the one used for the seimetatimestamp)
flags: readable, writable
Enum "GstSeiMetaTimestampSources" Default: 0, "pipeline"
(0): pipeline - Pipeline clock (use only when pipelines ares using the same clock)
(2): sysclk - System clock
(1): buffer - Buffer timestamp
(3): reference - Reference timestamp
As shown in the description, this element measures the latency of each buffer by using the element of metadata. An example of how to use this would be the following pipeline with the seiextract and seilatencytester elements.
H264
gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! seiextract ! seilatencytester ! filesink location=seiinject_videotestsrc.h264 -v
H265
gst-launch-1.0 videotestsrc ! x265enc ! seiinject metadata="Hello World" ! seiextract ! seilatencytester ! filesink location=seiinject_videotestsrc.h265 -v