[Ffmpeg-devel] global frame timestamp or number

Uoti Urpala uoti.urpala
Wed Mar 21 23:04:21 CET 2007


On Wed, 2007-03-21 at 16:21 -0500, Martin Luessi wrote:
> 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)

There is no general way to know the number of a frame except decoding
the file from the beginning until that frame. Containers normally have
timestamps but no frame numbers, so you cannot know how many frames
there are prior to a seek position. One special case where calculating
the frame number directly is possible is when you know for certain that
the file you're dealing with is constant frame rate. Then you can
calculate the frame number from the timestamp.





More information about the ffmpeg-devel mailing list