-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

copy to m4a
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

  1. Convert to MP3

    libmp3lame re-encodes the track. -q:a 2 is 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.mp3
  2. Small mono file for speech

    -ac 1 mixes down to mono and -ar 16000 resamples 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.mp3
  3. Uncompressed WAV for an editor

    pcm_s16le is 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

The flags in these commands
FlagWhat it doesUsed here
-vnAs an output option, leaves every video stream outAll four
-c:a copyCopies the audio packets without decoding themM4A
-c:a libmp3lameEncodes MP3 with LAME; ffmpeg has no native MP3 encoderMP3 files
-q:a 2LAME variable bitrate, 0 to 9, lower is better, 4 is the defaultMP3
-b:a 32kConstant bitrate instead of a quality levelSpeech MP3
-ac 1Sets the channel count; 1 mixes down to monoSpeech MP3
-ar 16000Resamples to the given rate in HzSpeech MP3
-c:a pcm_s16leUncompressed 16-bit little-endian PCMWAV
-map 0:a:1Picks one audio track by index, counting from 0Files 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.

second track
ffmpeg -i two.mp4 -map 0:a:1 -c copy original.m4a

Without 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.

terminalTry it
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"]
  }'
ReelSDK video API waveform: Narration extracted from the Seville clip as an MP3
The MP3 from the API, byte for byte the same size as our local encode.Input: 10.7-second clip

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.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains