Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong YouTube video metadata fields - "Movie name" and "ARTIST". #3146

Closed
7 tasks done
VladiStep opened this issue Mar 21, 2022 · 21 comments
Closed
7 tasks done

Wrong YouTube video metadata fields - "Movie name" and "ARTIST". #3146

VladiStep opened this issue Mar 21, 2022 · 21 comments
Labels
question Question wontfix This will not be worked on

Comments

@VladiStep
Copy link

VladiStep commented Mar 21, 2022

Checklist

Region

Russia

Description

If YouTube video has detected music in the description, --embed-metadata embeds title and artist of the song instead of the video title (Movie title field) and channel name (ARTIST field).

Example:
yt-dlp 3YvGFsc0SYw --embed-metadata: expected Movie name is "I sit" and expected ARTIST is "Owlspark".
Got "Sugar" and "System Of A Down" instead (detected song title and artist).

Verbose log

[debug] Command-line config: ['3YvGFsc0SYw', '--embed-metadata', '-vU']
[debug] Encodings: locale cp1251, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref cp1251
[debug] yt-dlp version 2022.03.08.1 [c0c2c57] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg n4.4.1-3-g832b46a96e-20211206 (setts)
[debug] Optional libraries: brotli, Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.03.08.1, Current version: 2022.03.08.1
yt-dlp is up to date (2022.03.08.1)
[debug] [youtube] Extracting URL: 3YvGFsc0SYw
[youtube] 3YvGFsc0SYw: Downloading webpage
[youtube] 3YvGFsc0SYw: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, codec:vp9.2, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 3YvGFsc0SYw: Downloading 1 format(s): 247+251
[debug] Invoking downloader on "https://rr7---sn-n3toxu-axql.googlevideo.com/videoplayback?expire=1647906325&ei=tbk4YpTJJIWO7AS11K3wBg&ip=188.243.183.25&id=o-ANnrf-dMdYXrKZuj_KQz_D0OauYlC8PyHTnN_goR5dIH&itag=247&source=youtube&requiressl=yes&mh=zZ&mm=31%2C29&mn=sn-n3toxu-axql%2Csn-axq7sn7l&ms=au%2Crdu&mv=m&mvi=7&pl=21&initcwndbps=1070000&vprv=1&mime=video%2Fwebm&gir=yes&clen=498966&dur=11.499&lmt=1645625609945541&mt=1647884217&fvip=7&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5437434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgQhKqsRgWG7u1-7Hls_b4qBY-SJvNktif-h9u-L4x-NMCIHeGUfgX2YMWr9V4ZbKl-iVuqfZhjsTX36W3-2ESTDAr&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALOL3VZVMDuWkyRagFLMN2J7mJOSeGVTmlVCADlzn5PNAiEA8gQbng072qAg8hoa1MtGhtgTPeP-LvGagP7v_ASeREk%3D"
[download] Destination: I sit [3YvGFsc0SYw].f247.webm
[download] 100% of 487.27KiB in 00:00
[debug] Invoking downloader on "https://rr7---sn-n3toxu-axql.googlevideo.com/videoplayback?expire=1647906325&ei=tbk4YpTJJIWO7AS11K3wBg&ip=188.243.183.25&id=o-ANnrf-dMdYXrKZuj_KQz_D0OauYlC8PyHTnN_goR5dIH&itag=251&source=youtube&requiressl=yes&mh=zZ&mm=31%2C29&mn=sn-n3toxu-axql%2Csn-axq7sn7l&ms=au%2Crdu&mv=m&mvi=7&pl=21&initcwndbps=1070000&vprv=1&mime=audio%2Fwebm&gir=yes&clen=169344&dur=11.621&lmt=1645625530102349&mt=1647884217&fvip=7&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5432434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAPxIgzL-P1QesSJ2s4Cx3gZKyXh9c-fDn5J41FheXrwCAiBy9m7Hx5xiZWKUco_TSQjd7LvNZULD-rYSmjyZJqUotQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALOL3VZVMDuWkyRagFLMN2J7mJOSeGVTmlVCADlzn5PNAiEA8gQbng072qAg8hoa1MtGhtgTPeP-LvGagP7v_ASeREk%3D"
[download] Destination: I sit [3YvGFsc0SYw].f251.webm
[download] 100% of 165.38KiB in 00:00
[Merger] Merging formats into "I sit [3YvGFsc0SYw].webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:I sit [3YvGFsc0SYw].f247.webm" -i "file:I sit [3YvGFsc0SYw].f251.webm" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:I sit [3YvGFsc0SYw].temp.webm"
Deleting original file I sit [3YvGFsc0SYw].f251.webm (pass -k to keep)
Deleting original file I sit [3YvGFsc0SYw].f247.webm (pass -k to keep)
[Metadata] Adding metadata to "I sit [3YvGFsc0SYw].webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:I sit [3YvGFsc0SYw].webm" -map 0 -dn -ignore_unknown -c copy -metadata "title=Sugar" -metadata "date=20220214" -metadata "description=Edit: I wont unlist this vid cause  a lot of people said they didnt want me to! aa sorry i keep saying that im gonna unlist videos, i get kinda nervous when i post things that arent what i usually post!
I made this in flipaclip and I have no idea how to draw in flipaclip so this looks awful but oh well I'm gonna unlist this vid really soon" -metadata "synopsis=Edit: I wont unlist this vid cause  a lot of people said they didnt want me to! aa sorry i keep saying that im gonna unlist videos, i get kinda nervous when i post things that arent what i usually post!
I made this in flipaclip and I have no idea how to draw in flipaclip so this looks awful but oh well I'm gonna unlist this vid really soon" -metadata "purl=https://www.youtube.com/watch?v=3YvGFsc0SYw" -metadata "comment=https://www.youtube.com/watch?v=3YvGFsc0SYw" -metadata "artist=System Of A Down" -movflags "+faststart" "file:I sit [3YvGFsc0SYw].temp.webm"
@VladiStep VladiStep added site-bug Issue with a specific website triage Untriaged issue labels Mar 21, 2022
@pukkandan
Copy link
Member

