Update app.py
Browse files
app.py
CHANGED
|
@@ -41,22 +41,21 @@ def do_interpolation(frame1, frame2, times_to_interpolate):
|
|
| 41 |
def get_frames(video_in, step, name):
|
| 42 |
frames = []
|
| 43 |
#resize the video
|
| 44 |
-
clip = VideoFileClip(video_in)
|
| 45 |
-
if clip.fps:
|
| 46 |
-
cfps = clip.fps
|
| 47 |
-
else:
|
| 48 |
-
cfps = 1
|
| 49 |
-
print("video fps: " + str(cfps))
|
| 50 |
|
| 51 |
#check fps
|
| 52 |
-
if
|
| 53 |
print("video rate is over 25, resetting to 25")
|
| 54 |
clip_resized = clip.resize(height=1024)
|
| 55 |
clip_resized.write_videofile("video_resized.mp4", fps=25)
|
| 56 |
-
else:
|
| 57 |
print("video rate is OK")
|
| 58 |
clip_resized = clip.resize(height=1024)
|
| 59 |
-
clip_resized.write_videofile("video_resized.mp4", fps=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
print("video resized to 1024 height")
|
| 62 |
|
|
@@ -64,10 +63,7 @@ def get_frames(video_in, step, name):
|
|
| 64 |
cap = cv2.VideoCapture("video_resized.mp4")
|
| 65 |
|
| 66 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 67 |
-
|
| 68 |
-
print("video fps: " + str(fps))
|
| 69 |
-
else:
|
| 70 |
-
fps = 1
|
| 71 |
i=0
|
| 72 |
while(cap.isOpened()):
|
| 73 |
ret, frame = cap.read()
|
|
|
|
| 41 |
def get_frames(video_in, step, name):
|
| 42 |
frames = []
|
| 43 |
#resize the video
|
| 44 |
+
clip = VideoFileClip(video_in).set_duration(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
#check fps
|
| 47 |
+
if clip.fps > 25:
|
| 48 |
print("video rate is over 25, resetting to 25")
|
| 49 |
clip_resized = clip.resize(height=1024)
|
| 50 |
clip_resized.write_videofile("video_resized.mp4", fps=25)
|
| 51 |
+
else if clip.fps:
|
| 52 |
print("video rate is OK")
|
| 53 |
clip_resized = clip.resize(height=1024)
|
| 54 |
+
clip_resized.write_videofile("video_resized.mp4", fps=clip.fps)
|
| 55 |
+
else:
|
| 56 |
+
print("video rate is indefinite")
|
| 57 |
+
clip_resized = clip.resize(height=1024)
|
| 58 |
+
clip_resized.write_videofile("video_resized.mp4", fps=1)
|
| 59 |
|
| 60 |
print("video resized to 1024 height")
|
| 61 |
|
|
|
|
| 63 |
cap = cv2.VideoCapture("video_resized.mp4")
|
| 64 |
|
| 65 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 66 |
+
print("video fps: " + str(fps))
|
|
|
|
|
|
|
|
|
|
| 67 |
i=0
|
| 68 |
while(cap.isOpened()):
|
| 69 |
ret, frame = cap.read()
|