Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,8 +13,16 @@ def load_video_yt(vid):
|
|
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,
|
18 |
return f"{uid}-clip.mp4"
|
19 |
|
20 |
def trim_clip(clip, start_t, end_t):
|
@@ -45,8 +53,8 @@ with gr.Blocks() as app:
|
|
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:
|
50 |
trim_clip_btn = gr.Button("Trim Clip")
|
51 |
out=gr.Files()
|
52 |
load_yt_btn.click(load_video_yt, inp_url, [pre_vid])
|
|
|
13 |
return f"{uid}-tmp.mp4"
|
14 |
|
15 |
def trim_vid(vid,start_time,end_time):
|
16 |
+
start_hr=int(start_time.split[":",2][0]*360)
|
17 |
+
start_min=int(start_time.split[":",2][1]*60)
|
18 |
+
start_sec=int(start_time.split[":",2][2])
|
19 |
+
end_hr=int(start_time.split[":",2][0]*360)
|
20 |
+
end_min=int(start_time.split[":",2][1]*60)
|
21 |
+
end_sec=int(start_time.split[":",2][2])
|
22 |
+
start=start_hr+start_min+start_sec
|
23 |
+
end=end_hr+end_min+end_sec
|
24 |
#vid = f"{uid}-tmp.mp4"
|
25 |
+
ffmpeg_extract_subclip(vid, start, end, targetname=f"{uid}-clip.mp4")
|
26 |
return f"{uid}-clip.mp4"
|
27 |
|
28 |
def trim_clip(clip, start_t, end_t):
|
|
|
53 |
pre_vid = gr.Video(type='filepath')
|
54 |
clip_vid=gr.Video()
|
55 |
with gr.Row():
|
56 |
+
start_time = gr.Textbox(label = "Start", value = "0:00:00", placeholder = "0:00:23")
|
57 |
+
end_time = gr.Textbox(label = "End", value = "0:00:05", placeholder = "0:00:54")
|
58 |
trim_clip_btn = gr.Button("Trim Clip")
|
59 |
out=gr.Files()
|
60 |
load_yt_btn.click(load_video_yt, inp_url, [pre_vid])
|