<div dir="ltr"><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p>I agree with Reuven, SEI meta data in the h264 or h265 stream is well worth your concideration.</p>
<p>Not sure if it is an option seeing you are on a scientific project, 
but we have gone that way and are using a comercial plugin from RidgeRun
 
(<a href="https://developer.ridgerun.com/wiki/index.php/GstSEIMetadata/Examples/Using_gst-launch">https://developer.ridgerun.com/wiki/index.php/GstSEIMetadata/Examples/Using_gst-launch</a>
 ) that handles all the SEI specific implementation.</p>
<p>Just add an SeiInject element in the stream when it is in h264 format
 and then you can either insert the string as meta data on a data probe 
just before the seiinject like:</p><p><br></p>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre"><div>      SeiMetadata smetadata;</div><br>      <span style="color:rgb(200,200,200)">smetadata</span>.<span style="color:rgb(218,218,218)">data</span> <span style="color:rgb(180,180,180)">=</span> (<span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(180,180,180)">*</span>)<span style="color:rgb(200,200,200)">meta</span>-><span style="color:rgb(218,218,218)">jsonstring</span>;<div>      <span style="color:rgb(200,200,200)">smetadata</span>.<span style="color:rgb(218,218,218)">size</span> <span style="color:rgb(180,180,180)">=</span> <span style="color:rgb(200,200,200)">strlen</span>(<span style="color:rgb(200,200,200)">meta</span>-><span style="color:rgb(218,218,218)">jsonstring</span>);</div><span style="color:rgb(87,166,74)"><br></span><div>      GstSeiMeta <span style="color:rgb(180,180,180)">*</span>retmeta <span style="color:rgb(180,180,180)">=</span> <span style="color:rgb(200,200,200)">gst_buffer_add_sei_meta</span>(<span style="color:rgb(180,180,180)">*</span>outbuf, <span style="color:rgb(180,180,180)">&</span>smetadata);</div></div>

<p><br>or there is metadata-binary property on seeinject as well where you can set the data (string)</p>
<p><br>This also makes sure that the meta data is linked to the exact frame 
that is being handled by the seiinject and if you save the mp4 in h264 
or h265 format , then it is persisted as well. If you add your text to 
the rtsp stream it will be gone once comsumed.</p></div></div></div>