Spaces:
Runtime error
Runtime error
Commit
·
08d75db
1
Parent(s):
3179a73
minor fixes
Browse files- video_tool.py +13 -4
video_tool.py
CHANGED
@@ -2,10 +2,19 @@ import ffmpeg
|
|
2 |
|
3 |
|
4 |
def convert_video_to_audio(input_file, output_file, start_time, end_time):
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
def add_subtitle_to_video(input_file, subtitle_file, output_file, start_time, end_time):
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
|
4 |
def convert_video_to_audio(input_file, output_file, start_time, end_time):
|
5 |
+
(
|
6 |
+
ffmpeg
|
7 |
+
.input(input_file, ss=start_time, to=end_time)
|
8 |
+
.audio
|
9 |
+
.output(output_file, format="wav")
|
10 |
+
.run(overwrite_output=True)
|
11 |
+
)
|
12 |
|
13 |
|
14 |
def add_subtitle_to_video(input_file, subtitle_file, output_file, start_time, end_time):
|
15 |
+
(
|
16 |
+
ffmpeg
|
17 |
+
.input(input_file, ss=start_time, to=end_time)
|
18 |
+
.output(output_file, vf='subtitles=' + subtitle_file, preset='ultrafast', acodec='copy')
|
19 |
+
.run(overwrite_output=True)
|
20 |
+
)
|