Skip to content

Commit

Permalink
[postprocessor/embedthumbnail] Add conversion for non JPG/PNG images
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmerkel committed Jun 18, 2020
1 parent 2391941 commit 777d5a4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions youtube_dl/postprocessor/embedthumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def run(self, info):
'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',
Expand Down

0 comments on commit 777d5a4

Please sign in to comment.