Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,9 +12,10 @@ def load_video_yt(vid):
|
|
12 |
print (f'Video Length: {yt.length}')
|
13 |
return f"{uid}-tmp.mp4"
|
14 |
|
15 |
-
def trim_vid():
|
16 |
-
|
17 |
-
|
|
|
18 |
|
19 |
def trim_clip(clip, start_t, end_t):
|
20 |
clip = Path(f"{uid}-tmp_aud.mp4")
|
@@ -41,9 +42,13 @@ with gr.Blocks() as app:
|
|
41 |
inp_url=gr.Textbox(label="URL")
|
42 |
load_yt_btn=gr.Button()
|
43 |
with gr.Row():
|
44 |
-
pre_vid = gr.Video()
|
45 |
clip_vid=gr.Video()
|
|
|
|
|
|
|
|
|
46 |
out=gr.Files()
|
47 |
load_yt_btn.click(load_video_yt, inp_url, [pre_vid])
|
48 |
-
|
49 |
app.launch()
|
|
|
12 |
print (f'Video Length: {yt.length}')
|
13 |
return f"{uid}-tmp.mp4"
|
14 |
|
15 |
+
def trim_vid(vid,start_time,end_time):
|
16 |
+
#vid = f"{uid}-tmp.mp4"
|
17 |
+
ffmpeg_extract_subclip(vid, start_time, end_time, targetname=f"{uid}-clip.mp4")
|
18 |
+
return f"{uid}-clip.mp4"
|
19 |
|
20 |
def trim_clip(clip, start_t, end_t):
|
21 |
clip = Path(f"{uid}-tmp_aud.mp4")
|
|
|
42 |
inp_url=gr.Textbox(label="URL")
|
43 |
load_yt_btn=gr.Button()
|
44 |
with gr.Row():
|
45 |
+
pre_vid = gr.Video(type='filepath')
|
46 |
clip_vid=gr.Video()
|
47 |
+
with gr.Row():
|
48 |
+
start_time = gr.Textbox(label = "Start", value = "0:00", placeholder = "0:23")
|
49 |
+
end_time = gr.Textbox(label = "End", value = "0:01", placeholder = "1:12")
|
50 |
+
trim_clip_btn = gr.Button("Trim Clip")
|
51 |
out=gr.Files()
|
52 |
load_yt_btn.click(load_video_yt, inp_url, [pre_vid])
|
53 |
+
trim_clip_btn.click(trim_vid,[pre_vid,start_time,end_time],clip_vid)
|
54 |
app.launch()
|