Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried to convert a m4a file to mp3 with ffmpeg, with the following simplest command:

ffmpeg -i in.m4a out.mp3

After conversion, the duration seems weird. The original m4a was 4:06. But for the new mp3, OS X Finder and Google Play report 09:24, while iTunes still reports the correct 4:06.

I think I also encountered this problem several times before. Why is this? Any fix?

Below is the console output of ffmpeg, in case it will do some help.

$ffmpeg -i in.m4a out.mp3
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 12 2013 13:46:11 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb7a4013000] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb7a4013000] max_analyze_duration 5000000 reached at 5015510 microseconds
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.m4a':
  Metadata:
    major_brand     : M4A 
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 2013-06-14 07:36:47
    title           : 小手拉大手
    artist          : 梁静茹
    album_artist    : 梁静茹
    album           : 亲亲
    genre           : Pop
    track           : 7/12
    disc            : 1/1
    date            : 2006
    gapless_playback: 0
    encoder         : iTunes 11.0.4
  Duration: 00:04:06.75, start: 0.000000, bitrate: 804 kb/s
    Stream #0:0(und): Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s16, 800 kb/s
    Metadata:
      creation_time   : 2013-06-14 07:36:47
    Stream #0:1: Video: png, rgba, 230x230, 90k tbr, 90k tbn, 90k tbc
[mp3 @ 0x7fb7a4044200] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, mp3, to 'out.mp3':
  Metadata:
    major_brand     : M4A 
    minor_version   : 0
    compatible_brands: M4A mp42isom
    gapless_playback: 0
    TIT2            : 小手拉大手
    TPE1            : 梁静茹
    TPE2            : 梁静茹
    TALB            : 亲亲
    TCON            : Pop
    TRCK            : 7/12
    TPOS            : 1/1
    TDRL            : 2006
    TSSE            : Lavf54.63.104
    Stream #0:0: Video: png, rgba, 230x230, q=2-31, 200 kb/s, 90k tbn, 90k tbc
    Stream #0:1(und): Audio: mp3, 44100 Hz, stereo, s16p
    Metadata:
      creation_time   : 2013-06-14 07:36:47
Stream mapping:
  Stream #0:1 -> #0:0 (png -> png)
  Stream #0:0 -> #0:1 (alac -> libmp3lame)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:26.54 bitrate=   0.1kbits/sframe=    1 fps=1.0 q=0.0 size=       0kB time=00:00:53.57 bitrate=   0.0kbits/sframe=    1 fps=0.7 q=0.0 size=       0kB time=00:01:19.93 bitrate=   0.0kbits/sframe=    1 fps=0.5 q=0.0 size=       0kB time=00:01:47.07 bitrate=   0.0kbits/sframe=    1 fps=0.4 q=0.0 size=       0kB time=00:02:13.90 bitrate=   0.0kbits/sframe=    1 fps=0.3 q=0.0 size=       0kB time=00:02:40.57 bitrate=   0.0kbits/sframe=    1 fps=0.3 q=0.0 size=       0kB time=00:03:06.01 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 size=       0kB time=00:03:31.56 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 size=       0kB time=00:03:57.66 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 Lsize=    3974kB time=00:04:06.75 bitrate= 131.9kbits/s    
video:118kB audio:3856kB subtitle:0 global headers:0kB muxing overhead 0.012681%
share|improve this question
    
1.2.1 is the most recent release available, but can you try a more recent git snapshot? There are ffmpeg builds for OS X available from Tessus, so no need to recompile. You may also see if the "video" stream (the album art) is related to the issue: ffmpeg -i in.m4a -an out.mp3 –  LordNeckbeard Jun 14 '13 at 17:24
    
@LordNeckbeard Thanks for the help. Unfortunately, I removed the artwork and used the most recent snapshot, but the output is still 9:24 :( –  ksh Jun 14 '13 at 18:18
    
Ok, thanks for testing. Can you provide a sample input file? I'd like to try to reproduce the issue. This is possibly a known bug, but I haven't yet trawled the FFmpeg bug tracker. Also, can you specify your OS X, Google Play, and iTunes versions? –  LordNeckbeard Jun 14 '13 at 18:54
    
@LordNeckbeard Thanks. Here's the Google Drive link to the input file. I'm using OS X 10.8.4 with iTunes 11.0.4, and Google Play web (not Android). –  ksh Jun 14 '13 at 20:21
1  
This is now ticket #2697: MP3 output duration incorrect in OS X. –  LordNeckbeard Jun 23 '13 at 20:48
add comment

1 Answer 1

up vote 0 down vote accepted

According to #2697: MP3 output duration incorrect in OS X, using the -write_xing 0 option solves the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.