From 2c40837609aefab8d23201611e362876b52a78fe Mon Sep 17 00:00:00 2001 From: kikuyan Date: Thu, 12 Aug 2021 09:04:16 +0900 Subject: [PATCH] [postprocessor/ffmpeg] remove intermediate srt format files --- youtube_dl/postprocessor/ffmpeg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 9f76c9d4e..b03fb53c5 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -614,6 +614,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor): return [], info self._downloader.to_screen('[ffmpeg] Converting subtitles') sub_filenames = [] + temp_srt_filenames = [] for lang, sub in subs.items(): ext = sub['ext'] if ext == new_ext: @@ -647,7 +648,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor): if new_ext == 'srt': continue else: - sub_filenames.append(srt_file) + temp_srt_filenames.append(srt_file) self.run_ffmpeg(old_file, new_file, ['-f', new_format]) @@ -657,4 +658,7 @@ class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor): 'data': f.read(), } + for f in temp_srt_filenames: + os.remove(encodeFilename(f)) + return sub_filenames, info