Opened 11 years ago

Closed 10 years ago

#2697 closed defect (wontfix)

MP3 output duration incorrect in OS X

Reported by: llogan Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mp3 osx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Quicktime Player 10.2 (603.17) and Finder 10.8.3 on OS X 10.8.4 report duration as 5:43 instead of 5:00 when using default settings. iTunes 11.0.4 reports proper duration.

Command lines and outputs from a Linux machine.

$ ./ffmpeg -f lavfi -i sine=d=300 duration.mp3
ffmpeg version N-54122-g03cd3be Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 20 2013 12:18:56 with gcc 4.8.1 (GCC)
  configuration: --prefix=/home/lrcd/ffmpeg_build --extra-cflags=-I/home/lrcd/ffmpeg_build/include --extra-ldflags=-L/home/lrcd/ffmpeg_build/lib --bindir=/home/lrcd/bin --extra-libs=-ldl --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-nonfree
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  9.100 / 55.  9.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'sine=d=300':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, mp3, to 'duration.mp3':
  Metadata:
    TSSE            : Lavf55.9.100
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
size=    2344kB time=00:05:00.01 bitrate=  64.0kbits/s    
video:0kB audio:2344kB subtitle:0 global headers:0kB muxing overhead 0.009415%

If -ab is added with a value at or below 52k for this example then time will begin to vary. With Finder, 53k results in 5:00, 52k results in 4:17, and 32k results in 2:51 (I don't have the commands and outputs for these). If output is piped then the duration is correct in Finder and Quicktime.

$ ./ffmpeg -f lavfi -i sine=d=300 -f mp3 - >duration-pipe.mp3
ffmpeg version N-54122-g03cd3be Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 20 2013 12:18:56 with gcc 4.8.1 (GCC)
  configuration: --prefix=/home/lrcd/ffmpeg_build --extra-cflags=-I/home/lrcd/ffmpeg_build/include --extra-ldflags=-L/home/lrcd/ffmpeg_build/lib --bindir=/home/lrcd/bin --extra-libs=-ldl --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-nonfree
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  9.100 / 55.  9.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'sine=d=300':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, mp3, to 'pipe:':
  Metadata:
    TSSE            : Lavf55.9.100
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
size=    2344kB time=00:05:00.01 bitrate=  64.0kbits/s    
video:0kB audio:2344kB subtitle:0 global headers:0kB muxing overhead 0.001833%

Quicktime Player 7.7.4 for Windows shows the correct times for these files. I have not yet checked for a regression and may not have a chance to test on this borrowed Apple computer.

Change History (4)

comment:1 by Carl Eugen Hoyos, 11 years ago

Please test if it works when using lame:

$ ./ffmpeg -f lavfi -i sine=d=300 out.wav
$ lame -b64 out.wav duration.mp3

comment:2 by llogan, 11 years ago

On another machine running OS X 10.5.8 the file created by lame shows the correct duration (the same "wrong" files still have incorrect [but different] durations).

comment:3 by llogan, 11 years ago

Component: undeterminedavformat
Keywords: osx added

Using -write_xing 0 results in an output that allows Finder and Quicktime to report the correct duration.

$ ./ffmpeg -f lavfi -i sine=d=300 -write_xing 0 duration.mp3
ffmpeg version N-60686-gc919e1c Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 16 2014 14:02:16 with gcc 4.8.2 (GCC) 20140206 (prerelease)
  configuration: --enable-gpl --enable-libmp3lame
  libavutil      52. 64.100 / 52. 64.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55.  9.101 / 55.  9.101
  libavfilter     4.  1.102 /  4.  1.102
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'sine=d=300':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, mp3, to 'duration.mp3':
  Metadata:
    TSSE            : Lavf55.33.100
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
size=    2344kB time=00:05:00.01 bitrate=  64.0kbits/s    
video:0kB audio:2344kB subtitle:0 data:0 global headers:0kB muxing overhead 0.001875%

comment:4 by Carl Eugen Hoyos, 10 years ago

Resolution: wontfix
Status: newclosed

Related report:
http://thread.gmane.org/gmane.comp.video.ffmpeg.user/54373
The only way to fix this issue is to change the default for -write_xing to 0, this should be discussed on the developer mailing list.

Note: See TracTickets for help on using tickets.