Fixed subtitles sync function to preserve subtitles file extension. #2399

This commit is contained in:
JayZed 2024-02-26 06:28:51 -05:00 committed by GitHub
parent 6ba720969e
commit f71b8931e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -35,7 +35,13 @@ class SubSyncer:
no_fix_framerate=settings.subsync.no_fix_framerate, gss=settings.subsync.gss):
self.reference = video_path
self.srtin = srt_path
self.srtout = f'{os.path.splitext(self.srtin)[0]}.synced.srt'
if self.srtin.casefold().endswith('.ass'):
# try to preserve original subtitle style
# ffmpeg will be able to handle this automatically as long as it has the libass filter
extension = '.ass'
else:
extension = '.srt'
self.srtout = f'{os.path.splitext(self.srtin)[0]}.synced{extension}'
self.args = None
ffprobe_exe = get_binary('ffprobe')