Spaces:
Runtime error
Runtime error
File size: 934 Bytes
e698260 9002374 e698260 e166a5f f36ca6d eb6aaad 39d50e3 f36ca6d eb6aaad 39d50e3 e698260 f36ca6d e698260 e166a5f 9002374 08d75db f36ca6d 35ce1cb ce07bfe 9002374 ce07bfe 9002374 08d75db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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)
)
|