[FFmpeg-devel] [PATCH] Write Pixel Aspect Ratio tag to QuickTime files

Daniel Kristjansson danielk
Thu Jul 8 04:12:31 CEST 2010

On Wed, 2010-07-07 at 14:35 -0700, Baptiste Coudurier wrote:
> On 07/07/2010 02:17 PM, Daniel Kristjansson wrote:
> > It's required in the spec, p118 of qtfs.pdf, "Pixel aspect ratio. This
> > extension is mandatory for video formats that use non-square pixels."
> My specs say MPEG-4 and uncompresed YCbCr. Dated 2007-09-04

Mine is dated 2010-05-03.

> > The QuickTime player (shows 1440x1080 MPEG-2 material at 36:27 rather
> > than 16:9 without this. I did not test whether NTSC/PAL material is
> > played correctly.
> What kind of mpeg-2 using which codec ?
> Can you share a sample ?

ffmpeg -vframes 300 -i /mythtv/video1/2131_20100706083000.mpg \
       -r 30000/1001 -acodec pcm_s16le -async 1 -vcodec mpeg2video \
       -y -s 1440x1080 -aspect 16:9 -threads 3 -vtag xdv2 \
       -flags ildct+ilme -b 35M -bf 0 -ac 2 -ar 48000 pasp.mov


Admittedly both clips are unwatchable because there is no fiel
tag to tell the QuickTime player to do deinterlacing, but I haven't
figured out how to add that properly to movenc.c yet since the
interlacing info is located on the frames and not in the context.
For my purposes, I just write the fiel tag when the height != 720.

> > +    if (track->mode == MODE_MOV)
> > +        mov_write_pasp_tag(pb, track);
> Move the check for sample_aspect ratio here and don't write the atom if 
> it is not set or square.

In the attached the check is in both locations, so the
mov_write_pasp_tag() function can still be used to write
a 1:1 tag, but it doesn't do this by default now.

-- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov-pasp-v3.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100707/b2d9653f/attachment.bin>

More information about the ffmpeg-devel mailing list