[FFmpeg-devel] [PATCH] lavf: inspect more frames when the time base is unreliable

Anssi Hannula anssi.hannula
Sat Jan 29 16:10:29 CET 2011


On 29.01.2011 16:33, Reimar D?ffinger wrote:
> On Sat, Jan 29, 2011 at 04:10:38PM +0200, Anssi Hannula wrote:
>> Well, I see that for normal non-MPEG2/non-H264 files we use the
>> framerate calculated from the codec time base (as below). Do you think
>> using that would be ok for H.264 as well (at least if the first 5 or so
>> timestamps seem to match that value, assuming H264 is considered
>> unreliable for a reason), or if we should add some new case for using
>> the format headers instead.
> 
> While the code gets progressively uglier that way, using the value
> from the header if it's within a few % should be safe and fix at least
> that case.

Just to check, you mean the container header and not the h.264 stream
header?

If so, we would only use container header if tb_unreliable() is true and
the first few timestamps match it, right?

However, in this case the h.264 header has the correct fps as well,
though, so wouldn't it be better if we used that if it seems to match,
so that it would work for non-mkv as well?


For the record, the value derived from h.264 header is 24000/1001
(~23.976024), while a value derived from the container header is
1710843747/71356439 (~23.976025) (interestingly, mkv header has
41708332ns while 24000/1001 would be 41708333.33...ns). I guess the
difference is small enough, though.

-- 
Anssi Hannula



More information about the ffmpeg-devel mailing list