Spaces:
Runtime error
Runtime error
import ffmpeg | |
import file_name | |
def convert_video_to_audio(input_file, output_file, start_time, end_time): | |
print(f"INPUT: {input_file}") | |
print(f"OUTPUT: {output_file}") | |
( | |
ffmpeg | |
.input(input_file) | |
.output(output_file, ss=start_time, to=end_time, format="wav", acodec='pcm_s16le') | |
.run(overwrite_output=True) | |
) | |
def add_subtitle_to_video(input_file, subtitle_file, output_file, start_time, end_time): | |
print(f"INPUT: {input_file}") | |
print(f"SUBTITLE: {subtitle_file}") | |
print(f"OUTPUT: {output_file}") | |
( | |
ffmpeg | |
.input(input_file) | |
.output(file_name.cut_video_file, ss=start_time, to=end_time, acodec='copy', vcodec='copy') | |
.run(overwrite_output=True) | |
) | |
( | |
ffmpeg | |
.input(file_name.cut_video_file) | |
.output(output_file, vf=f'subtitles={subtitle_file}', acodec='copy') | |
.run(overwrite_output=True) | |
) | |