mediacodec.dev

Extract audio from video

The fastest extraction is no conversion at all: copy the audio stream out of the container untouched. Convert only when you need a specific format: every lossy-to-lossy conversion costs a little quality.

Output format

-c:a

Stream copy (-c:a copy): lossless and near-instant. MP4s usually carry AAC, which belongs in an .m4a file; check with ffprobe if unsure.

Copy keeps the original codec bit-for-bit and finishes in about a second. The other options decode and re-encode into the format you pick.

Your command

ffmpeg -i input.mp4 -vn \
  -c:a copy \
  output.m4a

Worth knowing

-vn drops the video stream entirely; only audio reaches the output.

For stream copy, the file extension must match the codec inside: AAC → .m4a, MP3 → .mp3, Opus → .opus. ffprobe input.mp4 tells you what you have.

Going lossy → lossy (say AAC → MP3) always costs some quality. Copy when you can, convert when you must.

Run this on your own file

no FFmpeg · runs in this tab

The command above needs FFmpeg on a machine. The settings it encodes do not: your browser can perform the same operation on a real file, right here, through WebCodecs.

Drop a video or audio file here, or

Files are processed in this tab and never uploaded.

True -c:a copy has no reliable browser equivalent (AAC encoder-delay timestamps force a re-encode), so this run re-encodes to AAC 128k. The command itself is genuinely lossless and near-instant.

Waiting on a file.