]> jfr.im git - yt-dlp.git/commitdiff
Merge webm formats into mkv if thumbnails are to be embedded (#173)
authorpukkandan <redacted>
Fri, 19 Mar 2021 11:01:22 +0000 (16:31 +0530)
committerpukkandan <redacted>
Sat, 20 Mar 2021 04:04:52 +0000 (09:34 +0530)
Co-authored by: Damiano Amatruda <redacted>

yt_dlp/YoutubeDL.py

index 8681a18e9126da09fd690c97fc1f31cc6ba87c9b..1e46b76b58ea01680bf6403daac26cce31175d83 100644 (file)
@@ -2343,10 +2343,17 @@ def compatible_formats(formats):
 
                     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 self.params.get('writethumbnail', False)
+                                and info_dict.get('thumbnails')):
+                            info_dict['ext'] = 'mkv'
+                            self.report_warning(
+                                'webm doesn\'t support embedding a thumbnail, mkv will be used.')
 
                     def correct_ext(filename):
                         filename_real_ext = os.path.splitext(filename)[1][1:]