chompionsawelo commited on
Commit
ce07bfe
·
1 Parent(s): bef4887

subtitle setup fix

Browse files
Files changed (1) hide show
  1. video_tool.py +9 -1
video_tool.py CHANGED
@@ -18,9 +18,17 @@ def add_subtitle_to_video(input_file, subtitle_file, output_file, start_time, en
18
  print(f"INPUT: {input_file}")
19
  print(f"SUBTITLE: {subtitle_file}")
20
  print(f"OUTPUT: {output_file}")
 
21
  (
22
  ffmpeg
23
  .input(input_file)
24
- .output(output_file, ss=start_time, to=end_time, vf='subtitles=' + subtitle_file, preset='ultrafast', acodec='copy')
 
 
 
 
 
 
 
25
  .run(overwrite_output=True)
26
  )
 
18
  print(f"INPUT: {input_file}")
19
  print(f"SUBTITLE: {subtitle_file}")
20
  print(f"OUTPUT: {output_file}")
21
+ # 1: Add subtitle
22
  (
23
  ffmpeg
24
  .input(input_file)
25
+ .output(output_file, vf='subtitles=' + subtitle_file, acodec='copy')
26
+ .run(overwrite_output=True)
27
+ )
28
+ # 2: Cut the video
29
+ (
30
+ ffmpeg
31
+ .input(output_file)
32
+ .output(output_file, ss=start_time, to=end_time, acodec='copy')
33
  .run(overwrite_output=True)
34
  )