adding datetime stamp to location

Dwight Kulkarni dwight at realtime-7.com
Wed Sep 8 17:36:07 UTC 2021


Hi Nicolas,

Thank you for this info !

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?

static voidmedia_configure (GstRTSPMediaFactory * factory,
GstRTSPMedia * media,    gpointer user_data){  GstElement *element =
gst_rtsp_media_get_element (media);

GstElement * filesink = gst_bin_get_by_name_recurse_up (GST_BIN
(element), "filesink");

# add a callback signal
g_signal_connect (G_OBJECT (filesink), "format-location", G_CALLBACK
(format_location_callback), NULL);


PIPELINE =
(v4l2src device=/dev/video1 ! video/x-raw,width=1920, height=1080!
queue ! vpuenc_h264 ! queue ! h264parse ! splitmuxsink name=filesink
location=video%02d.mkv max-size-time=10000000000
muxer-factory=matroskamux muxer-properties="properties,streamable=true)





On Wed, Sep 8, 2021 at 12:16 PM Nicolas Dufresne <nicolas at ndufresne.ca>
wrote:

> 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 !
>
>
>

-- 
Sincerely,

Dwight Kulkarni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210908/e95dec16/attachment.htm>


More information about the gstreamer-devel mailing list