How to do only video seek

Jitendra Varshney jitendra.lucky20 at
Tue Dec 13 23:17:20 PST 2011

Hi All,

I am implementing a functionality in the a player. In that, I require to
seek the only video to catch up with the audio in case of lateness.
This functionality is required to remove jerks and audio drop and to make
the playback smoother.

For that I have added data probing to sink pad and in the handler, under
Qos event I am checking the lateness.
If lateness is more than 500 ms, I need to seek video part to catch with

For that, I am calling the following function from Qos event handler by
using g_timeout_add(50,seek_handle,app);

static gboolean
seek_handle(gpointer data)
    GstClockTimeDiff seekPos;
    GstClockTimeDiff pos;
    GstFormat format = GST_FORMAT_TIME;
    gst_element_query_position (app->pipeline, &format, &pos);
    seekPos = pos + GST_MSECOND * 500;

    gst_element_seek (app->seekElement, 1.0, GST_FORMAT_TIME, flags,

    return FALSE;

So I have following queries regarding this implementation.

1) In the above implementation, it seeks audio and video both.
2) Is it possible to seek only video in gstreamer. The support for that is
available at parser level in my implementation.
3) In above implementation, if I use only GST_SEEK_FLAG_FLUSH then it
pauses the pipeline for 5 second before seeking to new position.
4) If I use the both flags as mentioned above, then for some streams it
play again and again from certain location.
The reason for that may be due to nearest KeyFrame is from previous
location. So is there any way to force to get the next keyframe from
forward location.

I am wondering, why are these behavior (3 and 4) observed. Am I missing
something ? or is there any other way of doing it ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list