3

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.)

2 Answers2

4

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.

roadmr
  • 34,222
  • 9
  • 81
  • 93
  • mp3 does not seem to be supported. at least in ubuntu it only shows as Decoding, and not available as Encoding. – gcb Oct 02 '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 03 '13 at 14:49
1

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.

John Drake
  • 11
  • 1