aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-10-09 21:48:46 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-10-09 22:19:23 +0530
commit4e3b637d5be70b92ee511743405f3c907fed20f6 (patch)
tree0890cbf631e6340201d4f162cc0b895b77659434
parent8cd69fc40786d081b5523f9dc20861c130a2843d (diff)
downloadhypervideo-pre-4e3b637d5be70b92ee511743405f3c907fed20f6.tar.lz
hypervideo-pre-4e3b637d5be70b92ee511743405f3c907fed20f6.tar.xz
hypervideo-pre-4e3b637d5be70b92ee511743405f3c907fed20f6.zip
Merge webm formats into mkv if thumbnails are to be embedded
This was originally implemented in 4d971a16b831a45147b6ae7ce53b3e105d204da7 (#173) by @damianoamatruda but was reverted in 3b297919e046082cc4ab26ecb959d9f4f584102b since it was unintentionally being triggered for `write_thumbnail` (See #500)
-rw-r--r--yt_dlp/YoutubeDL.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 1d865161a..398fb67af 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -137,6 +137,7 @@ from .downloader import (
from .downloader.rtmp import rtmpdump_version
from .postprocessor import (
get_postprocessor,
+ EmbedThumbnailPP,
FFmpegFixupDurationPP,
FFmpegFixupM3u8PP,
FFmpegFixupM4aPP,
@@ -2696,10 +2697,19 @@ class YoutubeDL(object):
requested_formats = info_dict['requested_formats']
old_ext = info_dict['ext']
- if self.params.get('merge_output_format') is None and not compatible_formats(requested_formats):
- info_dict['ext'] = 'mkv'
- self.report_warning(
- 'Requested formats are incompatible for merge and will be merged into mkv.')
+ if self.params.get('merge_output_format') is None:
+ if not compatible_formats(requested_formats):
+ info_dict['ext'] = 'mkv'
+ self.report_warning(
+ 'Requested formats are incompatible for merge and will be merged into mkv')
+ if (info_dict['ext'] == 'webm'
+ and info_dict.get('thumbnails')
+ # check with type instead of pp_key, __name__, or isinstance
+ # since we dont want any custom PPs to trigger this
+ and any(type(pp) == EmbedThumbnailPP for pp in self._pps['post_process'])):
+ info_dict['ext'] = 'mkv'
+ self.report_warning(
+ 'webm doesn\'t support embedding a thumbnail, mkv will be used')
new_ext = info_dict['ext']
def correct_ext(filename, ext=new_ext):