[Ffmpeg-devel] Timestamp troubles

Steve Lhomme slhomme
Wed Feb 22 01:07:44 CET 2006

Hi everyone,

We're currently adding some kind of frame browsing in DrDivX OSS, using 
(Dr)FFMPEG as the decoding engine. So far so good.

But we also want to seek in the stream backward and forward. We use 
av_seek_frame for that, with the video stream index we're looking for.

The problem is that the timestamps of packets seem to be inconsistent. 
Here are 2 cases to explain the situation :

- goats.wmv:

* timestamps in the AVStream.index_entries ranges from 1 to 78 (78s)
* the AVFormatContext.duration is 78.866.000 (probably in ?s)
* AVStream.time_base is (1, 1.000)
* AVCodecContext.time_base is (1, 1.000)

So, it looks like the timestamp to give to av_seek_frame should be 
between 1 and 78, that is the duration multiplied by both time bases. Or 
it could just simply be the duration divided by AV_TIME_BASE (1.000.000).

- chems1.vob

* timestamps in the AVStream.index_entries ranges from 3.484 to 1.601.884
* the AVFormatContext.duration is 17.760.000 (probably in ?s)
* AVStream.time_base is (1, 90.000)
* AVCodecContext.time_base is (25.025, 1.001)

And in that case I have no idea how to translate a value in the 
"duration" format to something that will match the value needed to look 
in the index_entries.

Am I wrong or there is a bug somewhere ? The duration (in AV_TIME_BASE) 
and time_base seem to be correct. Only the index_entries seem to be weird.


More information about the ffmpeg-devel mailing list