All posts

MP3 to WAV via CLI

Decode MP3 to uncompressed PCM WAV with ffmpeg.

Open online converter

Packages to install

Only ffmpeg is required. pcm_s16le writes 16-bit little-endian WAV.

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

How to run the command

ffmpeg -i input.mp3 -vn -c:a pcm_s16le output.wav. -vn drops album art so the result is audio-only.

ffmpeg
ffmpeg -y -i input.mp3 -vn -c:a pcm_s16le output.wav

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 mp3-to-wav .
docker run --rm -v "$PWD:/work" -w /work mp3-to-wav \
  ffmpeg -y -i input.mp3 -vn -c:a pcm_s16le output.wav

Example commands

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

Example 1
ffmpeg -y -i input.mp3 -vn -c:a pcm_s16le output.wav
Example 2
ffmpeg -y -i track.mp3 -vn -c:a pcm_s16le -ar 44100 -ac 2 track.wav