--custom-meta option to write specific information to tags, for --add-metadata
Syntax: --custom-meta "TAGNAME=string with optional %(format)s" Example: --custom-meta "comment=%(webpage_url)s\n%(description)s" This can be invoked multiple times for different tags. Example 2: youtube-dl --add-metadata -f 18 --meta 'artist=%(uploader_id)s' --meta 'comment=url: %(webpage_url)s\nviews: %(view_count)s / Rating: %(average_rating)s\n\n%(description)s' https://www.youtube.com/watch?v=WzhW20hLp6M (snip) [ffmpeg] Adding metadata to 'Breaking Bad Remix (Seasons 3-5)-WzhW20hLp6M.mp4' mp4info Breaking\ Bad\ Remix\ \(Seasons\ 3-5\)-WzhW20hLp6M.mp4 (snip) Artist: uploader: placeboing Comments: url: https://www.youtube.com/watch?v=WzhW20hLp6M views: 5601679 / Rating: 4.97684526443 Music and remixing by me. Seasons 1 and 2 remix: http://www.youtube.com/watch?v=WsqdmqRgrIc MP3 download: https://www.dropbox.com/s/39luqbbi5cu36du/Chris%20Lohr%20-%20Breaking%20Bad%20Remix%20seasons%203-5.mp3
This commit is contained in:
parent
e20d0c1e69
commit
4292fd3371
@ -367,6 +367,7 @@ def _real_main(argv=None):
|
||||
'hls_prefer_native': opts.hls_prefer_native,
|
||||
'external_downloader_args': external_downloader_args,
|
||||
'cn_verification_proxy': opts.cn_verification_proxy,
|
||||
'custommeta': opts.custommeta,
|
||||
}
|
||||
|
||||
with YoutubeDL(ydl_opts) as ydl:
|
||||
|
@ -707,6 +707,16 @@ def parseOpts(overrideArguments=None):
|
||||
'--add-metadata',
|
||||
action='store_true', dest='addmetadata', default=False,
|
||||
help='Write metadata to the video file')
|
||||
postproc.add_option(
|
||||
'--custom-meta',
|
||||
action='append', dest='custommeta', default=[],
|
||||
help='Write specific information to a metadata tag.'
|
||||
'Syntax: "tagname=string to add with %(format)s" '
|
||||
'The formatting syntax is the same as output. '
|
||||
'Example: --custom-meta "comment=%(webpage_url)s\\n%(description)s" will '
|
||||
'add a line with the url, then the description in the "comment" tag. '
|
||||
'Tags are format-specific, common ones include: artist, comment, title, copyright, uploader. '
|
||||
'This can be invoked multiple times for different tags.')
|
||||
postproc.add_option(
|
||||
'--metadata-from-title',
|
||||
metavar='FORMAT', dest='metafromtitle',
|
||||
|
@ -367,6 +367,10 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
|
||||
if info.get('album') is not None:
|
||||
metadata['album'] = info['album']
|
||||
|
||||
for m in self._downloader.params.get('custommeta'):
|
||||
key,val = m.split('=',1)
|
||||
metadata[key] = val.replace('\\n', '\n') % info
|
||||
|
||||
if not metadata:
|
||||
self._downloader.to_screen('[ffmpeg] There isn\'t any metadata to add')
|
||||
return [], info
|
||||
|
Loading…
x
Reference in New Issue
Block a user