Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,8 +116,7 @@ def dl(inp):
|
|
| 116 |
return out,out,out,out
|
| 117 |
|
| 118 |
def trim_vid(vid,start_time,end_time):
|
| 119 |
-
|
| 120 |
-
capture = cv2.VideoCapture(new_video_in)
|
| 121 |
start_hr=int(start_time.split(":",2)[0])*360
|
| 122 |
start_min=int(start_time.split(":",2)[1])*60
|
| 123 |
start_sec=int(start_time.split(":",2)[2])
|
|
@@ -127,7 +126,7 @@ def trim_vid(vid,start_time,end_time):
|
|
| 127 |
start=start_hr+start_min+start_sec
|
| 128 |
end=end_hr+end_min+end_sec
|
| 129 |
#vid = f"{uid}-tmp.mp4"
|
| 130 |
-
ffmpeg_extract_subclip(
|
| 131 |
out= f"{uid}-clip.mp4"
|
| 132 |
return out,out
|
| 133 |
|
|
@@ -157,7 +156,7 @@ with gr.Blocks() as app:
|
|
| 157 |
with gr.Column():
|
| 158 |
inp_url = gr.Textbox()
|
| 159 |
go_btn = gr.Button("Run")
|
| 160 |
-
outp_vid=gr.Video()
|
| 161 |
with gr.Column():
|
| 162 |
with gr.Row():
|
| 163 |
frame_count=gr.Textbox(label="Frame Count",interactive = False)
|
|
@@ -167,7 +166,7 @@ with gr.Blocks() as app:
|
|
| 167 |
start_f = gr.Textbox(label = "Start", value = "0:00:00", placeholder = "0:00:23")
|
| 168 |
end_f = gr.Textbox(label = "End", value = "0:00:05", placeholder = "0:00:54")
|
| 169 |
trim_btn=gr.Button("Trim")
|
| 170 |
-
out_trim=gr.Video()
|
| 171 |
|
| 172 |
with gr.Tab("Frames"):
|
| 173 |
frame_btn = gr.Button("Get Frames")
|
|
@@ -181,7 +180,7 @@ with gr.Blocks() as app:
|
|
| 181 |
with gr.Row():
|
| 182 |
with gr.Column():
|
| 183 |
rem_btn=gr.Button()
|
| 184 |
-
in_vid=gr.Video()
|
| 185 |
with gr.Column():
|
| 186 |
#rem_vid=gr.Video()
|
| 187 |
frame_num=gr.Textbox(label="Progress")
|
|
|
|
| 116 |
return out,out,out,out
|
| 117 |
|
| 118 |
def trim_vid(vid,start_time,end_time):
|
| 119 |
+
print (vid)
|
|
|
|
| 120 |
start_hr=int(start_time.split(":",2)[0])*360
|
| 121 |
start_min=int(start_time.split(":",2)[1])*60
|
| 122 |
start_sec=int(start_time.split(":",2)[2])
|
|
|
|
| 126 |
start=start_hr+start_min+start_sec
|
| 127 |
end=end_hr+end_min+end_sec
|
| 128 |
#vid = f"{uid}-tmp.mp4"
|
| 129 |
+
ffmpeg_extract_subclip(vid, start, end, targetname=f"{uid}-clip.mp4")
|
| 130 |
out= f"{uid}-clip.mp4"
|
| 131 |
return out,out
|
| 132 |
|
|
|
|
| 156 |
with gr.Column():
|
| 157 |
inp_url = gr.Textbox()
|
| 158 |
go_btn = gr.Button("Run")
|
| 159 |
+
outp_vid=gr.Video(format="mp4")
|
| 160 |
with gr.Column():
|
| 161 |
with gr.Row():
|
| 162 |
frame_count=gr.Textbox(label="Frame Count",interactive = False)
|
|
|
|
| 166 |
start_f = gr.Textbox(label = "Start", value = "0:00:00", placeholder = "0:00:23")
|
| 167 |
end_f = gr.Textbox(label = "End", value = "0:00:05", placeholder = "0:00:54")
|
| 168 |
trim_btn=gr.Button("Trim")
|
| 169 |
+
out_trim=gr.Video(format="mp4")
|
| 170 |
|
| 171 |
with gr.Tab("Frames"):
|
| 172 |
frame_btn = gr.Button("Get Frames")
|
|
|
|
| 180 |
with gr.Row():
|
| 181 |
with gr.Column():
|
| 182 |
rem_btn=gr.Button()
|
| 183 |
+
in_vid=gr.Video(format="mp4")
|
| 184 |
with gr.Column():
|
| 185 |
#rem_vid=gr.Video()
|
| 186 |
frame_num=gr.Textbox(label="Progress")
|