Skip to content

MP4 to MP3 Tutorial: FFmpeg Audio Extraction and Bitrate Guide

Extracting audio from videos is one of the most common video processing tasks. Whether you want a podcast clip from a YouTube video, a ringtone from a movie scene, or a music track from a concert recording, FFmpeg makes it trivial. This guide covers the commands, bitrate selection, and format comparison.

Basic MP4 to MP3 extraction

bash
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3

Parameter breakdown:

  • -i input.mp4: Input video file
  • -vn: Disable video (extract audio only)
  • -c:a libmp3lame: Use LAME MP3 encoder
  • -b:a 192k: Audio bitrate (192 kbps recommended)
  • output.mp3: Output file

Bitrate selection guide

Bitrate directly affects audio quality and file size:

BitrateQualityUse CaseFile size per minute
64kPoorVoice memo~0.5 MB
96kAcceptableVoice, podcast~0.7 MB
128kGoodCasual music~1 MB
160kGoodBetter music~1.2 MB
192kVery goodRecommended for music~1.5 MB
256kHighHigh quality music~2 MB
320kMaximumArchival, audiophile~2.5 MB

Sweet spot: 192k for most music, 128k for casual listening, 96k for voice.

For most people, 192kbps MP3 is indistinguishable from CD quality. Above 256kbps, the difference is mostly placebo.

Audio format comparison

MP3 (MPEG-1 Audio Layer III)

  • Compatibility: Universal (every device, every software)
  • Quality: Good (but older technology)
  • File size: Larger than AAC/Opus at same quality
  • Use case: Maximum compatibility
bash
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3

AAC (Advanced Audio Coding)

  • Compatibility: Excellent (all modern devices, browsers, streaming)
  • Quality: Better than MP3 at same bitrate
  • File size: 10-20% smaller than MP3 at same quality
  • Use case: Modern applications, recommended
bash
ffmpeg -i input.mp4 -vn -c:a aac -b:a 192k output.m4a

Opus

  • Compatibility: Good (Chrome, Firefox, Android, but limited Safari/iOS)
  • Quality: Best (better than MP3 and AAC at same bitrate)
  • File size: 30-50% smaller than MP3 at same quality
  • Use case: Modern web, VoIP, streaming
bash
ffmpeg -i input.mp4 -vn -c:a libopus -b:a 128k output.opus

FLAC (Lossless)

  • Compatibility: Good (modern devices, but large files)
  • Quality: Lossless (no compression artifacts)
  • File size: 5-10x larger than MP3
  • Use case: Archival, audiophile
bash
ffmpeg -i input.mp4 -vn -c:a flac output.flac

Lossless extraction (no re-encoding)

If the original MP4 already contains AAC audio (which is the most common case), you can extract it without re-encoding:

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

This preserves the original audio quality exactly. The output format must match the original codec — .m4a or .aac for AAC audio, .mp3 for MP3 audio, etc.

Check the original audio codec:

bash
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 input.mp4

Extract specific time range

Fast seeking (less accurate)

bash
ffmpeg -ss 00:01:30 -i input.mp4 -t 00:00:30 -vn -c:a libmp3lame -b:a 192k output.mp3
  • -ss 00:01:30: Start at 1:30
  • -t 00:00:30: Extract 30 seconds

Accurate seeking (slower)

bash
ffmpeg -i input.mp4 -ss 00:01:30 -t 00:00:30 -vn -c:a libmp3lame -b:a 192k output.mp3

Place -ss after -i for frame-accurate seeking.

Extract until end

bash
ffmpeg -ss 00:01:30 -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3

Extract specific time range with end time

bash
ffmpeg -ss 00:01:30 -to 00:02:00 -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3

Extract all audio tracks

Some MP4 files contain multiple audio tracks (different languages). To list them:

bash
ffprobe -i input.mp4 -show_streams -select_streams a

To extract a specific track (e.g., second audio track):

bash
ffmpeg -i input.mp4 -map 0:a:1 -c:a libmp3lame -b:a 192k output.mp3

To extract all audio tracks:

bash
ffmpeg -i input.mp4 -map 0:a -c:a libmp3lame -b:a 192k output_%d.mp3

Adjust audio properties

Change sample rate

bash
# 44.1 kHz (CD quality, default)
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k -ar 44100 output.mp3

# 48 kHz (professional video standard)
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k -ar 48000 output.mp3

Convert stereo to mono

bash
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 128k -ac 1 output.mp3

Adjust volume

bash
# Increase volume by 6dB
ffmpeg -i input.mp4 -vn -af "volume=6dB" -c:a libmp3lame -b:a 192k output.mp3

# Normalize volume (recommended)
ffmpeg -i input.mp4 -vn -af "loudnorm" -c:a libmp3lame -b:a 192k output.mp3

Quality comparison: MP3 vs AAC vs Opus

At the same bitrate, the perceived quality ranking is:

Opus > AAC > MP3

Approximate equivalence:

  • Opus 96kbps ≈ AAC 128kbps ≈ MP3 160kbps
  • Opus 128kbps ≈ AAC 160kbps ≈ MP3 192kbps
  • Opus 160kbps ≈ AAC 192kbps ≈ MP3 256kbps

For new projects, AAC is the safest modern choice. For maximum compatibility, MP3. For best quality at lowest bitrate, Opus.

Common issues

IssueCauseSolution
No audio in outputWrong audio stream selectedUse -map 0:a:0
Audio out of syncVariable frame rate videoAdd -vsync 0
Poor qualityBitrate too lowUse 192kbps minimum
Large fileLossless codec usedUse MP3/AAC with reasonable bitrate
Can't play OpusOld player/browserUse AAC or MP3 instead
FFmpeg error "Unknown encoder"Encoder not compiledUse -c:a aac (built-in) instead of libmp3lame

Summary

Extracting audio from MP4 is straightforward with FFmpeg. The universal command ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3 covers most use cases.

Quick reference:

  • Universal MP3: ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3
  • Better AAC: ffmpeg -i input.mp4 -vn -c:a aac -b:a 192k output.m4a
  • Lossless extract: ffmpeg -i input.mp4 -vn -c:a copy output.m4a (if original is AAC)
  • Sweet spot bitrate: 192kbps for music, 128kbps for voice

For more audio format conversions, see our Audio Format Conversion Guide.

References

Last updated: