MyTechBlog

How to Convert WEBM to MP3 in Linux Using ffmpeg, sox & More

Posted on April 2, 2025 • 3 views

What Is WEBM to MP3 Conversion?

WEBM is a video format mostly used for streaming, and MP3 is pure audio. Sometimes you just need the sound — to listen on your phone, player, or in the car. Below are several ways to extract audio from a WEBM file using Linux or online tools.

Why Convert WEBM to MP3?

Here’s when it might come in handy:

  • You only want the audio, not the video
  • Your player can’t handle WEBM
  • You need to pull out voice or speech
  • MP3s are smaller and easier to share

Method 1: ffmpeg

Install ffmpeg

Use your distro’s package manager:

sudo apt install ffmpeg        # Debian/Ubuntu
sudo dnf install ffmpeg        # Fedora
sudo pacman -S ffmpeg          # Arch Linux

Basic WEBM to MP3 conversion

ffmpeg -i input.webm -q:a 0 -map a output.mp3

Set a specific bitrate

ffmpeg -i input.webm -b:a 192k output.mp3

Cut out a portion of audio

ffmpeg -i input.webm -ss 00:00:30 -to 00:01:30 -q:a 0 -map a clip.mp3

Use the LAME MP3 encoder

ffmpeg -i input.webm -vn -acodec libmp3lame -q:a 4 output.mp3

Method 2: sox

Install and use sox like this:

sudo apt install sox libsox-fmt-all
sox input.webm output.mp3

Method 3: avconv

Another option using avconv:

sudo apt install libav-tools
avconv -i input.webm -q:a 0 -map a output.mp3

Online Converters (for the lazy or GUI fans)

Try these if you don’t want to touch a terminal:

  • Cloud Convert
  • Free Convert
  • Convertio

Check the MP3 file info

ffmpeg -i output.mp3
mediainfo output.mp3

Batch convert with a script

This script will convert all WEBM files in a folder:

for file in *.webm; do
  ffmpeg -i "$file" -q:a 0 -map a "${file%.webm}.mp3"
done

Then make it executable and run:

chmod +x convert-webm.sh
./convert-webm.sh

Conclusion

If you want an MP3 from a WEBM — ffmpeg is your best friend. Or use sox or avconv if you're feeling curious. Want it done fast and with clicks? Use an online tool. Either way, you get a clean MP3 ready for your playlist.