<html><head></head><body><div>Le mercredi 08 septembre 2021 à 15:03 -0400, Dwight Kulkarni a écrit :</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Nicolas and everyone,<div><br></div><div>I was able to get the issue resolved with the method that Nicolas mentioned, namely to get media-configure callback and then access the element by name and then get the "format-location" callback on the splitmuxsink and pass it the formatted name in a function.</div><div><br></div><div>This is working great !! Thank you Nicolas.</div><div><br></div><div>However, now I am having a problem that I start the RTSP server, and the pipeline only seems to save when I login with VLC client to view the stream. As soon as I log off, the file stops saving.</div><div><br></div><div>Is there a way to have the RTSP pipeline run even when no client is connected ?  Or can I simulate a fake client in someway ?</div></div></div></blockquote><div><br></div><div>This is how RTSP server handles it's internal pipeline. To get full control of the recording, I would suggest using an external pipeline, and have a branch that ends with appsink, that will then feed an appsink in the rtspserver pipeline.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 8, 2021 at 1:36 PM Dwight Kulkarni <<a href="mailto:dwight@realtime-7.com">dwight@realtime-7.com</a>> wrote:<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Nicolas,<div><br></div><div>Thank you for this info ! </div><div><br></div><div>In the example shown we get callback to media_configure, and access the pipeline element. Do I have to then create another call back for the file sink as shown below? </div><div><br></div><div><pre lang="c"><span id="gmail-m_-3006484752515546344gmail-LC58" lang="c"><span>static</span> <span>void</span></span>
<span id="gmail-m_-3006484752515546344gmail-LC59" lang="c"><span>media_configure</span> <span>(</span><span>GstRTSPMediaFactory</span> <span>*</span> <span>factory</span><span>,</span> <span>GstRTSPMedia</span> <span>*</span> <span>media</span><span>,</span></span>
<span id="gmail-m_-3006484752515546344gmail-LC60" lang="c">    <span>gpointer</span> <span>user_data</span><span>)</span></span>
<span id="gmail-m_-3006484752515546344gmail-LC61" lang="c"><span>{</span></span>
<span id="gmail-m_-3006484752515546344gmail-LC62" lang="c">  <span>GstElement</span> <span>*</span><span>element </span></span><span id="gmail-m_-3006484752515546344gmail-LC66" lang="c"><span>=</span> <span>gst_rtsp_media_get_element</span> <span>(</span><span>media</span><span>);</span></span>
</pre><pre lang="c"><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">GstElement * filesink = gst_bin_get_by_name_recurse_up (GST_BIN (element), "filesink");</span></pre><pre lang="c"><span lang="c"><span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal"># add a callback signal</span><br style="font-family:Arial,Helvetica,sans-serif;white-space:normal"><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">g_signal_connect (G_OBJECT (filesink), "format-location", </span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">G_CALLBACK (format_location_callback), NULL);</span>

</span></span></pre></div><div><br></div><div>PIPELINE = </div><div>(v4l2src device=/dev/video1 ! video/x-raw,width=1920, height=1080! <br>queue ! vpuenc_h264 ! queue ! h264parse ! splitmuxsink name=filesink location=video%02d.mkv max-size-time=10000000000  <br>muxer-factory=matroskamux muxer-properties="properties,streamable=true)<br><br><br><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 8, 2021 at 12:16 PM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><div>Le mercredi 08 septembre 2021 à 10:35 -0400, Dwight Kulkarni via gstreamer-devel a écrit :</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I am trying to get my pipeline to add a datetime stamp to the location, as opposed to the numeric value. </div><div><br></div><div>Previously I was using:  splitmuxsink location=video%02d.mkv</div><div><br></div><div>This is creating multiple files with video00.mkv etc. names.</div><div><br></div><div>Now I tried using: splitmuxsink location=video$(date +%s).mkv</div><div><br></div><div>This is creating only a single file with timestamp and appears to overwrite the previous files. </div><div><br></div><div>1) I see some examples where a callback is used. Should I use a callback or is there another way ?</div><div><br></div><div>2) If I use callback, I have GstMediaFactory object where I assign the pipeline with:  <span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px">gst_rtsp_media_factory_set_launch</span></div></div></blockquote><div><br></div><div>You have to connect to the "media-configure" signal of your factory:</div><div><br></div><div><a href="https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L123" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L123</a></div><div><br></div><div>And then use gst_rtps_media_get_element() to retreive the pipeline:</div><div><br></div><div><a href="https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L66" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L66</a></div><div><br></div><div>regards,</div><div>Nicolas</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>I can't seem to find how to access the pipeline element in GstMediaFactory object.</div><div><br></div><div>I want to do something like this code:</div><div><br></div><div><pre style="margin-top:0px;padding:12px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.30769;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:5px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">static</span> gchararray
format_location_callback (GstElement * splitmux,
                          guint fragment_id,
                          gpointer udata)
{
  <span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">static</span> <span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">int</span> i =<span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">0</span>;
  gchararray myarray = g_strdup_printf(<span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">"myvid%d.mp4"</span>, i);
  i += <span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">1</span>;

  <span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">return</span> myarray;
}</code></pre></div><div><span style="background-color:initial;color:rgb(0,0,0);font-family:Consolas,Monaco,"andale mono","ubuntu mono",monospace;font-size:14px"><br></span></div><div><pre style="margin-top:0px;padding:12px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.30769;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:5px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit">g_signal_connect (G_OBJECT (bin->sink), <span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">"format-location"</span>,
          G_CALLBACK (format_location_callback), bin);</code></pre></div><div><br></div><div>Any help is appreciated. Thanks !<br><div><br></div></div></div></blockquote><div><br></div><div><span></span></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni</div></div></div></div></div></div></div></div></blockquote></div><br clear="all"><div><br></div></div></blockquote><div><br></div><div><span></span></div></body></html>