Hi,
I would like to extract a video segment from a file. Let's say 10 seconds out of a one minute video starting 20 seconds from the begining (second 20 to 30). splitmuxsink can split the entire stream into small segments but I need only one segment. GstSegment looks promising but I don't find any example. Please help, -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Use seek.
Seek to 10 second in the beginning and set end to 20sec. After seek complete close the pipeline. For this splitmux sink is not required -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Sorry. There is a mistake in previous message. setting is 5 to 10 seconds:
Thanks Vinod Kesti for the pointer. However I tried your method without much success. Here is the code: What might be wrong? void* launch_gst_cut_section_pipe(void) { CustomData data; GstBus *bus; GstMessage *msg; GstStateChangeReturn ret; gchar *descr; GError *error = NULL; dout("Started cutting section!\n"); /* Initialize GStreamer */ gst_init (NULL,NULL); data.terminate = false; //create a new pipeline descr = g_strdup_printf ("filesrc location=/tmp/rec/V_Cam02_2019.07.11_10.33.02.479.ts ! tsdemux ! mpegtsmux ! filesink location=test2.ts"); data.pipeline = gst_parse_launch (descr, &error); if (error != NULL) { dout("could not construct gstreamer pipeline: %s\n", error->message); g_clear_error (&error); return 0; } gst_element_set_state(data.pipeline, GST_STATE_PAUSED);//not sure this is needed??? *#if 1 //GST_SEEK_TYPE_SET, 20 * GST_SECOND)); //GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)); if (!gst_element_seek (data.pipeline, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 5 * GST_SECOND, GST_SEEK_TYPE_SET, 10 * GST_SECOND)); { dout("### Seek failed! ###\n"); } #endif* /* Start playing */ ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { dout("Unable to set the gstreamer pipeline to the playing state.\n"); gst_object_unref (data.pipeline); return 0; } /* Listen to the bus */ bus = gst_element_get_bus (data.pipeline); do { msg = gst_bus_timed_pop_filtered (bus, 200 * GST_MSECOND, GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS); /* Parse message */ if (msg != NULL) { handle_message (&data, msg); } else { //nothing to do yet! } } while (!data.terminate); dout("Cutting section finished!\n"); /* Free resources */ gst_object_unref (bus); gst_element_set_state (data.pipeline, GST_STATE_NULL); gst_object_unref (data.pipeline); return 0; } I get this warning when setting: *export GST_DEBUG="*:3"* 2019-07-11 15:56:52 | Started cutting section! 0:00:00.063433232 3296 0xaaaab8e22c60 WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete:<filesrc0> pad not activated yet *2019-07-11 15:56:52 | ### Seek failed! ###* 0:00:00.066805541 3296 0xaaaab8e048a0 FIXME basesink gstbasesink.c:3145:gst_base_sink_default_event:<filesink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements 0:00:00.407322486 3296 0xaaaab8e048a0 WARN basesrc gstbasesrc.c:2445:gst_base_src_update_length:<filesrc0> processing at or past EOS 2019-07-11 15:56:52 | Cutting section finished! -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |