Skip to content

yt-dlp to MP3: the correct command, quality settings and metadata

By Tunelio teamPublished

One line does it: yt-dlp -x --audio-format mp3 --audio-quality 0 URL. yt-dlp downloads the best audio stream YouTube offers (usually Opus or AAC) and ffmpeg converts it to a VBR MP3. Below: what the flags mean, how to pick bitrate, embed cover art and tags, handle playlists, and when you should not convert to MP3 at all.

The command

yt-dlp -x --audio-format mp3 --audio-quality 0 "https://youtu.be/dQw4w9WgXcQ"
  • -x (--extract-audio): download only the audio stream and run the audio post-processor.
  • --audio-format mp3: transcode the result to MP3 with ffmpeg (required — see below).
  • --audio-quality 0: best VBR quality (0 = best, 10 = worst, or a fixed bitrate such as 192K).

Requires ffmpeg on your PATH or via --ffmpeg-location; without it yt-dlp prints “ffmpeg not found” and saves the original .webm/.m4a instead of an MP3. See the ffmpeg guide for installation.

Bitrate: what to choose

--audio-quality 0        # VBR ~220–260 kbps, best quality (recommended)
--audio-quality 5        # VBR ~120–150 kbps, small files
--audio-quality 192K     # constant 192 kbps, for players that dislike VBR

YouTube’s source audio tops out around 128 kbps AAC or ~160 kbps Opus. An MP3 cannot add quality that was not there, so 320K mostly adds file size; VBR 0 keeps everything the source has. Every MP3 conversion is a lossy-to-lossy transcode — if you do not need MP3 specifically, keep the original (next section).

Do you actually need MP3?

yt-dlp -x --audio-format best "URL"     # keeps the original Opus (.webm/.opus) or AAC (.m4a) — no transcode
yt-dlp -x --audio-format m4a "URL"      # AAC in .m4a: plays on Apple devices and most players

MP3 is the right choice for old car stereos, some podcast apps and anything that only understands MP3. For phones, browsers and modern players, the original Opus or AAC is smaller and sounds better. The webm-vs-mp3 guide goes deeper.

Cover art, title, artist

yt-dlp -x --audio-format mp3 --audio-quality 0 \
  --embed-thumbnail --embed-metadata \
  --parse-metadata "title:%(artist)s - %(title)s" \
  "URL"

--embed-thumbnail writes the video thumbnail as ID3 cover art (yt-dlp converts the WebP thumbnail to JPEG for you). --embed-metadata fills title, uploader, date and description tags. The --parse-metadata line splits “Artist - Title” video names into artist and title fields when the uploader used that convention.

File names and folders

yt-dlp -x --audio-format mp3 -o "~/Music/%(uploader)s/%(title)s.%(ext)s" "URL"
# playlist: numbered files in a folder named after the playlist
yt-dlp -x --audio-format mp3 -o "%(playlist)s/%(playlist_index)02d - %(title)s.%(ext)s" "PLAYLIST_URL"

Use %(ext)s, never a hard-coded .mp3: yt-dlp downloads to the source extension first and renames after conversion. --restrict-filenames replaces spaces and special characters if your player is picky.

Playlists and channels

yt-dlp -x --audio-format mp3 --audio-quality 0 \
  --download-archive done.txt --ignore-errors \
  --sleep-interval 2 --max-sleep-interval 6 \
  "https://www.youtube.com/playlist?list=PL..."

--download-archive remembers finished videos so reruns only fetch new ones; --ignore-errors skips removed or private items instead of aborting; the sleep flags keep bulk runs under YouTube’s rate limits — see the bot-check guide for what happens without them.

Save it as a config file

# ~/.config/yt-dlp/config  (Windows: %APPDATA%\yt-dlp\config.txt)
-x
--audio-format mp3
--audio-quality 0
--embed-thumbnail
--embed-metadata
-o ~/Music/%(title)s.%(ext)s

With this in place, yt-dlp URL is enough. Use --ignore-config for a one-off video download.

Common problems

  • Output is .webm or .m4a, not .mp3 → ffmpeg is missing; install it or pass --ffmpeg-location.
  • “Postprocessing: Conversion failed!” → corrupt partial download or very old ffmpeg; delete the .part file, update both tools, retry.
  • No cover art → --embed-thumbnail needs ffmpeg and, for some files, the mutagen Python package (included in the official binaries and yt-dlp[default]).
  • Slow or throttled downloads, 403, bot check → not an MP3 problem; update yt-dlp and follow the 403 and bot-check guides.
  • Wrong audio track on multi-language videos → pick it with -f 'ba[language=en]' or check yt-dlp -F for the track list.

MP3 from an API instead

If MP3s are a feature of your bot or app rather than a personal download, the pipeline above — yt-dlp plus ffmpeg plus a clean IP — becomes infrastructure to run and patch. A hosted API returns a ready MP3 URL in one request:

curl "https://tunelio.dev/create?url=https://youtu.be/dQw4w9WgXcQ&quality=mp3" \
  -H "Authorization: Bearer tnl_your_api_key"
# → { "url": "https://…/tunnel?id=…&sig=…", "file_size_str": "3.29 MB", "status": "ok" }

Tunelio is our own service; for personal use the command at the top of this page is all you need. New accounts get 100 free credits, no card required.

Sources

  • yt-dlp README — Post-processing options (-x, --audio-format, --audio-quality, --embed-*), Output template.
  • yt-dlp README — Format selection and sorting (-f, -S).
  • ffmpeg documentation — libmp3lame VBR quality scale.

Frequently asked questions

Is --audio-quality 0 the same as 320 kbps?

No. 0 is the best VBR setting (roughly 220–260 kbps depending on the material). YouTube’s source is ~128–160 kbps anyway, so 320K only makes bigger files.

Why did I get a .webm file instead of .mp3?

ffmpeg is not installed or not on PATH, so yt-dlp kept the original audio container. Install ffmpeg or pass --ffmpeg-location.

Can I download a whole playlist as MP3?

Yes: give yt-dlp the playlist URL and add --download-archive and --ignore-errors so reruns are incremental and broken items do not stop the batch.

Does converting to MP3 lose quality?

Slightly — it is a second lossy encode over YouTube’s Opus/AAC. Use --audio-format best to keep the original if your player supports it.

Related guides