Audio Compression for Streaming: Optimizing for Bandwidth
Streaming audio over the internet requires balancing quality against bandwidth consumption and latency. Codec selection, bitrate adaptation, and buffering strategy determine whether listeners hear music or stuttering.
Key Takeaways
- Modern streaming services dynamically adjust audio quality based on available bandwidth.
- The optimal codec for real-time streaming.
- Streaming clients maintain a playback buffer — pre-downloaded audio ahead of the current playback position.
- Music service:** AAC 256 kbps default, adaptive to 128/64 on slow networks
BPM Calculator
Bandwidth Reality
| Connection | Typical Bandwidth | Supported Audio Quality |
|---|---|---|
| 2G mobile | 50-100 kbps | Low-quality speech only |
| 3G mobile | 300-700 kbps | MP3 128-192 kbps |
| 4G mobile | 5-50 Mbps | Any lossy, some lossless |
| 5G / WiFi | 50+ Mbps | Lossless, Hi-Res |
| Satellite | 1-5 Mbps | Most lossy formats |
Adaptive Bitrate Streaming
Modern streaming services dynamically adjust audio quality based on available bandwidth. Spotify offers four quality tiers (24, 96, 160, 320 kbps) and switches between them mid-stream as network conditions change. Apple Music similarly adapts between AAC 64 kbps and lossless ALAC.
Codec Choice for Streaming
Opus
The optimal codec for real-time streaming. Opus adapts seamlessly between speech and music modes, supports bitrates from 6 kbps to 510 kbps, and has the lowest latency of any modern codec (2.5 ms minimum frame size). Used by Discord, WhatsApp, and most VoIP services.
AAC-LC and HE-AAC
AAC-LC (Low Complexity) is the standard music streaming codec. HE-AAC v2 adds spectral band replication and parametric stereo for excellent quality at very low bitrates (32-64 kbps) — used for bandwidth-constrained music streaming.
Buffer Management
Streaming clients maintain a playback buffer — pre-downloaded audio ahead of the current playback position. Typical buffer sizes:
- Music streaming: 10-30 seconds ahead
- Live radio: 3-5 seconds (latency trade-off)
- Video conferencing: <200 ms (real-time requirement)
Larger buffers improve reliability on unstable connections but increase initial wait time and memory usage.
Optimizing for Your Use Case
- Music service: AAC 256 kbps default, adaptive to 128/64 on slow networks
- Podcast delivery: MP3 128 kbps CBR mono (widest compatibility)
- Live communication: Opus 32-64 kbps (lowest latency)
- Background web audio: AAC 64-96 kbps (acceptable quality, minimal bandwidth)