ffmpeg 的音频时长错误

ffmpeg 的音频时长错误

我尝试使用 ffmpeg 将 m4a 文件转换为 mp3,使用以下最简单的命令:

ffmpeg -i in.m4a out.mp3

转换后,时长似乎很奇怪。原始 m4a 为 4:06。但对于新 mp3,OS X Finder 和 Google Play 报告 09:24,而 iTunes 仍然报告正确的 4:06。

我想我以前也遇到过几次这个问题。这是为什么?有解决办法吗?

下面是的控制台输出ffmpeg,希望它能有所帮助。

$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%

答案1

根据#2697: OS X 中的 MP3 输出持续时间不正确,使用该-write_xing 0选项可解决问题。

相关内容