Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -74,37 +74,37 @@ def predict(frame1, frame2, times_to_interpolate):
|
|
74 |
mediapy.write_video("out.mp4", frames, fps=30)
|
75 |
|
76 |
# video.mp4 is a video of 9 seconds
|
77 |
-
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
|
109 |
return "out.mp4"
|
110 |
|
|
|
74 |
mediapy.write_video("out.mp4", frames, fps=30)
|
75 |
|
76 |
# video.mp4 is a video of 9 seconds
|
77 |
+
filename = "out.mp4"
|
78 |
|
79 |
+
cap = cv2.VideoCapture(filename)
|
80 |
+
cap.set(cv2.CAP_PROP_POS_AVI_RATIO,0)
|
81 |
+
frameCount = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
82 |
+
frameWidth = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
83 |
+
frameHeight = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
84 |
+
videoFPS = int(cap.get(cv2.CAP_PROP_FPS))
|
85 |
+
|
86 |
+
print (f"frameCount: {frameCount}")
|
87 |
+
print (f"frameWidth: {frameWidth}")
|
88 |
+
print (f"frameHeight: {frameHeight}")
|
89 |
+
print (f"videoFPS: {videoFPS}")
|
90 |
+
|
91 |
+
buf = np.empty((
|
92 |
+
frameCount,
|
93 |
+
frameHeight,
|
94 |
+
frameWidth,
|
95 |
+
3), np.dtype('uint8'))
|
96 |
+
|
97 |
+
fc = 0
|
98 |
+
ret = True
|
99 |
+
|
100 |
+
while (fc < frameCount):
|
101 |
+
ret, buf[fc] = cap.read()
|
102 |
+
fc += 1
|
103 |
+
|
104 |
+
cap.release()
|
105 |
+
videoArray = buf
|
106 |
+
|
107 |
+
print (f"DURATION: {frameCount/videoFPS}")
|
108 |
|
109 |
return "out.mp4"
|
110 |
|