mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[postprocessor/embedthumbnail] Add conversion for non JPG/PNG images
This commit is contained in:
parent
2391941f28
commit
777d5a45be
1 changed files with 10 additions and 0 deletions
|
@ -41,6 +41,16 @@ def run(self, info):
|
||||||
'Skipping embedding the thumbnail because the file is missing.')
|
'Skipping embedding the thumbnail because the file is missing.')
|
||||||
return [], info
|
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':
|
if info['ext'] == 'mp3':
|
||||||
options = [
|
options = [
|
||||||
'-c', 'copy', '-map', '0', '-map', '1',
|
'-c', 'copy', '-map', '0', '-map', '1',
|
||||||
|
|
Loading…
Reference in a new issue