[FFmpeg-devel] movenc produces improper QuickTime files

Michael Niedermayer michaelni
Wed May 30 00:04:10 CEST 2007


On Tue, May 29, 2007 at 11:38:08PM +0200, Diego 'Flameeyes' Petten? wrote:
> I've been trying all day to get FFmpeg to convert some AVI files to
> Mov/QuickTime format, and I've almost always ended up having files that
> didn't play on QuickTime at all, but one time when I actually got the
> file playing the video track but not the audio track.
> After some search I was finally able to pin down the problem to the
> mdhd atom version: QuickTime seem to refuse files with mdhd atoms
> version 1 (timestamps and duration 64-bit rather than 32-bit); the
> conversion that played had video as mdhd version 0.
> The files I was converting were all between 20 and 30 minutes, so I
> looked at the specifics and found that mdhd's timescale should be,
> following [1] the fps rate for video tracks, while FFmpeg uses the
> value 10000000 after conversion.

umm [1] does not look like the quicktime spec so i fear its contents
have no relevance here

> The problem is that movenc uses the denominator of 333667/10000000

movenc does not use anything besides the value it is told to use
and that one is in your case likely simply what the input file used
using any other value is incorrect

> (29.97), 

that is not equal as you should have learned in elementary school

> while QuickTime files usually seems to use the value 2997 (at
> least Apple's "Get A Mac" spots as well as their own trailers).

apple is known to get the timebase wrong 99% of the time ...

> I've tried fixing the issue, but I haven't been able to fix all of it
> yet (I suck, I know); the size of the two tracks (video and audio) is
> currently reported incorrectly, and the single timestamps of the frames
> (or packets) is incorrect as it's still calculated over the old value.

not sure what you are trying to do but storing any value different from the
correct one is well ... wrong
ask your favorite math professor/teacher/book why you cant just use 3 
instead of pi ...

> I'm attaching the patch I've been working with, if somebody wants to
> take a look, and maybe has any idea on how to fix it for good..

before a fix comes a bugreport, and between fix and bugreport comes some
anaysis of the problem, you are jumping over a few things here and are
lucky i dont flame you to death for trying to hack the timebase in the

> [1] http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070530/48877cc9/attachment.pgp>

More information about the ffmpeg-devel mailing list