[gst-devel] question on seek

Tim-Philipp Müller t.i.m at zen.co.uk
Wed Apr 8 14:26:41 CEST 2009


On Wed, 2009-04-08 at 09:21 +0000, Albert Costa wrote:

> I have a simple question: I have an application where I want to
> display only a subset of a video. My pipeline can be resumed to
> 'filesrc ! decodebin ! ffmegcolorspace ! queue ! directdrawsink'. To
> see only a part of the video, I use following :
> 
>               (snip flushing segment seek)
>               gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
>               gst_element_get_state(m_pipeline, NULL, NULL, -1);
>               gst_element_send_event(m_pipeline, seek_event);
>
> where start/stop_time are values for the start and end positions in my
> file.
> Everything works fine, except for the fact that just before displaying
> the video at position start (and then playing up to stop position), I
> do see the first (0) frame of the video.

The problem is that the video sink will render the first frame already
on preroll, so just as it goes into PAUSED state. You are waiting for
the pipeline to finish prerolling though (and reach playing state on top
of that) before you issue the flushing seek, so at that point it's too
late and the first frame has already been shown.

So if you want to avoid that you either have to prevent the videosink
from drawing preroll buffers, or do the seek before it reaches the sink
(but after you know the demuxer is read for seeking, which is tricky).
You could probably do something involving pad blocks here. Or use
gnonlin, as has already been suggested.

Cheers
 -Tim







More information about the gstreamer-devel mailing list