[Libav-user] How to Frame Step Forwards/Backwards?

xftzg xftzg2013 at 126.com
Mon Mar 25 10:53:54 CET 2013


I know it is using the PTS of the frame to seek to frames.
I want to perform a 'Step Forwards/Backwards' operation in my player, but the problem is that the seeking to frames are not always working as I expected.

    int64_t time_stamp = 0;
    time_stamp = current_pts - frame_span;    // frame_span is calculated by avg_frame_rate, and in stream time base
    search_flag = AVSEEK_FLAG_BACKWARD;
    int ok = av_seek_frame(format_ctx, video_stream, times_tamp, search_flag);

The result would sometimes either jump to the current key frame or several key frames earlier. What should I do to fix it?
By the way, is there any convenient way to know the index of the frame, which is now playing?

Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130325/d65ab0f3/attachment.html>

More information about the Libav-user mailing list