whisper_transcribe / video_tool.py
chompionsawelo's picture
minor fixes
7b2cb15
raw
history blame
578 Bytes
import ffmpeg
def convert_video_to_audio(input_file, output_file, start_time, end_time):
(
ffmpeg
.input(input_file, ss=start_time, to=end_time)
.output(output_file, format="wav", acodec='pcm_s16le')
.run(overwrite_output=True)
)
def add_subtitle_to_video(input_file, subtitle_file, output_file, start_time, end_time):
(
ffmpeg
.input(input_file, ss=start_time, to=end_time)
.output(output_file, vf='subtitles=' + subtitle_file, preset='ultrafast', acodec='copy')
.run(overwrite_output=True)
)