FFMPEG cant convert MP4 to MP3 | No MP3 Encoder

by lukay97   Last Updated September 27, 2017 13:02 PM

I'm facing the problem that I cant convert MP4 Videos to MP3 with FFMPEG. Every time I try it, I get this error:

Unknown encoder 'libmp3lame'

But I installed FFMPEG and LAME with the flags: --enable-libmp3lame

So when I'm running: ffmpeg -codecs help | grep 'mp3' in the console I see that the Flags are set but in the list there is still no libmp3lame like it should be:

  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
 //HERE SHOULD BE LIBMP3LAME
 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 

As someone metioned in this Ubuntu Thread

lame packages won't add mp3 encoding to FFmpeg

So how can I install libmp3lame on Debian so FFMPEG can use it?

Also I already tried to install libmp3lame0 from Debian Packages but that also didnt change anything.

Tags : ffmpeg debian lame


Answers 1


Perhaps your build is broken. Try uninstalling and then installing it using the following method

First install dpendencies

 sudo apt-get update
 sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
  libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
  libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev

Now make a directory for the source files that will be downloaded later

mkdir ~/ffmpeg_sources

Now install this assembler for x86 optimizations used by x264 and FFmpeg

cd ~/ffmpeg_sources
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install

Then install libmp3lame

cd ~/ffmpeg_sources
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
make
make install

Then install ffmpeg

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-nonfree
PATH="$HOME/bin:$PATH" make
make install
hash -r

You may have to restart your device as it sometimes doesn't work otherwise. After installing go to the directory ~/bin

cd ~/bin

then in that directory try to run your command for eg.

./ffmpeg -i ~/input.mp4 ~/videos/output.mkv

PS:In your question where you've mentioned

//HERE SHOULD BE LIBMP3LAME

libmp3lame will not be there, rather it will be mentioned in the configuration as

configuration: --enable-libmp3lame

Do let me know if it works or not. :)

Sankalp Gupta
Sankalp Gupta
October 02, 2017 06:01 AM

Related Questions


Converting mp4 to mp3

Updated December 31, 2016 08:00 AM

Why is my Lame install failing?

Updated March 01, 2017 12:02 PM