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
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3Parameter 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:
| Bitrate | Quality | Use Case | File size per minute |
|---|---|---|---|
| 64k | Poor | Voice memo | ~0.5 MB |
| 96k | Acceptable | Voice, podcast | ~0.7 MB |
| 128k | Good | Casual music | ~1 MB |
| 160k | Good | Better music | ~1.2 MB |
| 192k | Very good | Recommended for music | ~1.5 MB |
| 256k | High | High quality music | ~2 MB |
| 320k | Maximum | Archival, 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
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3AAC (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
ffmpeg -i input.mp4 -vn -c:a aac -b:a 192k output.m4aOpus
- 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
ffmpeg -i input.mp4 -vn -c:a libopus -b:a 128k output.opusFLAC (Lossless)
- Compatibility: Good (modern devices, but large files)
- Quality: Lossless (no compression artifacts)
- File size: 5-10x larger than MP3
- Use case: Archival, audiophile
ffmpeg -i input.mp4 -vn -c:a flac output.flacLossless 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:
ffmpeg -i input.mp4 -vn -c:a copy output.m4aThis 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:
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 input.mp4Extract specific time range
Fast seeking (less accurate)
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)
ffmpeg -i input.mp4 -ss 00:01:30 -t 00:00:30 -vn -c:a libmp3lame -b:a 192k output.mp3Place -ss after -i for frame-accurate seeking.
Extract until end
ffmpeg -ss 00:01:30 -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3Extract specific time range with end time
ffmpeg -ss 00:01:30 -to 00:02:00 -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3Extract all audio tracks
Some MP4 files contain multiple audio tracks (different languages). To list them:
ffprobe -i input.mp4 -show_streams -select_streams aTo extract a specific track (e.g., second audio track):
ffmpeg -i input.mp4 -map 0:a:1 -c:a libmp3lame -b:a 192k output.mp3To extract all audio tracks:
ffmpeg -i input.mp4 -map 0:a -c:a libmp3lame -b:a 192k output_%d.mp3Adjust audio properties
Change sample rate
# 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.mp3Convert stereo to mono
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 128k -ac 1 output.mp3Adjust volume
# 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.mp3Quality 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
| Issue | Cause | Solution |
|---|---|---|
| No audio in output | Wrong audio stream selected | Use -map 0:a:0 |
| Audio out of sync | Variable frame rate video | Add -vsync 0 |
| Poor quality | Bitrate too low | Use 192kbps minimum |
| Large file | Lossless codec used | Use MP3/AAC with reasonable bitrate |
| Can't play Opus | Old player/browser | Use AAC or MP3 instead |
| FFmpeg error "Unknown encoder" | Encoder not compiled | Use -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.