-vn -c:a copy keeps the AAC track untouched in an M4A; -q:a 2 makes an MP3 about half that size, and a 16 kHz mono MP3 at 32 kbit/s about a sixth. ReelSDK's free video to MP3 converter does it in your browser, the API for $0.02 per compute minute.
Extract audio from a video with ffmpeg
Copying needs no decode, but an MP3 means re-encoding: libmp3lame's -q:a runs 0 to 9, and 0 to 3 are normally transparent. Sent to ReelSDK, the -q:a 2 MP3 of an 11-second clip came back about 3 seconds after the request.
GuidesUpdated
ffmpeg -i in.mp4 -vn -c:a copy audio.m4a-vn drops the video and -c:a copy writes the AAC packets unchanged into an M4A file. Nothing is decoded, so it is fast and lossless.
Variations
The other commands you will need
Convert to MP3
libmp3lame re-encodes the track.
-q:a 2is variable bitrate at high quality; on our voice track it averaged about 98 kbit/s, and the file came out about half the size of the copied AAC.mp3 ffmpeg -i in.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3Small mono file for speech
-ac 1mixes down to mono and-ar 16000resamples to 16 kHz. At 32 kbit/s the file is a third the size of the MP3 above, and the words stay clear.speech mp3 ffmpeg -i in.mp4 -vn -ac 1 -ar 16000 \ -c:a libmp3lame -b:a 32k speech.mp3Uncompressed WAV for an editor
pcm_s16leis plain 16-bit PCM. It is the largest option, about 2 MB for 11 seconds, but every editor and DAW opens it.wav ffmpeg -i in.mp4 -vn -c:a pcm_s16le audio.wav
The flags
The flags in these commands
| Flag | What it does | Used here |
|---|---|---|
-vn | As an output option, leaves every video stream out | All four |
-c:a copy | Copies the audio packets without decoding them | M4A |
-c:a libmp3lame | Encodes MP3 with LAME; ffmpeg has no native MP3 encoder | MP3 files |
-q:a 2 | LAME variable bitrate, 0 to 9, lower is better, 4 is the default | MP3 |
-b:a 32k | Constant bitrate instead of a quality level | Speech MP3 |
-ac 1 | Sets the channel count; 1 mixes down to mono | Speech MP3 |
-ar 16000 | Resamples to the given rate in Hz | Speech MP3 |
-c:a pcm_s16le | Uncompressed 16-bit little-endian PCM | WAV |
-map 0:a:1 | Picks one audio track by index, counting from 0 | Files with two tracks |
Sources: ffmpeg documentation, FFmpeg MP3 encoding guide, checked November 2026.
Copy or re-encode: the container decides
Our input is an 11-second demo clip: H.264 video with an AAC stereo track at 48 kHz. AAC fits in M4A, MKA or MP4, so -c:a copy into audio.m4a works and keeps every bit of the original track.
An MP3 file can only hold MP3. Copying the AAC stream into copy.mp3 fails before a single packet is written:
Invalid audio stream. Exactly one MP3 audio stream is required.
So for MP3 you re-encode, and that costs some quality. If you only need the audio in a file of its own, copy it into M4A instead.
MP3 quality: -q:a or -b:a
-q:a sets a LAME quality level and lets the bitrate move with the audio. The FFmpeg MP3 guide calls 0 to 3 normally transparent and lists -q:a 2 at about 190 kbit/s on average. Our narration averaged about 98 kbit/s at that level, half that figure, because quiet speech needs fewer bits than music.
-b:a fixes the bitrate instead. At -b:a 192k the same narration came out almost twice the size of the -q:a 2 file. Use a fixed bitrate only when a player or upload form asks for one.
Files with more than one audio track
Without -map, ffmpeg chooses the audio stream with the most channels, and on a tie the one with the lowest index. On a file with two stereo tracks that is always the first one.
To get another track, map it by index. On a test file with music as track 0 and the original voice as track 1, -map 0:a:1 -c copy wrote the voice track and left the music out.
ffmpeg -i two.mp4 -map 0:a:1 -c copy original.m4aWithout installing ffmpeg
The same command as one API call
Send the same args to POST /v1/ffmpeg with the video URL in inputs and the file to keep in outputs. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this MP3 finished about 3 seconds after the request and cost under a fifth of a cent.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"in.mp4": "https://api.reelsdk.com/f/lib/demo/clip.mp4"
},
"args": ["-i", "in.mp4", "-vn", "-c:a", "libmp3lame", "-q:a", "2", "audio.mp3"],
"outputs": ["audio.mp3"]
}'
FAQ
Questions, answered
How do I convert an MP4 to MP3 with ffmpeg?
Run ffmpeg -i in.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3. -vn drops the video and -q:a 2 asks LAME for high-quality variable bitrate. For a voice track that gives a file about half the size of the original AAC.
Why does -c:a copy fail when I write an .mp3 file?
Because the MP3 container only holds MP3 audio, and most MP4 files carry AAC. ffmpeg stops with "Invalid audio stream. Exactly one MP3 audio stream is required." Copy into .m4a instead, or re-encode with libmp3lame.
Does extracting audio lose quality?
Not with -c:a copy: the packets are written unchanged. Converting to MP3 is lossy, though the FFmpeg MP3 guide calls -q:a 0 to 3 normally transparent.
Can I extract audio from a video without installing ffmpeg?
Yes. Send the same args to POST https://api.reelsdk.com/v1/ffmpeg with the video URL in inputs and audio.mp3 in outputs. It runs ffmpeg 8.1 on a fresh machine per job for $0.02 per compute minute, billed per second with a 1-second minimum, and failed jobs are free.
- Video to MP3Pull the audio track out of any video as an MP3 with one ffmpeg call, under a tenth of a cent for a 30 s clip.
- Video to MP3 converterSave the sound of any video as an MP3 in your browser, free and without uploading it, or do the same with one API call.
- Replace the audio in a video with ffmpegSwap a video's soundtrack for another file with -map and -shortest, keep the picture untouched, and pad audio that runs short.
- Remove audio from a video with ffmpegStrip the sound from a video with -an while the picture is copied bit for bit, or drop one track, mute a range or add silence.
- Normalize audio loudness with ffmpeg loudnormBring any track to a loudness target such as -14 LUFS with loudnorm: one pass, or a measured second pass that keeps the dynamics.
- Make an audio waveform with ffmpegDraw a waveform PNG with showwavespic or a moving audiogram video with showwaves, in the exact color you ask for.
- Trim a video with ffmpegCut a clip with -ss and -to: frame-exact with a re-encode, fast with -c copy, and why the copy starts before your time.
- Video to SRT APISend a video URL and get SRT and VTT subtitle files, a word-timed transcript and a captioned copy of the video back.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
