Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -76,6 +76,7 @@ def dl(inp,img):
|
|
76 |
out = f"{img}"
|
77 |
return out,out,out,out,fps
|
78 |
def trim_vid(vid,start_time,end_time):
|
|
|
79 |
start_hr=float(start_time.split(":",2)[0])*360
|
80 |
start_min=int(start_time.split(":",2)[1])*60
|
81 |
start_sec=int(start_time.split(":",2)[2])
|
@@ -84,7 +85,11 @@ def trim_vid(vid,start_time,end_time):
|
|
84 |
end_sec=float(end_time.split(":",2)[2])
|
85 |
start=start_hr+start_min+start_sec
|
86 |
end=end_hr+end_min+end_sec
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
out= f"{uid}-clip.mp4"
|
89 |
capture = cv2.VideoCapture(out)
|
90 |
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
|
76 |
out = f"{img}"
|
77 |
return out,out,out,out,fps
|
78 |
def trim_vid(vid,start_time,end_time):
|
79 |
+
print (vid)
|
80 |
start_hr=float(start_time.split(":",2)[0])*360
|
81 |
start_min=int(start_time.split(":",2)[1])*60
|
82 |
start_sec=int(start_time.split(":",2)[2])
|
|
|
85 |
end_sec=float(end_time.split(":",2)[2])
|
86 |
start=start_hr+start_min+start_sec
|
87 |
end=end_hr+end_min+end_sec
|
88 |
+
clip = VideoFileClip(vid)
|
89 |
+
mod_fps=clip.fps
|
90 |
+
clip = clip.subclip(start, end)
|
91 |
+
clip.write_videofile(f"{uid}-clip.mp4", fps=mod_fps)
|
92 |
+
#ffmpeg_extract_subclip(vid, start, end, targetname=f"{uid}-clip.mp4")
|
93 |
out= f"{uid}-clip.mp4"
|
94 |
capture = cv2.VideoCapture(out)
|
95 |
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|