How to give current date and time as a file name.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to give current date and time as a file name.

Shubham Shrivastava

g_object_set (G_OBJECT (data.filesink), "location","/home/shubham/Videos/video%03d.mp4","async",0, NULL);

Insted of video%03d.mp4  i want to give current date and time but as i give it overrides the same file.

Plz Help!

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to give current date and time as a file name.

James Cameron
On Thu, Jul 05, 2018 at 10:07:40AM +0530, Shubham Shrivastava wrote:
> g_object_set (G_OBJECT (data.filesink), "location","/home/shubham/Videos/video%03d.mp4","async",0, NULL);
>
> Insted of video%03d.mp4  i want to give current date and time but as i give it
> overrides the same file.

I'm not sure if you are saying you want ideas for how to give the
current date and time, or you have tried that and you get no change to
file name.

Assuming the former, then GLib.date_strftime may be useful.
<a href="https://lazka.github.io/pgi-docs/#GLib-2.0/functions.html#GLib.date_strftime">https://lazka.github.io/pgi-docs/#GLib-2.0/functions.html#GLib.date_strftime

Should you mean the latter, I've no idea.

--
James Cameron
http://quozl.netrek.org/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to give current date and time as a file name.

Gst-Geek
In reply to this post by Shubham Shrivastava
Shubham,

By default integer number with format is used for file indexing.
To use file name as per your wish Use format-location or
format-location-full signals.


Below are the signal details.
Element Signals:
  "format-location" :  gchararray user_function (GstElement* object,
                                                 guint arg0,
                                                 gpointer user_data);
  "format-location-full" :  gchararray user_function (GstElement* object,
                                                      guint arg0,
                                                      GstSample* arg1,
                                                      gpointer user_data);

Use GLib Date and Time Functions for file name generation.
https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel