8

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
  • 865
  • 4
  • 12
  • 24

4 Answers4

4

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,327
  • 3
  • 23
  • 40
  • When I do that I get exactly the same output as above. No `mp3` file is created. – Juicy Apr 28 '16 at 13:18
  • @Juicy is this webm file playing correctly? Paste output of `avprobe test.webm` and `avprobe -encoders|grep mp3` – EdiD Apr 28 '16 at 15:24
  • I've edited my question with the output of `avprobe`. This is weird :-/ – Juicy Apr 29 '16 at 08:14
  • @Juicy something wrong with file ? What about different ? download another webm and try. I have just converted webm to mp3 in 14.04 with the same version of `avconv` you have. If nothing you can download and compile the latest `ffmpeg` version from: https://ffmpeg.org/download.html – EdiD Apr 29 '16 at 08:44
  • To be clearly stated:you can **replace** the executable `avconv` by `ffmpeg`. – Rudy Vissers Feb 27 '23 at 09:46
1

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

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
0

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
  • 37,085
  • 25
  • 149
  • 228