muliple gst_element_seek for creating new file
sebastian at centricular.com
Tue Apr 26 06:26:09 UTC 2016
On Mo, 2016-04-25 at 08:28 +0200, marc dingemans wrote:
> I want to extract some video parts from a mkv file and create based
> on these parts one new mkv file.
> This is done with muliple gst_element_seek calls with a time frame.
> When a eos is received, then a the next gst_element_seek is started
> until done.
> The destination file is generated, but can not be played with VLC.
> The seek is done executed on element "matroskademux" (also used
> pipeline) with GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SNAP_BEFORE
> Used pipeline :
> filesrc| matroskademux| h264parse | matroskamux | filesink
> When I use next pipeline, then everything works fine.
> filesrc| matroskademux| h264parse | avdec_h264| autovideosink
> Why does the seek seems work to gui and not to file.
> Must I use other approaches to put parts from a file in a new one
You need to ensure that matroskamux sees each segment as contiguous to
the previous one, and also that each segment properly starts with a
keyframe. The latter being a bit tricky without reencoding.
Also flushing seeks are not ideal for this kind of goal.
As a first step, try getting this to work with decoding and reencoding.
Then you can optimize the encoding away and solve the remaining
What is important for that is that you make sure that the muxer is
never flushed and the running time of the incoming data is continuous
instead of starting from 0 again. With non-flushing seeks you can
achieve this, and you can know when such a seek segment is done based
on the SEGMENT_DONE message on the bus (instead of EOS).
Alternatively you can use GES (gstreamer-editing-services) or the nle
plugin contained in GES for implementing this use case. It's allowing
to do exactly what you want.
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 949 bytes
Desc: This is a digitally signed message part
More information about the gstreamer-devel