GstSEIMetadata/User Guide: Difference between revisions

From RidgeRun Developer Wiki
Line 97: Line 97:
* metadata-binary: property used to insert metadata as binary see [[GStreamer H264 - H265 Metadata/Examples/C Example|C Example]]
* metadata-binary: property used to insert metadata as binary see [[GStreamer H264 - H265 Metadata/Examples/C Example|C Example]]


==SeiMetatester element==
==SeiMetatimestamp element==
The expected output of running <pre>gst-inspect-1.0 seimetatester</pre> is the following:
The expected output of running <pre>gst-inspect-1.0 seimetatimestamp</pre> is the following:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
#gst-inspect-1.0 seimetatester
Factory Details:
Factory Details:
   Rank                    none (0)
   Rank                    none (0)
Line 112: Line 111:
   Name                    sei
   Name                    sei
   Description              Gstreamer plugin to add meta-data as SEI NAL units
   Description              Gstreamer plugin to add meta-data as SEI NAL units
   Filename                /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libsei.so
   Filename                /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libsei.so
   Version                  0.1.0
   Version                  0.5.4
   License                  Proprietary
   License                  Proprietary
   Source module            gst-sei
   Source module            gst-sei
Line 124: Line 123:
             +----GstElement
             +----GstElement
                   +----GstBaseTransform
                   +----GstBaseTransform
                         +----GstSeiMetaTester
                         +----GstSeiMetaTimestamp


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


Element has no clocking capabilities.
Element has no clocking capabilities.
Line 150: Line 147:
Element Properties:
Element Properties:
   name                : The name of the object
   name                : The name of the object
                         flags: readable, writable
                         flags: readable, writable, 0x2000
                         String. Default: "seimetatester0"
                         String. Default: "seimetatimestamp0"
   parent              : The parent of the object
   parent              : The parent of the object
                         flags: readable, writable
                         flags: readable, writable, 0x2000
                         Object of type "GstObject"
                         Object of type "GstObject"
   qos                : Handle Quality-of-Service events
   qos                : Handle Quality-of-Service events
                         flags: readable, writable
                         flags: readable, writable
                         Boolean. Default: false
                         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
</syntaxhighlight>
</syntaxhighlight>


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


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



Revision as of 22:36, 4 November 2024


Previous: Getting Started/Building GstSEIMetadata 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'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:

#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 }
      video/x-h265
          stream-format: { (string)byte-stream, (string)hvc1 }
  
  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 }

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.

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


Previous: Getting Started/Building GstSEIMetadata Index Next: Examples