ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.91k stars 10k forks source link

--add-metadata adding background song title instead of video title #28499

Open smnthermes opened 3 years ago

smnthermes commented 3 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: ['-f', 'bestvideo[height<=1080]+bestaudio/best']
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '--add-metadata', 'https://www.youtube.com/watch?v=ihFkyPv1jtU']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.03.14
[debug] Python version 3.8.5 (CPython) - Linux-5.4.0-66-generic-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] ihFkyPv1jtU: Downloading webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Mercury Poisoning- The Minamata Story-ihFkyPv1jtU.mkv has already been downloaded and merged
[ffmpeg] Adding metadata to 'Mercury Poisoning- The Minamata Story-ihFkyPv1jtU.mkv'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Mercury Poisoning- The Minamata Story-ihFkyPv1jtU.mkv' -c copy -metadata 'title=HIDDEN CITY' -metadata date=20090319 -metadata 'description=A short clip about industrial mercury poisoning at Minamata Bay, Japan.' -metadata 'comment=A short clip about industrial mercury poisoning at Minamata Bay, Japan.' -metadata 'purl=https://www.youtube.com/watch?v=ihFkyPv1jtU' -metadata 'artist=PHIL DAVIES' -metadata 'album=Drama Concepts' 'file:Mercury Poisoning- The Minamata Story-ihFkyPv1jtU.temp.mkv'

Description

Q.E.D.

qgustavor commented 3 years ago

It was been reported before and closed as "expected behavior". The problem is how FFmpegMetadataPP, which handles --add-metadata, handles metadata from multiple sources.

As an example the current behavior for track is using the detected track, otherwise the title. This behavior, although it's useful and works for many cases, helping to normalize music titles avoiding things as "[Artist] - [Song Title]", fails in many situations where the main content from a video isn't the detected song.

I can think two ways to improve this:

The second way would be more user friendly as it would fix cases where someone uses some song in their video when the video isn't about the song, although it would not fix cases where someone makes a video about a song but the video isn't the song itself (like videos where someone talks about a song and ends putting parts of it in the video).

Edit: I ended using --write-info-json --write-thumbnail and writing a separate script to handle those. Thumbnails are cropped using an attention based crop: no more cropped heads in thumbnails!

toscompliantname commented 3 years ago

What did he mean by this?