FFmpeg recipe

FFmpeg: Extract Audio from an MP4 (Lossless)

Stream-copy extracts the audio without decoding/re-encoding. Bit-identical to the source. Container changes from MP4 to whatever the audio codec's native container is.

Command

ffmpeg -i input.mp4 -vn -c:a copy -y output.m4a
Prefer no terminal?
Use the Extract Audio in your browser
Open Extract Audio →

What each flag does

-iInput file. Can be a video, audio, or image. Repeat for multiple inputs.
-vnStrip video (no video in output) — useful for audio-only extraction.
-c:aAudio codec for output. e.g. aac, libmp3lame, copy.
-yOverwrite output file without confirmation.

Notes & gotchas

  • Most MP4 audio is AAC, so the output extension is .m4a (AAC in MP4 container).
  • For MP3 output, re-encode with -c:a libmp3lame -b:a 192k -y output.mp3.
  • For WAV output (lossless PCM), use -c:a pcm_s16le -y output.wav.

Check it worked

ffprobe -v error -show_entries stream=codec_name,channels,sample_rate -of csv=p=0 output.aac

The codec you asked for, with the channel count and sample rate matching the source.

What to change

-c copy means no quality lossThe audio is lifted out untouched. Re-encoding it to MP3 here would throw away quality for nothing.
The extension must match the codecAAC from an MP4 belongs in .m4a. Naming it .mp3 produces a file that many players refuse.
Check what is actually in thereffprobe first. Some files carry AC-3 or Opus, which need a different container again.

If it fails

Output file is empty or zero bytes.

Why: The input has no audio stream, which is common with screen recordings made without audio capture.

Fix: Check first with ffprobe. If there is no audio stream, there is nothing to extract.

The extension does not match what came out.

Why: -c:a copy keeps whatever codec the video held, which is usually AAC rather than the format your extension implies.

Fix: Either name the file to match the real codec, or re-encode explicitly with -c:a libmp3lame for an MP3.

Related recipes