element to cut segments

Sergei Vorobyov sergei.vorobyov at facilitylabs.com
Mon Mar 26 07:56:19 PDT 2012


I wonder what would be the canonical/idiomatic way of cutting a
segment from a video stream, from the command line?

There should certainly be a "filter" element, similar to
gnlfilesource, which takes location, start, duration, media-start,
media-duration as parameters and cuts off a segment.

Trouble is gnlfilesource reads from the *file*, and not the result
(pipe) of the preceding modules (which may be arbitrarily
complicated).

An apparent candidate (video)segmentclip seems to be undocumented.

Sure, I can do seeks in the code and mimic segments myself by using,
e.g., (to cut a segment from sec 2 to sec 5)

  event = gst_event_new_seek (1.0,
			      GST_FORMAT_TIME,
			      GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT,
			      GST_SEEK_TYPE_SET, 2 * GST_SECOND,
			      GST_SEEK_TYPE_SET, 5 * GST_SECOND);

  gst_element_send_event(pipeline, event);

and checking

  if (msg_type & GST_MESSAGE_SEGMENT_DONE) ...

in the callback associated to the main loop.

But there should be a simpler way one could use from the command line
with gst-launch.

In general, I feel a lack of basic idiomatic descriptions for basic
GStreamer tasks. Documentation is sparse on examples, and Googling
isn't very efficient. Howtos and cheatsheets would be very helpful.
Can anyone share their favorite links? This would be a nice addition
to the GS docs web site. Thanks!


More information about the gstreamer-devel mailing list