This is intended behavior. See https://github.com/yt-dlp/yt-dlp#modifying-metadata

@pukkandan pukkandan added question Question and removed site-bug Issue with a specific website triage Untriaged issue labels Mar 21, 2022
@VladiStep
Copy link
Author

VladiStep commented Mar 21, 2022

To my opinion, it's weird that this behavior is default.
Anyway, how to make it embed video title and channel instead of song?

(if you wonder, I want to preserve original title and channel name in the metadata, because of filename limitations)

@dirkf
Copy link
Contributor

dirkf commented Mar 22, 2022

So might --parse-metadata "title:%(title)s" (etc) override the default in this case, or has the title (etc) already defaulted by then?

@pukkandan
Copy link
Member

From https://github.com/yt-dlp/yt-dlp#modifying-metadata

You can use this to change the metadata that is embedded in the media file. To do this, set the value of the corresponding field with a meta_ prefix. For example, any value you set to meta_description field will be added to the description field in the file. ...

What OP wants here is to override meta_title, not title

So:

--parse-metadata "title:%(meta_title)s"

@VladiStep
Copy link
Author

So, final command that does what I wanted is yt-dlp 3YvGFsc0SYw --embed-metadata --parse-metadata "title:%(meta_title)s" --parse-metadata "uploader:%(meta_artist)s".

But still, I think this should be default behavior at least for YouTube videos, because it's confusing that Movie name of a video can be a detected song title.
So, I suggest that this issue shouldn't be closed while the default behavior is not changed.

@pukkandan
Copy link
Member

