mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 08:08:57 +00:00
[MKV Thumbnail Support] Now has the correct file name in MKV container
This commit is contained in:
parent
73453430c1
commit
62566a41b2
|
@ -55,6 +55,25 @@ def run(self, info):
|
||||||
os.remove(encodeFilename(filename))
|
os.remove(encodeFilename(filename))
|
||||||
os.rename(encodeFilename(temp_filename), 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']:
|
elif info['ext'] in ['m4a', 'mp4']:
|
||||||
if not check_executable('AtomicParsley', ['-v']):
|
if not check_executable('AtomicParsley', ['-v']):
|
||||||
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.')
|
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.')
|
||||||
|
|
Loading…
Reference in a new issue