Difference between revisions of "GstSEIMetadata/User Guide"
Maumontero (talk | contribs) |
m |
||
(18 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | {{ | + | {{GstSEIMetadata/Head|previous=Getting Started/Building GstSEIMetadata|next=Examples|metakeywords=}} |
</noinclude> | </noinclude> | ||
+ | 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 <pre>gst-inspect-1.0 seiinject</pre> is the following: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | #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 } | ||
+ | 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 | ||
+ | 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" | ||
+ | </syntaxhighlight> | ||
− | + | ===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''' | ||
<pre> | <pre> | ||
gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v | gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h264 -v | ||
</pre> | </pre> | ||
− | + | '''H265''' | |
+ | <pre> | ||
+ | gst-launch-1.0 videotestsrc ! x265enc ! seiinject metadata="Hello World" ! filesink location=seiinject_videotestsrc.h265 -v | ||
+ | </pre> | ||
+ | |||
+ | * metadata-binary: property used to insert metadata as binary see [[GStreamer H264 - H265 Metadata/Examples/C Example|C Example]] | ||
+ | |||
+ | ==SeiMetatester element== | ||
+ | The expected output of running <pre>gst-inspect-1.0 seimetatester</pre> is the following: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | #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 | ||
+ | </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. | ||
<pre> | <pre> | ||
Line 24: | Line 167: | ||
</pre> | </pre> | ||
− | + | Note: This element currently only supports H264 encoded buffers. | |
+ | == SeiExtract element == | ||
+ | The expected output of running <pre>gst-inspect-1.0 seiextract</pre> is the following: | ||
+ | <syntaxhighlight lang=bash> | ||
+ | #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); | ||
+ | |||
+ | </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. | ||
+ | |||
+ | '''H264''' | ||
<pre> | <pre> | ||
− | + | gst-launch-1.0 videotestsrc ! x264enc ! seiinject metadata="Hello World" ! seiextract ! filesink location=seiinject_videotestsrc.h264 -v | |
+ | </pre> | ||
− | gst-launch-1.0 videotestsrc ! | + | '''H265''' |
+ | <pre> | ||
+ | gst-launch-1.0 videotestsrc ! x265enc ! seiinject metadata="Hello World" ! seiextract ! filesink location=seiinject_videotestsrc.h265 -v | ||
</pre> | </pre> | ||
<noinclude> | <noinclude> | ||
− | {{ | + | {{GstSEIMetadata/Foot|Getting Started/Building GstSEIMetadata|Examples}} |
</noinclude> | </noinclude> |
Latest revision as of 12:56, 7 March 2023
GstSEIMetadata | |
---|---|
GstSEIMetadata Basics | |
|
|
Getting Started | |
|
|
User Guide | |
|
|
Examples | |
|
|
Performance | |
|
|
Contact Us |
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.
Contents
SeiInject element
The expected output of runninggst-inspect-1.0 seiinjectis 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 }
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
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.
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
SeiMetatester element
The expected output of runninggst-inspect-1.0 seimetatesteris 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
Note: This element currently only supports H264 encoded buffers.
SeiExtract element
The expected output of runninggst-inspect-1.0 seiextractis 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