aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/postprocessor/embedthumbnail.py
diff options
context:
space:
mode:
authorMrDoritos <ianmoore322@gmail.com>2019-10-08 19:52:03 -0600
committerMrDoritos <ianmoore322@gmail.com>2019-10-08 19:52:03 -0600
commit4c8cabe8aed2123f9f2f99e3fe209f69a17a7e9b (patch)
tree6352a2d7941a8165439ef523fb4414e3eab2a2ca /youtube_dl/postprocessor/embedthumbnail.py
parent560d3b7d7c86a0bfff36d59cb977fd3c01b10ad8 (diff)
downloadhypervideo-pre-4c8cabe8aed2123f9f2f99e3fe209f69a17a7e9b.tar.lz
hypervideo-pre-4c8cabe8aed2123f9f2f99e3fe209f69a17a7e9b.tar.xz
hypervideo-pre-4c8cabe8aed2123f9f2f99e3fe209f69a17a7e9b.zip
[MKV Thumbnail Support] MKV Thumbnails with FFMpeg
Diffstat (limited to 'youtube_dl/postprocessor/embedthumbnail.py')
-rw-r--r--youtube_dl/postprocessor/embedthumbnail.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py
index 56be914b8..acb7958c9 100644
--- a/youtube_dl/postprocessor/embedthumbnail.py
+++ b/youtube_dl/postprocessor/embedthumbnail.py
@@ -55,6 +55,19 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
+ if info['ext'] == 'mkv':
+ 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))
+ 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.')