tryna make subtitles. so basically im using fast-whisper https://github.com/SYSTRAN/faster-whisper basically takes an audio file and uses AI to break it up into segments and has like the start time and end time for a sentence.
i want to have a video, and then use TextClips for that show for every sentence so it matches along with the audio. i can share my code i just dont really understand it. I've been doing good building most of this project but this movie py and subtitle stuff i really dont get, any help would be appreciated!
from moviepy import VideoFileClip, TextClip, CompositeVideoClip
from subtitles import segment
clip = VideoFileClip('test.mp4')
segments = segment('output/test.wav')
subtitle_clips = []
for seg in segments:
txt_clip = TextClip(
seg.text,
fontsize=80,
color="white",
font="Arial-Bold"
).set_start(seg.start).set_end(seg.end)
subtitle_clips.append(txt_clip)
final_clip = CompositeVideoClip([clip, *subtitle_clips])
final_clip.write_videofile("video_with_subs.mp4")
lmk if u need to see segment.py! a quick overview is just its a func that returns a liss like this
[
(start, end, text),
(start, end, text),
(start, end, text),
]