Skip to content

Commit 016abf5

Browse files
authored
Add files via upload
1 parent c4dd05a commit 016abf5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

autosrt/autosrt.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import six
2222
import shlex
2323

24-
VERSION = "1.3.2"
24+
VERSION = "1.3.3"
2525

2626

2727
#======================================================== ffmpeg_progress_yield ========================================================#
@@ -1661,9 +1661,9 @@ def ffmpeg_check():
16611661
return "ffmpeg.exe"
16621662
return None
16631663

1664-
def __init__(self, media_ext=None, subtitle_path=None, output_path=None, progress_callback=None, error_messages_callback=None):
1665-
self.media_ext = media_ext
1664+
def __init__(self, subtitle_path=None, language="eng", output_path=None, progress_callback=None, error_messages_callback=None):
16661665
self.subtitle_path = subtitle_path
1666+
self.language = language
16671667
self.output_path = output_path
16681668
self.progress_callback = progress_callback
16691669
self.error_messages_callback = error_messages_callback
@@ -1696,10 +1696,18 @@ def __call__(self, media_filepath):
16961696
"ffmpeg",
16971697
"-y",
16981698
"-i", media_filepath,
1699-
"-vf", f"subtitles={shlex.quote(self.subtitle_path)}",
1700-
self.output_path
1699+
"-sub_charenc", "UTF-8",
1700+
"-i", self.subtitle_path,
1701+
"-c:v", "copy",
1702+
"-c:a", "copy",
1703+
"-scodec", "mov_text",
1704+
"-metadata:s:s:0",
1705+
f"language={shlex.quote(self.language)}",
1706+
"-f", "mp4",
1707+
"-y", self.output_path
17011708
]
17021709

1710+
17031711
ff = FfmpegProgress(ffmpeg_command)
17041712
percentage = 0
17051713
for progress in ff.run_command_with_progress():

0 commit comments

Comments
 (0)