FFmpeg: Extract Audio Without Re-Encoding (And Why the Extension Matters)

Sep 19, 2026

Pulling the audio track out of a video does not require re-encoding it. FFmpeg can copy the existing audio packets straight into a new container — no decode, no encode, no quality loss, and it finishes in about the time it takes to read the file.

The command is short. The thing that actually causes failures is choosing an output extension the audio codec cannot live in.

The command

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

Three parts do the work:

  • -vn drops the video.
  • -c:a copy copies the audio stream instead of encoding it.
  • The output extension picks the container — and this is the part that has to match what is actually inside.

Why this is lossless, in FFmpeg's own words

This is not a community claim. FFmpeg's documentation describes stream copy directly, under "Streamcopy":

"The simplest pipeline in ffmpeg is single-stream streamcopy, that is copying one input elementary stream's packets without decoding, filtering, or encoding them."

And on what that buys you:

"Streamcopy is useful for changing the elementary stream count, container format, or modifying container-level metadata. Since there is no decoding or encoding, it is very fast and there is no quality loss."

"There is no quality loss" is the official guarantee, and it is the entire reason to prefer this over converting to MP3. If your source is AAC and you "extract to MP3," you have decoded AAC and re-encoded it as MP3 — a second lossy generation, for no benefit. Copying keeps the exact bytes that were already there.

Note the stated scope, though. Stream copy changes stream count, container, and container-level metadata. It cannot change the codec, the sample rate, the channel layout, or apply any filter. The moment you want any of those, you are re-encoding and the guarantee no longer applies.

Step one is finding out what is inside

Because the container has to accept the codec, you need to know the codec before you pick the extension. Ask FFmpeg:

ffprobe input.mp4

Look for the line describing the audio stream — it names the codec. Then match:

Audio codec in the fileOutput extension that works
AAC.m4a (or .aac)
MP3.mp3
Opus.opus
Vorbis.ogg
FLAC.flac
AC-3.ac3
PCM.wav

Guessing here is what produces the error everyone hits. Copy an AAC stream into a .ogg and FFmpeg refuses, because that container does not carry AAC. The message names a muxer problem, which reads as obscure until you know the rule: -c:a copy means the container must already be able to hold what you have.

MP4-family files most often hold AAC, which is why .m4a is the safe default for anything shot on a phone or exported from a typical editor. But check rather than assume — a .mkv in particular can hold almost anything.

If you do not want to install FFmpeg

The command line is the right tool if you are scripting this or doing it repeatedly. For one file, you can do the same job in the browser:

Try it right here

Runs in your browser. Your file is not uploaded anywhere.

Loading tool…

This runs FFmpeg compiled to WebAssembly inside your tab. The file is read from disk, processed locally, and handed back — nothing is uploaded. It is the same engine, driven through a form instead of a shell.

The trade is honest: the browser tool re-encodes to a chosen format rather than exposing raw stream copy, so for a byte-exact extraction the command above is still the right call. For "I need the audio from this video and I do not care about the last few percent," the tool is faster to reach for. See all Clapr tools for the rest.

Picking specific streams

Files with multiple audio tracks — a second language, a commentary track, a separate microphone feed — need you to say which one.

ffmpeg -i input.mkv -map 0:a:1 -c:a copy second-track.m4a

-map 0:a:1 means "input 0, audio streams, index 1" — the second audio track, counting from zero.

FFmpeg's documentation flags something important about this option:

"When -map is used, only user-mapped streams are included in that output file, with one possible exception for filtergraph outputs."

That is an all-or-nothing switch, and it is worth internalising. As soon as you use -map even once, FFmpeg stops picking streams for you. Anything you did not explicitly map is silently absent from the output. If you map one audio track and expected the video to come along too, it will not — you have to map that as well.

Remove the audio, keep the video — copying both ways so nothing is re-encoded:

ffmpeg -i input.mp4 -c copy -an output.mp4

Extract a time range. Worth knowing the caveat: with stream copy, cuts land on packet boundaries rather than exact frames, so the start may be slightly off from what you asked for. If you need frame-exact cuts, you have to re-encode, and the lossless guarantee goes away.

ffmpeg -i input.mkv -ss 00:03:00 -t 00:00:20 -map 0:a:0 -c:a copy clip.m4a

A note on -vn

You will see -vn in almost every example, including the one at the top. FFmpeg documents it as an input/output option, and the description in the docs covers its behaviour as an input option:

"As an input option, blocks all video streams of a file from being filtered or being automatically selected or mapped for any output."

For the ordinary extract-audio case it does what you expect. For anything more involved — multiple inputs, multiple outputs — prefer explicit -map, which states exactly what you want rather than what you want excluded.

FAQ

Does extracting audio with FFmpeg reduce quality? Not with -c:a copy. FFmpeg's documentation states that because there is no decoding or encoding, "there is no quality loss." Extracting and converting — say, to MP3 — is a different operation and is lossy.

Why do I get an error about the muxer or codec not being supported? The output extension names a container that cannot hold your audio codec. Run ffprobe on the input, see what the codec actually is, and pick a matching extension — .m4a for AAC, .opus for Opus, and so on.

Should I extract to MP3? Only if something downstream specifically requires MP3. If the source is AAC, converting to MP3 adds a lossy generation and usually a larger file for the same perceived quality. Copy it as .m4a instead.

How do I extract all audio tracks at once? Map the audio stream group rather than one index: -map 0:a selects every audio stream. Remember that once -map appears, only what you map is included.

Why is the extracted clip slightly longer than I asked for? Stream copy cannot cut mid-packet, so time ranges snap to packet boundaries. Frame-exact trimming requires re-encoding.


Quotes from the FFmpeg documentation, sections "Streamcopy" and "Main options", checked 16 September 2026. For compressing rather than copying, see how to compress a video without losing quality; for container conversion, MOV to MP4.

Clapr team

Clapr team

FFmpeg: Extract Audio Without Re-Encoding (And Why the Extension Matters) | Clapr Blog