<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Thank you Michael and Eslam!</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">@Eslam, Seems like all the above options you mentioned are specific to MPEG, or RTP?<br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I am looking for a solution which could be applied to any data such as text, audio, video data.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">--</div><div class="gmail_default" style="font-family:verdana,sans-serif">Thanks,</div><div class="gmail_default" style="font-family:verdana,sans-serif">Roshan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 26, 2021 at 2:21 PM Eslam Ahmed <<a href="mailto:eslam.ahmed@avidbeam.com">eslam.ahmed@avidbeam.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Roshan,</div><div><br></div><div>Regarding Transport Stream, you can use the MPEG-TS container to contain your encoded stream as well as your metadata in a klv-format. Check this out: <a href="https://gstreamer-devel.narkive.com/GlIqaK1k/example-code-for-muxing-klv-meta-x-klv-with-mpegtsmux-plugins-bad-and-gstreamer-1-8-3" target="_blank">https://gstreamer-devel.narkive.com/GlIqaK1k/example-code-for-muxing-klv-meta-x-klv-with-mpegtsmux-plugins-bad-and-gstreamer-1-8-3</a></div><div><br></div><div>Just make sure to push klv metadata every video frame otherwise the pipeline would stall. One useful thing to note is that your metadata need not be in a klv format, you can just push arbitrary bytes as long as you know how to interpret them after the demuxer at the receiver end.</div><div><br></div><div>Another approach is to use payloaders (e.g. rtph264pay) and encode your metadata as RTP extension headers. see <a href="https://gstreamer.freedesktop.org/documentation/rtplib/gstrtpbuffer.html?gi-language=c#gst_rtp_buffer_add_extension_onebyte_header" target="_blank">https://gstreamer.freedesktop.org/documentation/rtplib/gstrtpbuffer.html?gi-language=c#gst_rtp_buffer_add_extension_onebyte_header</a>. If your metadata is per-frame basis, then most probably and based on the encoded frame size, one frame might end up having multiple RTP packets so you will need to handle where to insert your metadata. You can use the marker bit for that. see <a href="https://gstreamer.freedesktop.org/documentation/rtplib/gstrtpbuffer.html?gi-language=c#gst_rtp_buffer_get_marker" target="_blank">https://gstreamer.freedesktop.org/documentation/rtplib/gstrtpbuffer.html?gi-language=c#gst_rtp_buffer_get_marker</a></div><div><br></div><div>Final approach which is much more complicated which will require you to create a new custom gstreamer media type (e.g. video/x-mytype) and insert your custom metadata via <span style="color:rgb(232,230,227);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">gst_buffer_add_meta()</span> in the GstBuffer and use rtpgstpay/rtpgstdepay which guarantee to fully serialize/deserialize the GstBuffer over the network. You would also need to develop 2 gstreamer elements, one to prepend/append your metadata to your au-aligned H264 and the other to extract the metadata from video/x-mytype and restore the original stream.</div><div><br></div><div>Hope that helps!</div><br clear="all"><div><div dir="ltr"><div dir="ltr">Best Regards,<br>Eslam Ahmed</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 25, 2021 at 10:00 PM Michael Gruner via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hello Roshan<div><br></div><div>The GstMeta is not transmitted through network. If your want a standard way to transmit metadata over the network along with audio and video you may look into Transport Stream. This will allow you to insert your custom metadata without breaking existing decoders. GStreamer already has support for this.</div><div><br></div><div>Another option may be to use a codec that allows you to insert custom data within the compressed bitstream (like SEI in H264 or H265). That, however is a bit more tricky to get right. </div><div><br><div dir="ltr">Michael</div><div id="gmail-m_-8342857539067565191gmail-m_1637966370249812558AppleMailSignature" dir="ltr">www.ridgerun.con</div><div dir="ltr"><br><blockquote type="cite">On 25 Sep 2021, at 08:24, Roshan Chaudhari via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">Hello,</span><br></div><div class="gmail_quote"><div dir="ltr"><div style="font-family:verdana,sans-serif"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">I am trying to append some metadata to the data transferred over udp using gstreamer.<span style="font-family:verdana,sans-serif;font-size:12pt"></span></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><ol><li>I
 would like to know whether metadata in GstBuffer is 
transferred/retained when transferred over the network or it is only 
retained in that pipeline? I have tried using my custom metadata with 
gst_buffer_add_meta() at the udpsink, however, when I try to query it on
 udpsrc on other machine using gst_buffer_get_meta(), metadata is not 
present in GstBuffer. <br></li><li style="display:block"><br></li><li>If
 this is not carried over the network, what would be the other way to 
add metadata? I could write custom plugin and append to actual data, so 
my custom encoder and decoder knows how to extract real data and pass it
 to next stage in the pipeline. But this way, it puts restriction on the
 receiver side to have decoder if my data contains metadata.</li></ol><div><br></div><div>-<br></div><div>Thanks,</div><div>Roshan<br></div></div><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br></div></div></div>
</div></div>
</div></blockquote></div></div></blockquote></div>
</blockquote></div>