Understanding audio extraction
The audio stream, copied out of the container.
What "extract the audio from this video" actually does, the container-vs-codec distinction, and why the right output format depends on what's already inside.
Container vs codec.
A video file like an MP4 isn't a single thing — it's a container with multiple streams inside. Typically: one video stream (H.264 / H.265 / AV1), one audio stream (AAC / MP3 / Opus), maybe subtitle tracks, maybe metadata. The container is the envelope; each codec is the bytes inside. Extracting audio means pulling the audio stream out of the envelope and either putting it in a new container or saving it raw.
Two ways: copy or re-encode.
Stream-copy: extract the audio frames as they exist in the source, wrap in a new container appropriate for the codec. No quality loss, near-instant operation. AAC audio from an MP4 lands in an .m4a file; MP3 audio in an MP4 (rare) lands in an .mp3. The downside is you get whatever format the source had; if that's AAC and you wanted MP3, you need the second mode. Re-encode: decode the audio stream, re- encode in the target format. Slow, one generation of lossy degradation, output is whatever you asked for.
A worked extraction.
A 30-minute MP4 podcast recording. Inspect with FFmpeg: video stream is H.264, audio is AAC 128kbps. Extract with stream-copy: ffmpeg -i podcast.mp4 -vn -c:a copy podcast.m4a — -vn drops the video, -c:a copy copies the audio without re-encoding. Runtime: about a second. To get MP3 instead: ffmpeg -i podcast.mp4 -vn -c:a libmp3lame -b:a 192k podcast.mp3 — about a minute, lossy re-encode.
Stream-copy AAC → m4a
-vn -c:a copy
Drop video, copy audio bytes verbatim into a new container.
ffmpeg -i in.mp4 -vn -c:a copy out.m4a
= Sub-second, lossless
Re-encode → MP3
-vn -c:a libmp3lame -b:a 192k
Decode AAC, encode MP3 at 192 kbps.
ffmpeg -i in.mp4 -vn -c:a libmp3lame -b:a 192k out.mp3
= ~1 minute, one generation lossy
Multiple audio tracks.
Some video files have multiple audio streams — different languages, director's commentary, descriptive audio for accessibility. ffprobe on the file lists them; pick the right one with -map 0:a:0 (first audio stream) or -map 0:a:1 (second). For non-trivial files, always inspect first; a default extraction grabs whichever stream happens to be first and silently ignores the others.
When to bother.
Useful for: extracting a podcast's audio from a YouTube source for offline listening; pulling background music from a video to identify it; isolating a dialogue track for transcription; converting a video recording of a meeting into a podcast format. Not useful for: making the video file smaller (the audio is rarely the bulk of the size); avoiding the video codec (you can play MP4s with just the audio anyway in most players); pretending video doesn't exist (a separate audio file is fine to share but doesn't replace the original).
Browser caveats.
ffmpeg.wasm in the browser handles audio extraction the same way the desktop tool does — same flags, same output. The first run is slow because the wasm binary is ~20MB; subsequent runs hit the cached binary. For very large files (multi-gigabyte video), the browser's memory limits can matter; streaming the extraction in chunks handles it, but adds complexity. For most podcast-length content, "open file → download audio" works in under a minute end-to-end.