Tentei converter um arquivo m4a para mp3 com ffmpeg, com o seguinte comando mais simples:
ffmpeg -i in.m4a out.mp3
Após a conversão, a duração parece estranha. O m4a original era 4:06. Mas para o novo mp3, o OS X Finder e o Google Play reportam 09:24, enquanto o iTunes ainda informa o 4:06 correto.
Eu acho que também encontrei esse problema várias vezes antes. Por que é isso? Alguma correção?
Abaixo está a saída do console de ffmpeg
, caso isso ajude.
$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%
ffmpeg -i in.m4a -an out.mp3
Respostas:
De acordo com # 2697: Duração da saída do MP3 incorreta no OS X , usar a
-write_xing 0
opção resolve o problema.fonte
-write_xing 0
antes do argumento do caminho do arquivo mp3.