aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-10-02 22:36:31 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-10-04 03:08:26 +0530
commita1c3967307053767d8c44a5814c88610fe6c4860 (patch)
tree541eb5e11eb425d88994a1b17e9623e51d018140
parente919569e6792b59c5e6826bf2e6b4ca874eb011d (diff)
downloadhypervideo-pre-a1c3967307053767d8c44a5814c88610fe6c4860.tar.lz
hypervideo-pre-a1c3967307053767d8c44a5814c88610fe6c4860.tar.xz
hypervideo-pre-a1c3967307053767d8c44a5814c88610fe6c4860.zip
[EmbedSubtitle, SubtitlesConvertor] Fix error when subtitle file is missing
Closes #1152, #1134 Bug from 8e25d624df003d691be922488d6ab7007f75333d
-rw-r--r--yt_dlp/postprocessor/ffmpeg.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 311170920..6bb66569a 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -555,7 +555,7 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
mp4_ass_warn = False
for lang, sub_info in subtitles.items():
- if not os.path.exists(information.get('filepath', '')):
+ if not os.path.exists(sub_info.get('filepath', '')):
self.report_warning(f'Skipping embedding {lang} subtitle because the file is missing')
continue
sub_ext = sub_info['ext']
@@ -845,6 +845,9 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor):
self.to_screen('Converting subtitles')
sub_filenames = []
for lang, sub in subs.items():
+ if not os.path.exists(sub.get('filepath', '')):
+ self.report_warning(f'Skipping embedding {lang} subtitle because the file is missing')
+ continue
ext = sub['ext']
if ext == new_ext:
self.to_screen('Subtitle file for %s is already in the requested format' % new_ext)