[Ffmpeg-devel] global frame timestamp or number

Martin Luessi mluessi
Wed Mar 21 22:21:02 CET 2007


Hi,

I'm working on a python wrapper library and I want to be able to
extract a specific frame from a video, in python this could look
something like this:
frame = videofile[index]
where videofile is a python objects that uses the wrapper library. My
idea is to use the av_seek_frame function to seek to the key frame
just before the frame I want and then decode the rest of the frames
until I reach the frame I'm interested in. I have also been thinking
about caching the decoded frames between the I frame and the frame I'm
interested in. This would certainly improve the performance when going
backwards through the video stream (say I want videofile[n] and then
videofile[n-1]).
I'm having problems of figuring out what the global frame number of a
frame is, the struct members
av_frame->coded_picture_number
av_frame->display_picture_number
codec_ctx->frame_number
do not seem to be global but depend on the order the frames are
decoded. Can anybody tell me if there is a way to find global index of
a frame. (with global I mean the frame number in the stream)

thanks,

Martin




More information about the ffmpeg-devel mailing list