GstSEIMetadata/User Guide: Difference between revisions

From RidgeRun Developer Wiki
Line 227: Line 227:


</syntaxhighlight>
</syntaxhighlight>
 
==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.
The following pipeline use the seiextract element to add a GstMeta with the message "Hello World" to the output buffer.
<pre>
<pre>

Revision as of 22:54, 5 July 2021


Previous: Getting Started/Building GStreamer H264 - H265 Metadata Index Next: Examples





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 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 message and insert their data in the h264 buffer.

To extract metadata it's possible to use the RidgeRun Gstreamer element seiextract. Once you have the pipeline with a seiextract element it is going to take the metadata in the h264 buffer and add it as a GstMeta to the output buffer. Also includes a signal property for the metadata message.

SeiInject element

The expected output of running

gst-inspect-1.0 seiinject

is the following:

#gst-inspect-1.0 seiinject

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/x86_64-linux-gnu/gstreamer-1.0/libsei.so
  Version                  0.1.0
  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 }
  
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
          stream-format: { (string)byte-stream, (string)avc }

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
                        String. Default: "seiinject0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events
                        flags: readable, writable
                        Boolean. Default: false
  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"

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.
gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v
  • metadata-binary: property used to insert metadata as binary see C Example

SeiMetatester element

The expected output of running

gst-inspect-1.0 seimetatester

is the following:

#gst-inspect-1.0 seimetatester
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/x86_64-linux-gnu/gstreamer-1.0/libsei.so
  Version                  0.1.0
  License                  Proprietary
  Source module            gst-sei
  Binary package           gst-sei
  Origin URL               Unknown package origin

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----GstSeiMetaTester

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
      video/x-raw
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-h264
      video/x-raw

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
                        String. Default: "seimetatester0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events
                        flags: readable, writable
                        Boolean. Default: false

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 seimetatester elements.

gst-launch-1.0 videotestsrc ! x264enc ! seimetatester ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v

SeiExtract element

The expected output of running

gst-inspect-1.0 seiextract

is the following:

#gst-inspect-1.0 seiextract

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/x86_64-linux-gnu/gstreamer-1.0/libsei.so
  Version                  0.1.0
  License                  Proprietary
  Source module            gst-sei
  Binary package           gst-sei
  Origin URL               Unknown package origin

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----GstSeiExtract

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
          stream-format: { (string)byte-stream, (string)avc }
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-h264
          stream-format: { (string)byte-stream, (string)avc }

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
                        String. Default: "seiextract0"
  parent              : The parent of the object
                        flags: readable, writable
                        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.

gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! seiextract ! filesink location=seiinject_videotestsrc.h264 -v


Previous: Getting Started/Building GStreamer H264 - H265 Metadata Index Next: Examples