使用ffmpeg将.wav转换为.mp3需要什么编解码器?

时间:2011-09-18 23:45:58

标签: bash ffmpeg

我可以将.mp3文件转换为.wav文件。

me@me-desktop:~$ ffmpeg -i Desktop/input.mp3 Desktop/output.wav
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar 31 2011 18:53:20, gcc: 4.4.3
[mp3 @ 0x9449510]mdb:511, lastbuf:0 skipping granule 0
    Last message repeated 1 times
[mp3 @ 0x9449510]mdb:511, lastbuf:0 skipping granule 1
    Last message repeated 1 times
Input #0, mp3, from 'Desktop/input.mp3':
  Duration: 00:04:45.31, start: 0.000000, bitrate: 256 kb/s
    Stream #0.0: Audio: mp3, 48000 Hz, stereo, s16, 256 kb/s
Output #0, wav, to 'Desktop/output.wav':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
[mp3 @ 0x9449510]mdb:511, lastbuf:0 skipping granule 0
    Last message repeated 1 times
[mp3 @ 0x9449510]mdb:511, lastbuf:0 skipping granule 1
size=   42944kB time=229.03 bitrate=1536.0kbits/s    
video:0kB audio:42944kB global headers:0kB muxing overhead 0.000100%

但是,当我尝试将同一个.wav文件转换回.mp3时,我收到以下错误:输出流#0.0

的不支持的编解码器
me@me-desktop:~$ ffmpeg -i Desktop/output.wav Desktop/output2.mp3
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar 31 2011 18:53:20, gcc: 4.4.3
Input #0, wav, from 'Desktop/output.wav':
  Duration: 00:03:49.03, bitrate: 1536 kb/s
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, mp3, to 'Desktop/output2.mp3':
    Stream #0.0: Audio: 0x0000, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Unsupported codec for output stream #0.0

我已经尝试过根据上一个问题的建议安装unstripped-51但我仍然无法将.wav转换为.mp3

1 个答案:

答案 0 :(得分:7)

我建议使用lame

lame -b 192 -h input.wav output.mp3  # bitrate 192, highest quality

如果您没有,apt-get install lame

有关更多选项和/或示例,请参阅man lame