This question already has an answer here:

I have about 20 .webm files that I would like to convert to audio in the terminal. I want to do

avconv -i *.webm -acodec libmp3lame0 -aq 4 *.mp3

I tried:

for i in *.webm; do avconv -i "${i}" -acodec libmp3lame0 -aq 4 "${i%.wemb}.mp3"; done

but it says "libmp3lame0 encoder not found." It is installed, though. I also installed ubuntu-restricted-extras and reinstalled libav-tools.

I also tried

for i in *.webm; do avconv -i "${i}" -acodec -aq 4 "${i%.wemb}.ogg"; done

to remove the whole mp3/LAME aspect, but then it just said '.ogg encoder not found.'

This worked once before when I tried to convert using libmp3lame0 without the for loop...but I just tried to convert one file and it doesn't work anymore.

Thanks. (I'm using 12.10.)

marked as duplicate by Eliah Kagan, Volker Siegel, LnxSlck, muru, mikewhatever Oct 6 '14 at 23:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You seem to be using the wrong codec name. To see which codecs are supported, do:

avconv -codecs

according to this the codec name is libmp3lame (you have an extra 0). This is on my system however, so yours may be different. The command I gave will let you find out.

  • mp3 does not seem to be supported. at least in ubuntu it only shows as Decoding, and not available as Encoding. – gcb Oct 2 '13 at 22:55
  • 1
    @gcb check that you have libmp3lame installed, I think this is needed for encoding. I do and in the list it shows "E" next to "libmp3lame". – roadmr Oct 3 '13 at 14:49

In many distros, avconv by default is not built with "--enable-libmp3lame". avconv must be compiled with MP3 support in order to utilize libmp3lame.

My working solution was to download libav from the git repo, and build it myself. This is the configure command line I used:

./configure --enable-libmp3lame --enable-nonfree --enable-gpl --enable-libx264

You can verify MP3 encoding support is or is not built into your avconv with this command line: avconv -codecs

You must see an "E" in the second column of features for MP3 encoding to work:

DEA.L. mp3 MP3 (MPEG audio layer 3) (decoders: mp3 mp3float ) (encoders: libmp3lame )

If the second column is "." MP3 encoding is not built into your avconv: "DEA.L." is good, "D.A.L" is bad.

  • On Ubuntu FFmpeg/avconv is compiled with libmp3lame. You just need to have libmp3lame installed on your system, which is not the default case in Ubuntu. – David Foerster Oct 3 '14 at 16:53
  • This is the correct solution. – shivams Jul 19 '15 at 6:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.