aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/postprocessor/embedthumbnail.py
diff options
context:
space:
mode:
authorTom-Oliver Heidel <blackjack4494@web.de>2020-09-06 02:43:42 +0200
committerTom-Oliver Heidel <blackjack4494@web.de>2020-09-06 02:43:42 +0200
commitea40ffd1e10543e6b97134ef0f3c2071ccfd637d (patch)
treee45badaf330189848fb76530e93c5f08b692e31d /youtube_dlc/postprocessor/embedthumbnail.py
parent115c36053623e5ef8854898a2bff61341387b5eb (diff)
parent3c0c0b428d61255f575c8018ff854f40ef59edc6 (diff)
downloadhypervideo-pre-ea40ffd1e10543e6b97134ef0f3c2071ccfd637d.tar.lz
hypervideo-pre-ea40ffd1e10543e6b97134ef0f3c2071ccfd637d.tar.xz
hypervideo-pre-ea40ffd1e10543e6b97134ef0f3c2071ccfd637d.zip
Merge branch 'MrDoritos-mkvthumbnail'
Diffstat (limited to 'youtube_dlc/postprocessor/embedthumbnail.py')
-rw-r--r--youtube_dlc/postprocessor/embedthumbnail.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/youtube_dlc/postprocessor/embedthumbnail.py b/youtube_dlc/postprocessor/embedthumbnail.py
index e2002ab0b..e66558ea6 100644
--- a/youtube_dlc/postprocessor/embedthumbnail.py
+++ b/youtube_dlc/postprocessor/embedthumbnail.py
@@ -77,6 +77,25 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
+ elif info['ext'] == 'mkv':
+ os.rename(encodeFilename(thumbnail_filename), encodeFilename('cover.jpg'))
+ old_thumbnail_filename = thumbnail_filename
+ thumbnail_filename = 'cover.jpg'
+
+ options = [
+ '-c', 'copy', '-attach', thumbnail_filename, '-metadata:s:t', 'mimetype=image/jpeg']
+
+ self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename)
+
+ self.run_ffmpeg_multiple_files([filename], temp_filename, options)
+
+ if not self._already_have_thumbnail:
+ os.remove(encodeFilename(thumbnail_filename))
+ else:
+ os.rename(encodeFilename(thumbnail_filename), encodeFilename(old_thumbnail_filename))
+ os.remove(encodeFilename(filename))
+ os.rename(encodeFilename(temp_filename), encodeFilename(filename))
+
elif info['ext'] in ['m4a', 'mp4']:
if not check_executable('AtomicParsley', ['-v']):
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.')