9

I'm aware there are a couple of other questions here related to this, but the answers provided don't seem to work.

I'm trying to convert a webm to mp3 with avconv. Here's how I tried to do it:

 $ ls
test.webm
 $ avconv -acodec libmp3lame -i test.webm test.mp3
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
test.webm: End of file
 $ ls -l
total 4
-rw-rw-r-- 1 user user 439 Apr 28 09:16 test.webm

As you can see, I don't appear to get an error but my file is not created. Please note that I did install ubuntu-restricted-extras.

EDIT:

 $ avprobe test.webm 
avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
test.webm: End of file
# avprobe output

 $ avprobe -encoders|grep mp3
avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
A... libmp3lame           libmp3lame MP3 (MPEG audio layer 3) (codec mp3)
Juicy
  • 935

4 Answers4

8

The proper way to converting is :

ffmpeg -i test.webm -c:a libmp3lame test.mp3

or even shorter, without telling to avconv that you want use libmp3lame encoder.

ffmpeg -i test.webm test.mp3
EdiD
  • 4,617
  • 3
  • 27
  • 41
2

You can convert through this script:

for FILE in *.webm; do
    echo -e "Processing video '\e[32m$FILE\e[0m'";
    ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";
done;

Save it into a .sh file and execute it. It will automatically convert all the .webm into .mp3

1

You can convert WEBM videos to MP3 file using VLC Media Player. The open-source media player converts WEBM files for free.

Steps to convert WEBM to MP3 in VLC Media Player:

  1. Open VLC Media Player on your computer
  2. On the top menu bar, click Media > Convert/Save.
  3. In Open Media, click Add to insert WEBM files.
  4. Click Convert/Save.
  5. Across Profile, select MP3 format.
  6. In the Convert box, browse to select location and name to save the MP3 audio file.
  7. Click Start to convert WEBM to MP3 file.

Once the conversion process completes, access your MP3 file from the saved location.

andrew.46
  • 39,359
0

I have found you need to specify that -acodecd parameter after the inpout and before the output. personally i also throw in -b:a "256k" to set the bitrate to 256k for the mp3.

avconv -i Mozart.webm -acodec libmp3lame -b:a "256k" Mozart.mp3