[FFmpeg-devel] [PATCH] Quicktime tapt atom support

Daniel Taylor dan
Wed Jul 15 12:13:17 CEST 2009


Hey all,

I've recently come across a few videos produced by Quicktime where  
there is a tapt atom which can contain clef, prof, and enof atoms with  
width/height aperture information. There can be one tapt atom per trak  
atom, and the layout is as follows:

tapt: Track aperture mode dimensions
     clef: Track clean aperture dimensions
         flags/width/height
     prof: Track production aperture dimensions
         flags/width/height
     enof: Track encoded pixels dimensions
         flags/width/height

The flags are always a big endian 16bit value while the width/height  
are big endian 32 bit integers.

It appears that by default if a clef atom has a set width/height then  
it is used instead of any other width/height in the file, as can be  
seen by my screenshot and samples here:

http://programmer-art.org/dropbox/samples/qtaspect.png
http://programmer-art.org/dropbox/samples/65759_orig.mov
http://programmer-art.org/dropbox/samples/65759.mov

In the first sample the clef width/height are set to 640x360 and in  
the second they are 720x240, which Quicktime respects, ignoring track  
width/height and pixel aspect ratio information.

These same files also seem to have a pasp atom that sets the pixel  
aspect ratio:

Stream #0.0(eng): Video: h264, yuv420p, 640x360, PAR 10000:7031 DAR  
160000:63279, ...

So FFmpeg does the completely wrong thing for these files. I did not  
produce the files and have no control over why or how the pasp atom is  
set.

Attached patch lets clef atom information override the pasp atom to  
set the proper aspect ratio. The dimensions won't necessarily be the  
same as Quicktime displays but the aspect ratio of the video will be  
correct, which is far better than it is now:

Stream #0.0(eng): Video: h264, yuv420p, 640x360, PAR 1:1 DAR 16:9, ...

The above is the same size the video has in Quicktime as can be seen  
in the screenshot. If necessary I can provide a few more samples.

Take care,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clef_support.patch
Type: application/octet-stream
Size: 2517 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090715/0c604540/attachment.obj>
-------------- next part --------------


--
Daniel G. Taylor
http://programmer-art.org



More information about the ffmpeg-devel mailing list