如何使用ffmpeg获得没有任何失真的mp3输出?
我正在使用https://www.johnvansickle.com/ffmpeg/(x86_64 build)提供的静态构建在AWS Lambda linux上使用ffmpeg。
运行以下命令后,mp3输出可怕的剪辑/失真。
ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3
修改:这是我使用的示例文件:
http://www.brainybetty.com/FacebookFans/Feb112010/strings.wav
以下是来自Lambda的日志:
Executing command '/tmp/ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3' ...
STDERR:
ffmpeg version 3.4.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enab
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[wav @ 0x4bbdf40] parser not found for codec pcm_s16le, packets or times may be invalid.
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '/tmp/ick_20180323005225.wav':
Duration: 00:00:05.00, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[graph_0_in_0_0 @ 0x4bc64e0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[format_out_0_0 @ 0x4bc6360] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[auto_resampler_0 @ 0x4bd2ee0] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz
Output #0, mp3, to '/tmp/ick_20180323005225-opa.mp3':
Metadata:
TSSE : Lavf57.83.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, delay 1105
Metadata:
encoder : Lavc57.107.100 libmp3lame
size= 11kB time=00:00:00.73 bitrate= 119.5kbits/s speed=1.41x
size= 23kB time=00:00:01.67 bitrate= 114.5kbits/s speed=1.61x
size= 36kB time=00:00:02.61 bitrate= 113.4kbits/s speed=1.65x
size= 48kB time=00:00:03.55 bitrate= 111.0kbits/s speed=1.69x
size= 60kB time=00:00:04.46 bitrate= 109.6kbits/s speed=1.71x
No more output streams to write to, finishing.
size= 67kB time=00:00:05.01 bitrate= 108.9kbits/s speed=1.75x
video:0kB audio:66kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.371917%
Input file #0 (/tmp/ick_20180323005225.wav):
Input stream #0:0 (audio): 216 packets read (881988 bytes); 216 frames decoded (220497 samples);
Total: 216 packets (881988 bytes) demuxed
Output file #0 (/tmp/ick_20180323005225-opa.mp3):
Output stream #0:0 (audio): 192 frames encoded (220497 samples); 193 packets muxed (68026 bytes);
Total: 193 packets (68026 bytes) muxed
Executed command '/tmp/ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3' with code: 0.