<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 class="gmail-code gmail-highlight" lang="c"><span id="gmail-LC58" class="gmail-line" lang="c"><span class="gmail-k">static</span> <span class="gmail-kt">void</span></span>
<span id="gmail-LC59" class="gmail-line" lang="c"><span class="gmail-nf">media_configure</span> <span class="gmail-p">(</span><span class="gmail-n">GstRTSPMediaFactory</span> <span class="gmail-o">*</span> <span class="gmail-n">factory</span><span class="gmail-p">,</span> <span class="gmail-n">GstRTSPMedia</span> <span class="gmail-o">*</span> <span class="gmail-n">media</span><span class="gmail-p">,</span></span>
<span id="gmail-LC60" class="gmail-line" lang="c">    <span class="gmail-n">gpointer</span> <span class="gmail-n">user_data</span><span class="gmail-p">)</span></span>
<span id="gmail-LC61" class="gmail-line" lang="c"><span class="gmail-p">{</span></span>
<span id="gmail-LC62" class="gmail-line" lang="c">  <span class="gmail-n">GstElement</span> <span class="gmail-o">*</span><span class="gmail-n">element </span></span><span id="gmail-LC66" class="gmail-line gmail-hll" lang="c"><span class="gmail-o">=</span> <span class="gmail-n">gst_rtsp_media_get_element</span> <span class="gmail-p">(</span><span class="gmail-n">media</span><span class="gmail-p">);</span></span>
</pre><pre class="gmail-code gmail-highlight" 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 class="gmail-code gmail-highlight" lang="c"><span class="gmail-line gmail-hll" lang="c"><span class="gmail-p"><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">nicolas@ndufresne.ca</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><div>Le mercredi 08 septembre 2021 à 10:35 -0400, Dwight Kulkarni via gstreamer-devel a écrit :</div><blockquote type="cite" style="margin:0px 0px 0px 0.8ex;border-left:2px solid rgb(114,159,207);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:0px 0px 0px 0.8ex;border-left:2px solid rgb(114,159,207);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" class="gmail_signature"><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>