The youtube-dl devs at some point decided to prioritize track and artist fields instead of title and uploader in the embedded video metadata. This was probably done because this is the expected result for songs. But yt-dlp can't tell songs and videos apart (I blame youtube for putting the track info in other videos). So this cannot now be changed without significantly breaking backward compatibility.

Even a small (and fully justified) change to metadata embedding (putting webpage_url in comment) that was made in the early days of yt-dlp was met with significant backlash as the project grew popular. So changing the artist/title fields - that many people depend on - is completely out of the question

@pukkandan pukkandan added the wontfix This will not be worked on label Mar 23, 2022
@0xallie
Copy link
Contributor

0xallie commented Mar 23, 2022

"Movie name" is just what MediaInfo calls it anyway. In practice it's used as a general-purpose title field.

@VladiStep
Copy link
Author

Then, to prevent other people from searching through closed issues, this solution of the problem (adding a couple of --parse-metadata) should be mentioned somewhere ("README.md", --help, etc.).

@pukkandan
Copy link
Member

@VladiStep
Copy link
Author

But there's no example with "meta_".

@pukkandan
Copy link
Member

# Set "comment" field in video metadata using description instead of webpage_url
$ yt-dlp --parse-metadata "description:(?s)(?P<meta_comment>.+)" --add-metadata

@VladiStep
Copy link
Author

Oh.
But this example is a bit more complicated (and so harder to understand) comparing to what I've used.
Also, all examples of --parse-metadata are modifying one field.

So, I think you should add one more example.

@pukkandan
Copy link
Member

That is the "correct" way to copy a field. The other method won't work correctly if the field has multiple lines. Youtube video titles never have multiple lines, so it's fine for that

@pukkandan
Copy link
Member

I'll add this:

diff --git a/README.md b/README.md
index a2e2b34c3..c4017140f 100644
--- a/README.md
+++ b/README.md
@@ -1637,7 +1637,11 @@ $ yt-dlp --parse-metadata "description:Artist - (?P<artist>.+)"
 # Set title as "Series name S01E05"
 $ yt-dlp --parse-metadata "%(series)s S%(season_number)02dE%(episode_number)02d:%(title)s"

-# Set "comment" field in video metadata using description instead of webpage_url
+# Prioritize uploader (if present) as the "artist" field in video metadata
+$ yt-dlp --parse-metadata "%(uploader|)s:%(meta_artist)s" --add-metadata
+
+# Set "comment" field in video metadata using description instead of webpage_url,
+# handling multiple lines correctly
 $ yt-dlp --parse-metadata "description:(?s)(?P<meta_comment>.+)" --add-metadata

 # Remove "formats" field from the infojson by setting it to an empty string

@NanaMizukiAnother7
Copy link

@pukkandan The compatible option "embed-metadata" should change "track" to "title"/"artist" to "uploader", like the original YouTube-DL do.

@pukkandan
Copy link
Member

The bahavior of ytdl and yt-dlp are same for these fields. Explain what you mean (in a new issue) with verbose logs backing your claims

@NanaMizukiAnother7
Copy link

Nevermind. It's the same thing. Sorry!

@KonoVitoDa
Copy link

KonoVitoDa commented Jun 15, 2022

And how to to replace meta_album with 'nothing'? I mean, remove it.

@pukkandan
Copy link
Member

pukkandan commented Jun 15, 2022

Set it to an empty string

--parse-metadata ":(?P<meta_album>)"

@KonoVitoDa
Copy link

Set it to an empty string

--parse-metadata ":(?P<meta_album>)"

Worked fine, thanks!

But I had a problem with the title on Tumblr: downloading this video with --parse-metadata "title:%(title)s" enabled, the title gets cut just before "OST", but when this option is disabled, this problems doesn't happen. I noticed there's a line break before "OST", so this can be the cause. Some way to sovle it?

@pukkandan
Copy link
Member

--parse-metadata "title:%(title)s" enabled

What do you expect this to do? (probably best to open a new "question")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants