format-location signals of splitmuxsink

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

format-location signals of splitmuxsink

Stephenwei
Hi,
My GStreamer version is 1.14.4
I try to used format-location of splitmuxsink to split the mp4 file
the parameter as below:
    GstElement* mux = gst_element_factory_make("mp4mux", "mux");
    g_object_set(G_OBJECT(splitmuxsink), "muxer", mux, NULL);
    g_object_set(G_OBJECT(splitmuxsink), "max-files", 60, NULL);
    g_object_set(G_OBJECT(splitmuxsink), "max-size-time", 1000000000, NULL);
    g_object_set(G_OBJECT(splitmuxsink), "location", "/tmp/video/%03d.mp4",
NULL);
g_signal_connect(splitmuxsink, "format-location-full", G_CALLBACK
(cb_splitmuxsink_format_location), NULL)

gchar* cb_splitmuxsink_format_location (GstElement splitmuxsnik, guint
fragment_id, gpointer udata)
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    gchar time_name[40];
    snprintf(time_name, 40, "/tmp/video/%03d.mp4", local->tm_sec);
    printf("time_name=%s\n",(gchar*)time_name); // show the sec time
    return (gchar*)time_name;
}

it seems work, but the generated file always start by 000.mp4
It seems to follow location instead of format-location

Thanks




-----
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.

--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.
Reply | Threaded
Open this post in threaded view
|

Re: format-location signals of splitmuxsink

Stephenwei
Update!
I try a python code to implement this function and work success.

    splitmuxsink.set_property("location", external_video + "/%03d.mkv")
    splitmuxsink.set_property("muxer", mkv_muxer)
    splitmuxsink.set_property("max-files", 60)
    splitmuxsink.set_property("max-size-time", 1000000000)

def cb_splitmuxsink_format_location(splitmux, fragment_id,
external_video_path):

    start_time = datetime.datetime.fromtimestamp(time.time())
    s_sec = int(start_time.strftime("%S"))
    name = external_video_path + "%03d" %s_sec + ".mkv"
    return str(name)

Have any suggestions?



-----
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.

--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.