[FFmpeg-devel] [PATCH] lavf: inspect more frames when the time base is unreliable
Anssi Hannula
anssi.hannula
Sat Jan 29 13:35:04 CET 2011
On 29.01.2011 12:28, Reimar D?ffinger wrote:
> On Sat, Jan 29, 2011 at 02:39:38AM +0200, Anssi Hannula wrote:
>> For the record, here you can see the progression of the cumulative error
>> of the two competing rates when detecting the frame rate:
>>
>> 0.042000
>> for 24.000000, at 0.042000, error 0.000333, cumulative 0.000000111
>> for 23.976024, at 0.042000, error 0.000292, cumulative 0.000000085
>> 0.041000
>> for 24.000000, at 0.041000, error -0.000667, cumulative 0.000000444
>> for 23.976024, at 0.041000, error -0.000708, cumulative 0.000000502
>> 0.083000
>> for 24.000000, at 0.083000, error -0.000333, cumulative 0.000000556
>> for 23.976024, at 0.083000, error -0.000417, cumulative 0.000000675
>> 0.125000
>> for 24.000000, at 0.125000, error 0.000000, cumulative 0.000000556
>> for 23.976024, at 0.125000, error -0.000125, cumulative 0.000000691
>> 0.167000
>> for 24.000000, at 0.167000, error 0.000333, cumulative 0.000000667
>> for 23.976024, at 0.167000, error 0.000167, cumulative 0.000000719
>> 0.208000
>> for 24.000000, at 0.208000, error -0.000333, cumulative 0.000000778
>> for 23.976024, at 0.208000, error -0.000542, cumulative 0.000001012
>> 0.250000
>> for 24.000000, at 0.250000, error 0.000000, cumulative 0.000000778
>> for 23.976024, at 0.250000, error -0.000250, cumulative 0.000001075
>> 0.292000
>> for 24.000000, at 0.292000, error 0.000333, cumulative 0.000000889
>> for 23.976024, at 0.292000, error 0.000042, cumulative 0.000001076
>> 0.333000
>
> Well, the problem is that the time stamps _do_ match 24 fps better
> than 23.97..., and it is pure chance that parsing more changes this.
I don't think so. The timestamps have millisecond precision and they
thus have a pattern of 41ms and 42ms differences.
After 24 frames the timestamp is 1.001 seconds, which exactly matches
23.976 fps, not 24 fps (it would be 1.000 then).
This is simply not detected with fewer frames due to the pattern being
so long.
> So this file simply isn't constant frame-rate.
The framerate is constant, but the timestamp differences are not (as
they follow a pattern). Note that all 23.976 mkv files I've checked are
like this.
> But it might be possibly to go for whatever is stored in the MKV
> file (if anything) in such an unclear case.
The mkv file contains a default frame duration of 0.041708332ms, which
is an approximation of 24000/1001 (23.976fps).
--
Anssi Hannula
More information about the ffmpeg-devel
mailing list