FFmpeg – Can’t Convert FLAC to MP3

ffmpegflacmp3

How can I convert FLAC to MP3 using FFmpeg?

What I've tried:

ffmpeg -i "file.flac"  "file.mp3"

Stream mapping:
  Stream #0:0 -> #0:0 (flac -> ?)
Encoder (codec none) not found for output stream #0:0

file.mp3 is empty


ffmpeg -codecs | grep flac
ffmpeg version N-46093-g14f69a0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 28 2012 15:24:03 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-pic --enable-thumb --enable-libfaac --enable-gpl --enable-nonfree
  libavutil      52.  1.100 / 52.  1.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 35.100 / 54. 35.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.106 /  3. 20.106
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
 DEA..S flac                 FLAC (Free Lossless Audio Codec)


ffmpeg -codecs | grep mp3
ffmpeg version N-46093-g14f69a0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 28 2012 15:24:03 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-pic --enable-thumb --enable-libfaac --enable-gpl --enable-nonfree
  libavutil      52.  1.100 / 52.  1.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 35.100 / 54. 35.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.106 /  3. 20.106
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
 D.A.L. mp3                  MP3 (MPEG audio layer 3) (decoders: mp3 mp3float )
 D.A.L. mp3adu               ADU (Application Data Unit) MP3 (MPEG audio layer 3) (decoders: mp3adu mp3adufloat )
 D.A.L. mp3on4               MP3onMP4 (decoders: mp3on4 mp3on4float )

Best Answer

Your version of FFmpeg has no MP3 encoder. It can only decode, as indicated by the "D" in the command line output.

If you built it yourself, install LAME before — this depends on your distribution — and then reconfigure it --with-libmp3lame.

Or pick a static build from the FFmpeg download page.

This should give you access to the de facto standard MP3 encoder.

Related Question