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

Reimar Döffinger Reimar.Doeffinger
Sat Jan 29 14:02:44 CET 2011


On Sat, Jan 29, 2011 at 02:35:04PM +0200, Anssi Hannula wrote:
> 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.

Sorry, failure to use calculator properly.
What is the time_base, is FFmpeg aware the time stamps only have
millisecond precision? Because I thought there was code to ignore
only off-by-one differences.

> > 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).

That could/should probably be used in some way then.
Note that I do not know if it might also be that 24000/1001
causes an issue, that is a non-standard frame-rate, whereas
24 fps is standard and I think some parts of FFmpeg prefer
standard values.



More information about the ffmpeg-devel mailing list