mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
Merge 44311d7126
into f919729538
This commit is contained in:
commit
cf4ad23c63
|
@ -947,6 +947,8 @@ class FFmpegFixupDuplicateMoovPP(FFmpegCopyStreamPP):
|
||||||
|
|
||||||
class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
|
class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
|
||||||
SUPPORTED_EXTS = MEDIA_EXTENSIONS.subtitles
|
SUPPORTED_EXTS = MEDIA_EXTENSIONS.subtitles
|
||||||
|
_DFXP_EXTS = ('dfxp', 'ttml', 'tt')
|
||||||
|
_SUPPORTED_INPUT_EXTS = (*SUPPORTED_EXTS, *_DFXP_EXTS)
|
||||||
|
|
||||||
def __init__(self, downloader=None, format=None):
|
def __init__(self, downloader=None, format=None):
|
||||||
super().__init__(downloader)
|
super().__init__(downloader)
|
||||||
|
@ -965,22 +967,22 @@ def run(self, info):
|
||||||
sub_filenames = []
|
sub_filenames = []
|
||||||
for lang, sub in subs.items():
|
for lang, sub in subs.items():
|
||||||
if not os.path.exists(sub.get('filepath', '')):
|
if not os.path.exists(sub.get('filepath', '')):
|
||||||
self.report_warning(f'Skipping embedding {lang} subtitle because the file is missing')
|
self.report_warning(f'Skipping converting {lang} subtitle because the file is missing')
|
||||||
continue
|
continue
|
||||||
ext = sub['ext']
|
ext = sub['ext']
|
||||||
if ext == new_ext:
|
if ext == new_ext:
|
||||||
self.to_screen(f'Subtitle file for {new_ext} is already in the requested format')
|
self.to_screen(f'Subtitle file for {new_ext} is already in the requested format')
|
||||||
continue
|
continue
|
||||||
elif ext == 'json':
|
elif ext not in self._SUPPORTED_INPUT_EXTS:
|
||||||
self.to_screen(
|
self.to_screen(
|
||||||
'You have requested to convert json subtitles into another format, '
|
f'You have requested to convert {ext} subtitles into another format, '
|
||||||
'which is currently not possible')
|
'which is currently not possible')
|
||||||
continue
|
continue
|
||||||
old_file = sub['filepath']
|
old_file = sub['filepath']
|
||||||
sub_filenames.append(old_file)
|
sub_filenames.append(old_file)
|
||||||
new_file = replace_extension(old_file, new_ext)
|
new_file = replace_extension(old_file, new_ext)
|
||||||
|
|
||||||
if ext in ('dfxp', 'ttml', 'tt'):
|
if ext in self._DFXP_EXTS:
|
||||||
self.report_warning(
|
self.report_warning(
|
||||||
'You have requested to convert dfxp (TTML) subtitles into another format, '
|
'You have requested to convert dfxp (TTML) subtitles into another format, '
|
||||||
'which results in style information loss')
|
'which results in style information loss')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user