Skip to content

Embed ID3 metadata (title/artist) + thumbnail as cover art for mp3 downloads #12

Description

@AledMikuinIt

Context

Right now, mp3 downloads only get the raw filename (%(title).60s.%(ext)s) — no ID3 tags are written, so title/artist show up empty in any music player/library manager. Since yt-dlp already knows this metadata from the video info, it seems worth writing it into the file at download time.

Proposal

Add three yt-dlp flags to the audio choice's args in buildChoices():

args: [
  '-f', 'ba/b', '-x', '--audio-format', 'mp3', '--audio-quality', '0',
  '--parse-metadata', 'title:(?P<artist>.+?) - (?P<title>.+)',
  '--embed-metadata',
  '--embed-thumbnail',
]
  • --parse-metadata splits the video title into artist/title when it follows the "Artist - Title" pattern (common on YouTube). Falls through silently otherwise.
  • --embed-metadata writes title/artist/uploader as fallback into the mp3's ID3 tags — even without the split above, this alone fixes "empty title" in players.
  • --embed-thumbnail embeds the video's thumbnail as album cover art (requires ffmpeg, which is already a hard requirement for mp3 extraction).

Tested locally on a few YouTube videos (both "Artist - Title" and plain-title cases) — works well, tags and cover show up correctly in eyeD3/music players.

Open question

Should this be the default behavior for all mp3 downloads, or gated behind an opt-in flag (e.g. --tag)? I lean toward "just do it by default" since it's strictly additive (no existing behavior is removed, just extra metadata written), but wanted to check your take before polishing a PR — happy to adjust either way.

Also open to feedback on the --parse-metadata regex if there's a better heuristic for splitting artist/title.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions