diff options
author | Alex Merkel <mail@alexmerkel.com> | 2020-06-18 22:36:44 +0200 |
---|---|---|
committer | Alex Merkel <mail@alexmerkel.com> | 2020-06-18 22:36:44 +0200 |
commit | 777d5a45be81fb1f274c8c558ba1eb24855c66fc (patch) | |
tree | f2ff1437e979e12449919c7f37734d90569b3ad2 /youtube_dl/postprocessor/embedthumbnail.py | |
parent | 2391941f283a1107b01f9df76a8b0e521a5abe3b (diff) |
[postprocessor/embedthumbnail] Add conversion for non JPG/PNG images
Diffstat (limited to 'youtube_dl/postprocessor/embedthumbnail.py')
-rw-r--r-- | youtube_dl/postprocessor/embedthumbnail.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py index 56be914b8..a5939a7d3 100644 --- a/youtube_dl/postprocessor/embedthumbnail.py +++ b/youtube_dl/postprocessor/embedthumbnail.py @@ -41,6 +41,16 @@ class EmbedThumbnailPP(FFmpegPostProcessor): 'Skipping embedding the thumbnail because the file is missing.') return [], info + if not os.path.splitext(encodeFilename(thumbnail_filename))[1].lower() in ['.jpg', '.png']: + jpg_thumbnail_filename = thumbnail_filename + ".jpg" + + self._downloader.to_screen('[ffmpeg] Converting thumbnail "%s" to JPEG' % thumbnail_filename) + + self.run_ffmpeg(thumbnail_filename, jpg_thumbnail_filename, ['-bsf:v', 'mjpeg2jpeg']) + + os.remove(thumbnail_filename) + thumbnail_filename = jpg_thumbnail_filename + if info['ext'] == 'mp3': options = [ '-c', 'copy', '-map', '0', '-map', '1', |