[Question] How to force Youtube title into video metadata instead of the Content ID track title
See original GitHub issueChecklist
- 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:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Related StackOverflow Question
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-dlby default uses thetrackas 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-metadataI am closing the issue since I believe all your questions are answered now
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.