ffmpeg Unknown encoder ‘libmp3lame’

I was trying to convert a .flv file to mp3 when using the command ffmpeg -i video.flv -acodec libmp3lame -ab 196k -ac 2 -ar 44100 audio.mp3 came up with Unknown encoder ‘libmp3lame’. It was because I did not install the ffmpeg from source and in the binary the –enable-libmp3lame was not defined. Ps.: To see what options are enabled just ffmpeg –help

To solve this problem I did the following:

  • Installed the libmp3lame from source:
    wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.98.4.tar.gz; tar -xvf lame-3.98.4.tar.gz; cd lame-3.98.4;./configure; sudo make && make install
  • Removed the pre-compiled ffmpeg installation: apt-get remove ffmpeg
  • Downloaded its source: svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
  • Installed the source setting the –enable-libmp3lame option up: sudo ./configure –enable-libmp3lame; sudo make && make install
  • And ffmpeg -i video.flv -acodec libmp3lame -ab 192k -ac 2 -ar 44100 audio.mp3 command should works properly
ffmpeg -i video.flv -acodec libmp3lame -ab 196k -ac 2 -ar 44100 audio.mp3