All posts

WMA to MP3 via CLI

Encode Windows Media Audio to MP3 with ffmpeg and libmp3lame.

Open online converter

Packages to install

Only ffmpeg is required. libmp3lame encodes MP3 at a constant bitrate.

ffmpeg
apt install
sudo apt-get update
sudo apt-get install -y ffmpeg

How to run the command

ffmpeg -i input.wma -vn -c:a libmp3lame -b:a 192k output.mp3. -vn drops extra streams so the result is audio-only.

ffmpeg
ffmpeg -y -i input.wma -vn -c:a libmp3lame -b:a 192k output.mp3

Dockerfile example

Build a minimal Ubuntu image with the required packages and run the conversion inside the container.

Dockerfile
FROM ubuntu:24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        ffmpeg && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work
docker build && docker run
docker build -t wma-to-mp3 .
docker run --rm -v "$PWD:/work" -w /work wma-to-mp3 \
  ffmpeg -y -i input.wma -vn -c:a libmp3lame -b:a 192k output.mp3

Example commands

Run these locally after installing the packages, or inside the container from the Dockerfile.

Example 1
ffmpeg -y -i input.wma -vn -c:a libmp3lame -b:a 192k output.mp3
Example 2
ffmpeg -y -i track.wma -vn -c:a libmp3lame -b:a 192k -ar 44100 -ac 2 track.mp3