diff options
author | pukkandan <pukkandan@gmail.com> | 2021-01-08 00:58:41 +0530 |
---|---|---|
committer | pukkandan <pukkandan@gmail.com> | 2021-01-08 01:41:08 +0530 |
commit | 1b77b347d422ed70fd833a9f0327ea418ba4919c (patch) | |
tree | 35232d3f241acdc6ce794d37418e34adbcd37d8d /youtube_dlc/postprocessor/embedthumbnail.py | |
parent | 6c40e33c9e97bd32cece9b12e5e90ed66fa1fcb8 (diff) | |
download | hypervideo-pre-1b77b347d422ed70fd833a9f0327ea418ba4919c.tar.lz hypervideo-pre-1b77b347d422ed70fd833a9f0327ea418ba4919c.tar.xz hypervideo-pre-1b77b347d422ed70fd833a9f0327ea418ba4919c.zip |
Allow passing different arguments to different postprocessors
* Also deprecated --sponskrub-args
Closes: https://github.com/ytdl-org/youtube-dl/issues/27593
Eg: `--postprocessor-args "VideoConvertor:-c:v h264_nvenc -preset slow"`
Eg: `--postprocessor-args "SponsKrub:-include-selfpromo"`
For backward compatibility, `--postprocessor-args args` is equivalent to:
`--post-processor-args "sponskrub:" --post-processor-args "default:args"`
Diffstat (limited to 'youtube_dlc/postprocessor/embedthumbnail.py')
-rw-r--r-- | youtube_dlc/postprocessor/embedthumbnail.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dlc/postprocessor/embedthumbnail.py b/youtube_dlc/postprocessor/embedthumbnail.py index 50678669f..aaf58e0a0 100644 --- a/youtube_dlc/postprocessor/embedthumbnail.py +++ b/youtube_dlc/postprocessor/embedthumbnail.py @@ -23,6 +23,8 @@ class EmbedThumbnailPPError(PostProcessingError): class EmbedThumbnailPP(FFmpegPostProcessor): + PP_NAME = 'EmbedThumbnail' + def __init__(self, downloader=None, already_have_thumbnail=False): super(EmbedThumbnailPP, self).__init__(downloader) self._already_have_thumbnail = already_have_thumbnail @@ -32,7 +34,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): temp_filename = prepend_extension(filename, 'temp') if not info.get('thumbnails'): - self._downloader.to_screen('[embedthumbnail] There aren\'t any thumbnails to embed') + self.to_screen('There aren\'t any thumbnails to embed') return [], info thumbnail_filename = info['thumbnails'][-1]['filename'] @@ -52,8 +54,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): if thumbnail_ext: thumbnail_ext = thumbnail_ext[1:].lower() if thumbnail_ext != 'webp' and is_webp(thumbnail_filename): - self._downloader.to_screen( - '[ffmpeg] Correcting extension to webp and escaping path for thumbnail "%s"' % thumbnail_filename) + self.to_screen('Correcting extension to webp and escaping path for thumbnail "%s"' % thumbnail_filename) thumbnail_webp_filename = replace_extension(thumbnail_filename, 'webp') os.rename(encodeFilename(thumbnail_filename), encodeFilename(thumbnail_webp_filename)) thumbnail_filename = thumbnail_webp_filename @@ -66,7 +67,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): escaped_thumbnail_filename = thumbnail_filename.replace('%', '#') os.rename(encodeFilename(thumbnail_filename), encodeFilename(escaped_thumbnail_filename)) escaped_thumbnail_jpg_filename = replace_extension(escaped_thumbnail_filename, 'jpg') - self._downloader.to_screen('[ffmpeg] Converting thumbnail "%s" to JPEG' % escaped_thumbnail_filename) + self.to_screen('Converting thumbnail "%s" to JPEG' % escaped_thumbnail_filename) self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-bsf:v', 'mjpeg2jpeg']) os.remove(encodeFilename(escaped_thumbnail_filename)) thumbnail_jpg_filename = replace_extension(thumbnail_filename, 'jpg') @@ -79,7 +80,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): '-c', 'copy', '-map', '0:0', '-map', '1:0', '-id3v2_version', '3', '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (front)"'] - self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename) + self.to_screen('Adding thumbnail to "%s"' % filename) self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options) @@ -99,7 +100,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): '-c', 'copy', '-map', '0', '-dn', '-attach', thumbnail_filename, '-metadata:s:t', 'mimetype=image/jpeg'] - self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename) + self.to_screen('Adding thumbnail to "%s"' % filename) self.run_ffmpeg_multiple_files([filename], temp_filename, options) @@ -121,7 +122,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): encodeArgument('-o'), encodeFilename(temp_filename, True)] - self._downloader.to_screen('[atomicparsley] Adding thumbnail to "%s"' % filename) + self.to_screen('Adding thumbnail to "%s"' % filename) if self._downloader.params.get('verbose', False): self._downloader.to_screen('[debug] AtomicParsley command line: %s' % shell_quote(cmd)) |