yt-dlp audio: WebM/Opus, M4A/AAC or MP3 — which one should you keep?
By Tunelio teamPublished
YouTube does not store MP3s. Its audio streams are Opus in a WebM container (up to ~160 kbps) and AAC in M4A (~128 kbps). yt-dlp -x gives you one of those untouched; asking for MP3 makes ffmpeg re-encode it, losing a little quality and taking CPU. Keep WebM/Opus for quality and size, M4A for Apple devices and broad compatibility, MP3 only when the target player understands nothing else.
What YouTube actually serves
yt-dlp -F "https://youtu.be/dQw4w9WgXcQ"
# ID EXT ... ACODEC ABR
# 249 webm opus ~50k (low)
# 250 webm opus ~70k (medium)
# 251 webm opus ~130–160k (high) ← usually "bestaudio"
# 140 m4a aac ~128kThose are the only audio-only tracks for a normal video (some videos also expose higher-bitrate AAC or multi-language tracks). Whatever you end up with — MP3, FLAC, WAV — is derived from one of these, so it cannot be better than ~160 kbps Opus or ~128 kbps AAC.
The three choices
Keep the original (WebM/Opus or M4A/AAC) — best quality, no transcode
yt-dlp -x --audio-format best "URL" # keeps whatever bestaudio is (usually .webm/.opus)
yt-dlp -f bestaudio "URL" # same stream, no post-processing at allZero quality loss, instant, smallest file for the quality. Opus plays natively in every modern browser, Android, VLC, Windows 10+ and most desktop players. --audio-format best also remuxes .webm to .opus when possible so tagging tools recognise it.
M4A (AAC) — Apple-friendly, still no transcode if the source is AAC
yt-dlp -f 'ba[ext=m4a]' "URL" # take the AAC track as-is (itag 140)
yt-dlp -x --audio-format m4a "URL" # AAC in .m4a; transcodes only if the chosen source was OpusiPhones, iPads, iTunes/Music and many car systems handle M4A but not Opus. Selecting the AAC track directly avoids any re-encode; the ~128 kbps AAC is fine for spoken content and most music.
MP3 — maximum compatibility, always a re-encode
yt-dlp -x --audio-format mp3 --audio-quality 0 "URL"Use MP3 when the destination truly requires it: old car stereos, cheap MP3 players, some podcast platforms and legacy tools. The transcode is lossy-to-lossy and costs ffmpeg CPU time; VBR 0 keeps the loss small. Full details in the MP3 guide.
Side-by-side
- Quality: WebM/Opus > M4A/AAC ≳ MP3 (at the same bitrate Opus is the most efficient codec of the three; MP3 the least).
- File size for a 4-minute song: Opus 160k ≈ 4.7 MB · AAC 128k ≈ 3.8 MB · MP3 VBR 0 ≈ 6–8 MB.
- Compatibility: MP3 everywhere · AAC/M4A everywhere except a few very old players · Opus everywhere except older Apple devices and some car systems.
- CPU: original = none · M4A from AAC = none · MP3 = a few seconds per track (matters at scale).
- Metadata and cover art: all three support tags via --embed-metadata --embed-thumbnail.
Picking by use case
- Personal library on phone/desktop → keep the original (--audio-format best).
- Apple ecosystem, car via USB → M4A (-f 'ba[ext=m4a]').
- Podcast feed, old hardware, unknown players → MP3 VBR 0.
- Speech for transcription or ML → keep Opus, or ask for the transcript directly instead of the audio.
- Archival → keep the original stream; you can always transcode later, never the other way round.
Common mistakes
- “--audio-format mp3 --audio-quality 320K for best quality” — the source is ~160 kbps; you are enlarging the file, not improving it.
- Converting Opus to M4A when the AAC track exists — select itag 140 instead and skip the re-encode.
- Hard-coding .mp3 in -o — use %(ext)s so yt-dlp can rename after conversion.
- Expecting FLAC/WAV to be lossless — they are lossless containers of a lossy source; larger, not better.
In a product
If your app hands users audio, the format decision becomes a server cost: every MP3 is an ffmpeg job, every Opus is a passthrough. A hosted API lets you ask per request — quality=mp3 for a ready MP3, quality=opus for the original stream — and returns a URL either way. Tunelio is our own service; for personal downloads the commands above are all you need. New accounts get 100 free credits.
Sources
- yt-dlp README — Format selection (-f, -S, bestaudio), --audio-format best.
- yt-dlp -F output — the itag/codec table for any video.
- Opus codec (opus-codec.org) and ffmpeg libmp3lame documentation — bitrate and quality scales.
Frequently asked questions
Is WebM audio better than MP3?
Yes for the same source: WebM carries YouTube’s original Opus stream untouched, while MP3 is a second lossy encode of it. Opus is also more efficient per kilobit.
Will an Opus .webm play on my phone?
On Android, Windows, Linux, VLC and every modern browser — yes. Older iPhones and some car head units do not; use M4A there.
Does yt-dlp download MP3 directly from YouTube?
No. YouTube has no MP3 streams; yt-dlp downloads Opus or AAC and ffmpeg converts it when you ask for --audio-format mp3.
What does --audio-format best do?
It keeps the downloaded audio in its original codec, only remuxing the container (e.g. .webm → .opus). No transcode, no quality loss.