[Libav-user] How to Frame Step Forwards/Backwards?
xftzg
xftzg2013 at 126.com
Tue Mar 26 10:33:49 CET 2013
Hi Carl, The following is how I seek a frame backward: AVStream *stream = m_format_ctx->streams[m_video_index]; int64_t time_av_time_base = 1 * AV_TIME_BASE / stream->avg_frame_rate.num; int64_t frame_span = av_rescale_q(time_av_time_base, AV_TIME_BASE_Q, stream->time_base); int64_t timestamp = m_current_pts - m_frame_span; int ok = av_seek_frame(m_format_ctx, m_video_index, timestamp, AVSEEK_FLAG_BACKWARD); avcodec_flush_buffers(m_codec_ctx); If there is no straight way to solve this problem, I'd consider the cache frames method. And do you konw >is there any convenient way to know the index of the frame, which is now playing? Thanks very much. BR xftzg At 2013-03-25 18:42:53,"Carl Eugen Hoyos" wrote: >xftzg writes: > >> I want to perform a 'Step Forwards/Backwards' operation in my player > >This is not a trivial task. >I believe there are two main approaches: >You can cache as many frames as you believe the user will want >to step backwards or you seek backwards to the next keyframe >and decode (again) until the requested frame (this may take >considerable time). >If your problem is that you cannot seek backwards to a keyframe, >please post code that allows to test this. > >Carl Eugen > >_______________________________________________ >Libav-user mailing list >Libav-user at ffmpeg.org >http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130326/fbe92e68/attachment.html>
More information about the Libav-user
mailing list