Commit
·
250eb65
1
Parent(s):
b15e671
FIX: video formatting and resolution is now same as input video.
Browse files- utils/subtitler.py +2 -2
utils/subtitler.py
CHANGED
@@ -32,7 +32,7 @@ def subtitler(video_file:str,
|
|
32 |
video_file = os.path.abspath(video_file)
|
33 |
srt_path = os.path.abspath(srt_path)
|
34 |
output_file = os.path.abspath(output_file)
|
35 |
-
clip = VideoFileClip(video_file)
|
36 |
subtitles = parse_srt(srt_path)
|
37 |
subtitle_clips = []
|
38 |
for start, end, text in subtitles:
|
@@ -44,5 +44,5 @@ def subtitler(video_file:str,
|
|
44 |
subtitle_y_position = clip.h * 4 / 5
|
45 |
text_position = (subtitle_x_position, subtitle_y_position)
|
46 |
subtitle_clips.append(txt_clip.set_position(text_position))
|
47 |
-
video = CompositeVideoClip([clip] + subtitle_clips)
|
48 |
video.write_videofile(output_file, codec='libx264', audio_codec='aac')
|
|
|
32 |
video_file = os.path.abspath(video_file)
|
33 |
srt_path = os.path.abspath(srt_path)
|
34 |
output_file = os.path.abspath(output_file)
|
35 |
+
clip = VideoFileClip(filename=video_file, target_resolution=None, resize_algorithm='bitexact')
|
36 |
subtitles = parse_srt(srt_path)
|
37 |
subtitle_clips = []
|
38 |
for start, end, text in subtitles:
|
|
|
44 |
subtitle_y_position = clip.h * 4 / 5
|
45 |
text_position = (subtitle_x_position, subtitle_y_position)
|
46 |
subtitle_clips.append(txt_clip.set_position(text_position))
|
47 |
+
video = CompositeVideoClip(size=(clip.h,clip.w), clips=[clip] + subtitle_clips)
|
48 |
video.write_videofile(output_file, codec='libx264', audio_codec='aac')
|