adding datetime stamp to location
Nicolas Dufresne
nicolas at ndufresne.ca
Wed Sep 8 16:16:43 UTC 2021
Le mercredi 08 septembre 2021 à 10:35 -0400, Dwight Kulkarni via gstreamer-devel
a écrit :
> Hi all,
>
> I am trying to get my pipeline to add a datetime stamp to the location, as
> opposed to the numeric value.
>
> Previously I was using: splitmuxsink location=video%02d.mkv
>
> This is creating multiple files with video00.mkv etc. names.
>
> Now I tried using: splitmuxsink location=video$(date +%s).mkv
>
> This is creating only a single file with timestamp and appears to overwrite
> the previous files.
>
> 1) I see some examples where a callback is used. Should I use a callback or is
> there another way ?
>
> 2) If I use callback, I have GstMediaFactory object where I assign the
> pipeline with: gst_rtsp_media_factory_set_launch
You have to connect to the "media-configure" signal of your factory:
https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L123
And then use gst_rtps_media_get_element() to retreive the pipeline:
https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/blob/master/examples/test-appsrc.c#L66
regards,
Nicolas
>
> I can't seem to find how to access the pipeline element in GstMediaFactory
> object.
>
> I want to do something like this code:
>
> static gchararray
> format_location_callback (GstElement * splitmux,
> guint fragment_id,
> gpointer udata)
> {
> static int i =0;
> gchararray myarray = g_strdup_printf("myvid%d.mp4", i);
> i += 1;
>
> return myarray;
> }
>
> g_signal_connect (G_OBJECT (bin->sink), "format-location",
> G_CALLBACK (format_location_callback), bin);
>
> Any help is appreciated. Thanks !
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210908/92e951d8/attachment-0001.htm>
More information about the gstreamer-devel
mailing list