Commit
·
9ca6daf
1
Parent(s):
e38d841
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,7 @@ def get_frames(video_in, step, name):
|
|
| 59 |
clip_resized = clip.resize(height=576)
|
| 60 |
clip_resized.write_videofile("video_resized.mp4", fps=clip.fps, bitrate="12000k")
|
| 61 |
|
| 62 |
-
print("video resized to
|
| 63 |
|
| 64 |
# Opens the Video file with CV2
|
| 65 |
cap= cv2.VideoCapture("video_resized.mp4")
|
|
@@ -71,8 +71,9 @@ def get_frames(video_in, step, name):
|
|
| 71 |
ret, frame = cap.read()
|
| 72 |
if ret == False:
|
| 73 |
break
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 76 |
i+=1
|
| 77 |
|
| 78 |
cap.release()
|
|
@@ -125,8 +126,9 @@ def infer(secret_token, video_in_base64, interpolation, fps_output):
|
|
| 125 |
print(break_interpolated_video[0])
|
| 126 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
| 127 |
print(f"IMG:{img}")
|
| 128 |
-
|
| 129 |
-
|
|
|
|
| 130 |
|
| 131 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
| 132 |
#print(f"CURRENT FRAMES: {result_frames}")
|
|
|
|
| 59 |
clip_resized = clip.resize(height=576)
|
| 60 |
clip_resized.write_videofile("video_resized.mp4", fps=clip.fps, bitrate="12000k")
|
| 61 |
|
| 62 |
+
print("video resized to 576 height")
|
| 63 |
|
| 64 |
# Opens the Video file with CV2
|
| 65 |
cap= cv2.VideoCapture("video_resized.mp4")
|
|
|
|
| 71 |
ret, frame = cap.read()
|
| 72 |
if ret == False:
|
| 73 |
break
|
| 74 |
+
# use use png to avoid any compression artifact
|
| 75 |
+
cv2.imwrite(f"{name}_{step}{str(i)}.png",frame)
|
| 76 |
+
frames.append(f"{name}_{step}{str(i)}.png")
|
| 77 |
i+=1
|
| 78 |
|
| 79 |
cap.release()
|
|
|
|
| 126 |
print(break_interpolated_video[0])
|
| 127 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
| 128 |
print(f"IMG:{img}")
|
| 129 |
+
# we use png to avoid any compression artifact
|
| 130 |
+
os.rename(img, f"{frame}_to_{next_frame}_{j}.png")
|
| 131 |
+
result_frames.append(f"{frame}_to_{next_frame}_{j}.png")
|
| 132 |
|
| 133 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
| 134 |
#print(f"CURRENT FRAMES: {result_frames}")
|