[Ffmpeg-devel] incorrect NTSC frame rate detection in .MOV file parser

Dan Maas dmaas
Wed Feb 1 03:31:36 CET 2006

I've traced the problem to line 2029 of libavformat/utils.c:

av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, den, FFMAX(st->time_base.den, st->time_base.num)/4);

This av_reduce() is supposed to compute the real frame rate based on
sample durations. However the 'max' argument (FFMAX(...))) prevents it
from computing the correct ratio. This causes the following if()
statement to be false, and incorrectly assigns a frame rate without
the 1/1.001 NTSC factor.

For example, a 2-frame NTSC DV Quicktime file has total duration 5994
and sample duration 200. The correct frame rate is 5994/200 = 2997/100.
However the av_reduce() returns 30/1, which is incorrect.


More information about the ffmpeg-devel mailing list