## The Birth of MP3
**MP3** (MPEG-1 Audio Layer III) was developed at Germany's Fraunhofer Institute and standardized as ISO/IEC 11172-3 in 1993. Its goal: compress CD-quality audio (~10 MB/minute) to ~1 MB/minute for modem-era transmission.
The key innovation: **psychoacoustic coding** β discard only audio information that human ears cannot perceive.
## How Psychoacoustic Compression Works
1. **Simultaneous masking:** loud sounds mask nearby quiet sounds β MP3 removes the quiet ones.
2. **Temporal masking:** after a very loud sound, ears take milliseconds to recover β sounds during that window are discardable.
Process: split audio into frames (~26 ms), analyze frequencies via FFT, apply the psychoacoustic model, compress only perceptible data using Huffman coding.
## Bitrate vs Quality
| Bitrate | Quality | Use |
|---------|---------|-----|
| **32β64 kbps** | Very low | Voice, simple podcasts |
| **128 kbps** | Standard | Casual music |
| **192 kbps** | Good | General use |
| **320 kbps** | Maximum MP3 | Music archiving |
```bash
# CBR 320 kbps
ffmpeg -i song.flac -codec:a libmp3lame -b:a 320k song.mp3
# VBR quality 2 (~190 kbps average)
ffmpeg -i song.flac -codec:a libmp3lame -q:a 2 song.mp3
# VBR quality 0 (~245 kbps, max VBR quality)
ffmpeg -i song.flac -codec:a libmp3lame -q:a 0 song.mp3
```
## MP3 vs AAC vs OGG vs Opus
| Format | Year | Quality at 128 kbps | Patent-free |
|--------|------|-------------------|------------|
| **MP3** | 1993 | Baseline | β
(since 2017) |
| **AAC** | 1997 | Better | No |
| **OGG Vorbis** | 2000 | Similar/Better | β
|
| **Opus** | 2012 | Much better | β
|
MP3 patents expired worldwide in 2017, making it completely free.
## ID3 Metadata
```bash
# View metadata
ffmpeg -i song.mp3 2>&1 | grep -A 20 "Metadata:"
# Write metadata
exiftool -Title="La Bamba" -Artist="Ritchie Valens" song.mp3
# Export embedded cover art
ffmpeg -i song.mp3 -an -vcodec copy cover.jpg
```
## Conclusion
For new applications where compatibility isn't critical, **Opus** offers better quality. For general music distribution, MP3 at 320 kbps or VBR V0 remains the de facto standard.
Guide