id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
110	MP4 Muxer gives incorrect frame duration with AAC	thebombzen		"The frame durations of an MP4/AAC file are inaccurate according to FAAD. I encoded an M4A file with

ffmpeg -v 9 -loglevel 99 -i IJustHadSex.m4v -vn -acodec copy -map_metadata 0:0 ""I Just Had Sex.m4a""

The full uncut output is this:

FFmpeg version git-N-29123-g256c5b0, Copyright (c) 2000-2011 the FFmpeg developers
  built on Apr 14 2011 21:24:32 with gcc 4.7.0 20110402 (experimental)
  configuration: --enable-cross-compile --arch=x86_64 --target-os=mingw32 --cross-prefix=/usr/x86_64-w64-mingw32/bin/ --prefix=/usr/local/x86_64-w64-mingw32 --pkg-config=pkg-config --cpu=i7
  libavutil    50. 40. 1 / 50. 40. 1
  libavcodec   52.119. 0 / 52.119. 0
  libavformat  52.107. 0 / 52.107. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 78. 0 /  1. 78. 0
  libswscale    0. 13. 0 /  0. 13. 0
[NULL @ 000000000033A770] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000033A770] ISO: File Type Major Brand: M4V 
[h264 @ 000000000033B7B0] Unsupported bit depth: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000033A770] All info found

Seems stream 0 codec frame rate differs from container frame rate: 47.96 (1199/25) -> 23.98 (1199/50)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IJustHadSex.m4v':
  Metadata:
    major_brand     : M4V 
    minor_version   : 512
    compatible_brands: isomiso2avc1
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.104.0
    title           : I Just Had Sex (feat. Akon)
    artist          : The Lonely Island
    album           : Incredibad
  Duration: 00:02:55.31, start: 0.000000, bitrate: 1306 kb/s
    Stream #0.0(und), 2, 1/1199: Video: h264 (Constrained Baseline), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 25/1199, 1171 kb/s, 23.98 fps, 23.98 tbr, 1199 tbn, 47.96 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und), 1, 1/44100: Audio: aac, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Output #0, ipod, to 'I Just Had Sex.m4a':
  Metadata:
    major_brand     : M4V 
    minor_version   : 512
    compatible_brands: isomiso2avc1
    creation_time   : 1970-01-01 00:00:00
    album           : Incredibad
    title           : I Just Had Sex (feat. Akon)
    artist          : The Lonely Island
    encoder         : Lavf52.107.0
    Stream #0.0(und), 0, 1/44100: Audio: aac, 44100 Hz, stereo, 128 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Stream mapping:
  Stream #0.1 -> #0.0
Press [q] to stop encoding
size=    2845kB time=175.31 bitrate= 132.9kbits/s    

video:0kB audio:2739kB global headers:0kB muxing overhead 3.847214%

The full ffmpeg -v 9 -loglevel 99 -i for the new input file is this:

FFmpeg version git-N-29123-g256c5b0, Copyright (c) 2000-2011 the FFmpeg developers
  built on Apr 14 2011 21:24:32 with gcc 4.7.0 20110402 (experimental)
  configuration: --enable-cross-compile --arch=x86_64 --target-os=mingw32 --cross-prefix=/usr/x86_64-w64-mingw32/bin/ --prefix=/usr/local/x86_64-w64-mingw32 --pkg-config=pkg-config --cpu=i7
  libavutil    50. 40. 1 / 50. 40. 1
  libavcodec   52.119. 0 / 52.119. 0
  libavformat  52.107. 0 / 52.107. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 78. 0 /  1. 78. 0
  libswscale    0. 13. 0 /  0. 13. 0
[NULL @ 00000000014BA410] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000014BA410] ISO: File Type Major Brand: M4A 
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000014BA410] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'I Just Had Sex.m4a':
  Metadata:
    major_brand     : M4A 
    minor_version   : 512
    compatible_brands: isomiso2
    creation_time   : 1970-01-01 00:00:00
    title           : I Just Had Sex (feat. Akon)
    artist          : The Lonely Island
    album           : Incredibad
    encoder         : Lavf52.107.0
  Duration: 00:02:55.31, start: 0.000000, bitrate: 132 kb/s
    Stream #0.0(und), 1, 1/44100: Audio: aac, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
At least one output file must be specified

However, FAAD claims that the frame duration is inaccurate for the MP4, and that it has to use the duration listed in the AAC bitstream instead. Furthermore, iTunes says the file has a duration of 789:57:13, which is iTunes's way of saying Error!

The FAAD output is this:

 *********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************

 Build: Jun 14 2010
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

I Just Had Sex.m4a file info:

LC AAC	175.139 secs, 2 ch, 44100 Hz

title: I Just Had Sex (feat. Akon)
artist: The Lonely Island
album: Incredibad
tool: Lavf52.107.0

  ---------------------
 | Config:  2 Ch       |
  ---------------------
 | Ch |    Position    |
  ---------------------
 | 00 | Left front     |
 | 01 | Right front    |
  ---------------------

MP4 seems to have incorrect frame duration, using values from AAC data.
Decoding I Just Had Sex.m4a took:  0.84 sec. 208.00% real-time.

Notice the MP4 error.

This is important because iTunes won't play the resulting file."	defect	reopened	normal	avformat	git-master		aac mov				0	0
