Update app.py
Browse files
app.py
CHANGED
@@ -74,8 +74,8 @@ def get_frames(video_in, step, name, resize_w):
|
|
74 |
resize_h = resize_w / 2.0
|
75 |
frame = cv2.resize(frame, (int(resize_w), int(resize_h)))
|
76 |
|
77 |
-
cv2.imwrite(f"{name}_{step}{str(i)}.
|
78 |
-
frames.append(f"{name}_{step}{str(i)}.
|
79 |
i+=1
|
80 |
|
81 |
cap.release()
|
@@ -88,7 +88,7 @@ def get_frames(video_in, step, name, resize_w):
|
|
88 |
def create_video(frames, fps, type):
|
89 |
print("building video result")
|
90 |
clip = ImageSequenceClip(frames, fps=fps)
|
91 |
-
clip.write_videofile(type + "_result.mp4", fps=fps, codec='libx265', ffmpeg_params=['-c:v', 'libx265'], audio = False)
|
92 |
|
93 |
return type + "_result.mp4"
|
94 |
|
@@ -120,8 +120,8 @@ def infer(url_in,interpolation,fps_output,resize_n,winsize,o_flow):
|
|
120 |
print(break_interpolated_video[0])
|
121 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
122 |
print(f"IMG:{img}")
|
123 |
-
os.rename(img, f"{frame}_to_{next_frame}_{j}.
|
124 |
-
result_frames.append(f"{frame}_to_{next_frame}_{j}.
|
125 |
|
126 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
127 |
#print(f"CURRENT FRAMES: {result_frames}")
|
|
|
74 |
resize_h = resize_w / 2.0
|
75 |
frame = cv2.resize(frame, (int(resize_w), int(resize_h)))
|
76 |
|
77 |
+
cv2.imwrite(f"{name}_{step}{str(i)}.png",frame)
|
78 |
+
frames.append(f"{name}_{step}{str(i)}.png")
|
79 |
i+=1
|
80 |
|
81 |
cap.release()
|
|
|
88 |
def create_video(frames, fps, type):
|
89 |
print("building video result")
|
90 |
clip = ImageSequenceClip(frames, fps=fps)
|
91 |
+
clip.write_videofile(type + "_result.mp4", fps=fps, codec='libx265', ffmpeg_params=['-c:v', 'libx265', '-x265-params', 'crf=28' ], audio = False)
|
92 |
|
93 |
return type + "_result.mp4"
|
94 |
|
|
|
120 |
print(break_interpolated_video[0])
|
121 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
122 |
print(f"IMG:{img}")
|
123 |
+
os.rename(img, f"{frame}_to_{next_frame}_{j}.png")
|
124 |
+
result_frames.append(f"{frame}_to_{next_frame}_{j}.png")
|
125 |
|
126 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
127 |
#print(f"CURRENT FRAMES: {result_frames}")
|