[FFmpeg-devel] movenc produces improper QuickTime files

Diego 'Flameeyes' Pettenò flameeyes
Tue May 29 23:38:08 CEST 2007

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.

The problem is that movenc uses the denominator of 333667/10000000
(29.97), while QuickTime files usually seems to use the value 2997 (at
least Apple's "Get A Mac" spots as well as their own trailers).

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.

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

[1] http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt
Diego "Flameeyes" Petten?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: incomplete-and-stupid-patch
Type: application/octet-stream
Size: 2645 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070529/3c6dcdb0/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070529/3c6dcdb0/attachment.pgp>

More information about the ffmpeg-devel mailing list