The sound in a video is already a finished audio file, packed in next to the picture. Getting it out is a matter of copying that stream into a file of its own. You don't need to convert anything unless you want a different format, and copying is instant and loses nothing.
The sound from an MP4, saved as an MP3 in the browser.
First ask what the audio is:
ffprobe -v error -select_streams a -show_entries stream=codec_name,sample_rate,channels -of default=noprint_wrappers=1 video.mp4
codec_name=aac
sample_rate=44100
channels=2
Then copy it into a file that holds that codec. AAC goes in .m4a:
ffmpeg -i video.mp4 -vn -c:a copy audio.m4a
-vn drops the video, and -c:a copy keeps the audio bytes as they are. On an
8-second clip it took 0.02 seconds, and the result decodes to exactly the same
samples as the audio in the video.
Install it with brew install ffmpeg on a Mac, apt install ffmpeg on Debian
and Ubuntu, or from ffmpeg.org on Windows.
Pick the file type from the codec
Copying changes only the wrapper, so the wrapper has to accept the audio that
is already there. This is what FFmpeg 8.1.2 did with -vn -c:a copy on our
test files:
| ffprobe says | Copy into | Result |
|---|---|---|
aac (most MP4, MOV and phone video) |
.m4a |
Works, identical audio |
aac |
.mp3 |
Fails: "Exactly one MP3 audio stream is required" |
aac |
.aac |
Works, but plays 23 ms of encoder padding first |
opus (most WebM, many downloads) |
.opus |
Works, identical audio |
opus |
.m4a |
Fails: "codec not currently supported in container" |
mp3 |
.mp3 |
Works |
mp3 |
.m4a |
Fails |
ac3 (some MKV and DVD rips) |
.ac3 |
Works |
| anything | .mka |
Works: Matroska audio takes any codec |
The .aac row is a quiet one. An MP4 carries a note telling the player to skip
the encoder's 1,024 samples of start-up padding, and a bare .aac file has
nowhere to keep it. The copy is still lossless, but it starts 23 ms late, which
matters if you line it up with anything. Use .m4a.
When the codec doesn't fit, ffmpeg stops with "Could not write header" but has
already created the output file, at 0 bytes. Delete it before you try again,
or you will find a silent audio.mp3 in the folder later.
Already on a Mac: QuickTime Player
Open the video in QuickTime Player and choose File › Export As › Audio
Only. Apple's export guide
describes the result as an MPEG-4 audio file with an AAC track, so you get an
.m4a.
We didn't click through the menu for this guide. We did run avconvert, the
command-line exporter that ships with macOS, with its Apple M4A preset on macOS
26.5.1. For the AAC clip it kept the audio as it was: the .m4a decoded to the
same samples as the ffmpeg copy. It couldn't open the WebM at all, so
expect the same of QuickTime for a WebM with Opus audio: use ffmpeg or the
browser tool.
When you want MP3 or WAV
Sometimes the copy isn't what you need: an old car stereo wants MP3, or an editor or transcription app wants WAV. Then re-encode, from the video itself rather than from a copy you already compressed:
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3 # MP3, variable bitrate
ffmpeg -i video.mp4 -vn -c:a pcm_s16le audio.wav # WAV, 16-bit
ffmpeg -i video.mp4 -vn -c:a flac audio.flac # FLAC, lossless
The same 8-second clip, whose audio is 131 kbps AAC, came out like this:
| Output | Size | Audio |
|---|---|---|
-c:a copy to .m4a |
133 KB | The original AAC, untouched |
MP3, -q:a 2 |
123 KB | Compressed a second time |
| MP3, 192 kbps (the browser tool's default settings) | 194 KB | Compressed a second time |
| FLAC | 1.0 MB | Lossless copy of the decoded sound |
| WAV | 1.4 MB | Lossless, uncompressed |
A higher bitrate can't restore what the first compression threw away, so a 192 kbps MP3 of 131 kbps audio is bigger without being better. WAV and FLAC keep everything that is left, at eight to ten times the size. Which format to pick for which job is in How to convert audio and video formats.
More than one audio track
A film or a recording from a game capture can carry several tracks: languages,
a commentary, the microphone on its own. ffprobe lists them in order. Pick one
with -map 0:a:N, counting from 0:
ffmpeg -i film.mkv -map 0:a:1 -c copy commentary.opus
Without -map, ffmpeg takes the one it thinks is best (usually the one with the
most channels) and ignores the rest. The browser tool does the same, and has no
way to pick another.
If there is no audio at all
If ffprobe prints nothing, the video has no sound to extract. Screen recordings are the usual case: the recorder had system audio and the microphone switched off. ffmpeg says "Output file does not contain any stream". The browser tool currently reports only "Something went wrong while extracting the audio" for such a file, and Try again won't help. Record it again with sound on.
In the browser
The six output formats. Bitrate disappears for WAV and FLAC, which don't use one.
- Open Extract Audio from Video and drop in one or more videos (MP4, MOV, MKV, WebM, AVI and others).
- Under Select Output Audio Format, pick MP3 for anything that has to play everywhere, M4A for Apple devices, or WAV or FLAC to keep the full quality.
- Leave Quality at Medium Quality (192 kbps), or set a Bitrate (kbps) of your own. Sample Rate stays at Original unless you change it.
- Press Extract Audio from 1 File. The first run loads FFmpeg into the tab, then each file shows its progress.
- Press Download next to each file, or Download All as ZIP. The file
keeps the video's name with the new extension:
clip.mp4becomesclip.mp3.
Every format here is a re-encode, including M4A and AAC from a video that
already has AAC audio. For a lecture or a voice memo the second compression
rarely matters. For music you care about, choose FLAC, or use the -c:a copy
command above.