aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/postprocessor
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-02-10 00:07:10 +0530
committerpukkandan <pukkandan@gmail.com>2021-02-10 00:12:42 +0530
commitcffab0eefcb7207949dd100523d6be89ddd55ee5 (patch)
tree7bbf81388e28b67f8a27dd30728c1eab93778cb2 /youtube_dlc/postprocessor
parent2e339f59c3c5a683596976da8ba925f3e92bd425 (diff)
downloadhypervideo-pre-cffab0eefcb7207949dd100523d6be89ddd55ee5.tar.lz
hypervideo-pre-cffab0eefcb7207949dd100523d6be89ddd55ee5.tar.xz
hypervideo-pre-cffab0eefcb7207949dd100523d6be89ddd55ee5.zip
[embedsubtitle] Keep original subtitle after conversion if write_subtitles given
Closes: https://github.com/pukkandan/yt-dlp/issues/57#issuecomment-775227745 :ci skip dl
Diffstat (limited to 'youtube_dlc/postprocessor')
-rw-r--r--youtube_dlc/postprocessor/ffmpeg.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dlc/postprocessor/ffmpeg.py b/youtube_dlc/postprocessor/ffmpeg.py
index 948c34287..cabe7266e 100644
--- a/youtube_dlc/postprocessor/ffmpeg.py
+++ b/youtube_dlc/postprocessor/ffmpeg.py
@@ -442,6 +442,10 @@ class FFmpegVideoConvertorPP(FFmpegPostProcessor):
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
+ def __init__(self, downloader=None, already_have_subtitle=False):
+ super(FFmpegEmbedSubtitlePP, self).__init__(downloader)
+ self._already_have_subtitle = already_have_subtitle
+
def run(self, information):
if information['ext'] not in ('mp4', 'webm', 'mkv'):
self.to_screen('Subtitles can only be embedded in mp4, webm or mkv files')
@@ -501,7 +505,8 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
- return sub_filenames, information
+ files_to_delete = [] if self._already_have_subtitle else sub_filenames
+ return files_to_delete, information
class FFmpegMetadataPP(FFmpegPostProcessor):