[Question] How to force Youtube title into video metadata instead of the Content ID track title

See original GitHub issue

Checklist

  • I’m asking a question
  • I’ve looked through the README and FAQ for similar questions
  • I’ve searched the bugtracker for similar questions including closed ones

Question

Hello! First of all, I apologize for not being able to get this from reading the docs, but I’m having some trouble with metadata and I can’t quite figure it out.

I only just noticed that, with --add-metadata, yt-dlp will actually prioritize the Content ID data over the actual video metadata set by the uploader (at least on Youtube), if it is set. This means you only get the actual video title as the metadata title some of the time, depending on whether or not a Content ID tag was automatically set by Youtube. It also sets the “artist” tag (maybe others too in some cases? I’m not sure).

For my archiving script I want to just have the video title and channel name as “title” and “artist” metadata tags. So I’ve tried using --parse-metadata to accomplish this but it doesn’t seem to be working.

Here’s my command so far:

yt-dlp \
  --format "(bestvideo)+(bestaudio[acodec^=opus]/bestaudio)/best" \
  --verbose \
  --ignore-errors \
  --no-continue \
  --add-metadata \
  --write-description \
  --write-info-json \
  --write-annotations \
  --write-thumbnail \
  --embed-thumbnail \
  --all-subs \
  --embed-subs \
  --get-comments \
  --match-filter "!is_live & !live" \
  --output "TEST/TEST.%(ext)s" \
  --merge-output-format mp4 \
  --parse-metadata "title:%(title)s" \
  --parse-metadata "artist:%(channel)s" \
  "https://www.youtube.com/watch?v=M38GIXosXF0"

Here’s the yt-dlp output log and the generated info.json.

After downloading, the file’s metadata tags are as follows:

$ ffmpeg -i ./TEST/TEST.mp4 -y -f ffmetadata meta.txt 2> /dev/null; grep -i "title=\|artist=" meta.txt

title=Sonata No. 2 in A Major, Op. 2, No. 2: III. Scherzo - Allegretto (Remastered)
artist=Glenn Gould

I’m expecting to instead see the following:

title=TITLE TEST
artist=helloitismetomato

Here’s the full meta.txt file output.

Would anyone know how I should go about this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pukkandancommented, Sep 7, 2021

yt-dlp will actually prioritize the Content ID data over the actual video metadata set by the uploader (at least on Youtube) As an aside, I wanted to add a note that this feels like a bit of a pitfall, and personally I feel that the better default behavior is to not prioritize Content ID tags over the video title/uploader.

We can only use the data we get from YouTube. I don’t know any way to detect automatically whether the content ID applies to just a part of the video or the whole video. It is impossible to have a default that satisfies everybody in this situation. youtube-dl by default uses the track as title in file metadata and since there are pros and cons to both approaches, I don’t feel changing this default is warranted.

I feel it is much more important for the user to be able to tweak it however they personally see fit. Hence the existence of --parse-metadata


I am closing the issue since I believe all your questions are answered now

0reactions
msikmacommented, Sep 7, 2021

Oh wow, thank you! Really appreciate it, this worked like a charm.

I added --parse-metadata "%(title)s:%(meta_title)s" and --parse-metadata "%(uploader)s:%(meta_artist)s" and this overwrote the Content ID tags. So this solves my issue. Looking at the list, I guess those two are the only ones I need to worry about.

Now that I look at the metadata section again I understand what it’s trying to say. At the time it wasn’t really clear to me that the metadata and the embedded metadata could have a different set of values. I guess it makes sense when you’re downloading audio only.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Content ID - YouTube Help - Google Support
When a match is found, YouTube applies your preferred policy: to monetize, track, or block the video in question. The major steps for...
Read more >
Videos | YouTube Data API - Google Developers
The ID that YouTube uses to uniquely identify the channel that the video was uploaded to. snippet.title, string. The video's title.
Read more >
youtube-dl/README.md at master - GitHub
Command-line program to download videos from YouTube.com and other video sites ... Parse additional metadata like song title / artist from the video...
Read more >
Closed Captioning & Everything You Need to Know About It
They make video accessible to deaf and hard of hearing by providing a time-to-text track as a supplement to, or as a substitute...
Read more >
How to Promote Your YouTube Channel: 30 Tactics That Work
Use concise, descriptive video titles. The title is the first thing users see when they find your content. And if it isn't punchy,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found