Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ ffmpeg_path = util.get_ffmpeg_path()
|
|
25 |
mediapy.set_ffmpeg(ffmpeg_path)
|
26 |
|
27 |
|
28 |
-
def do_interpolation(frame1, frame2, interpolation):
|
29 |
print("tween frames: " + str(interpolation))
|
30 |
print(frame1, frame2)
|
31 |
input_frames = [frame1, frame2]
|
@@ -34,8 +34,8 @@ def do_interpolation(frame1, frame2, interpolation):
|
|
34 |
input_frames, int(interpolation), interpolator))
|
35 |
|
36 |
#print(frames)
|
37 |
-
mediapy.write_video(f"{
|
38 |
-
return f"{
|
39 |
|
40 |
def get_frames(video_in, step, name, resize_w):
|
41 |
frames = []
|
@@ -117,17 +117,17 @@ def infer(glr_in, interpolation, fps_output):
|
|
117 |
if idx < len(frames_list) - 1:
|
118 |
next_frame = frames_list[idx+1]
|
119 |
|
120 |
-
interpolated_frames = do_interpolation(frame[0], next_frame[0], interpolation) # should return a list of
|
121 |
break_interpolated_video = get_frames(interpolated_frames, "interpol", f"{idx}_", 0)
|
122 |
print(break_interpolated_video[0])
|
123 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
124 |
print(f"IMG:{img}")
|
125 |
-
os.rename(img, f"{
|
126 |
-
result_frames.append(f"{
|
127 |
|
128 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
129 |
#print(f"CURRENT FRAMES: {result_frames}")
|
130 |
-
result_frames.append(f"{frames_list[n_frame-1]}")
|
131 |
final_vid = create_video(result_frames, fps_output, "interpolated")
|
132 |
|
133 |
files = final_vid
|
|
|
25 |
mediapy.set_ffmpeg(ffmpeg_path)
|
26 |
|
27 |
|
28 |
+
def do_interpolation(frame1, frame2, interpolation, n):
|
29 |
print("tween frames: " + str(interpolation))
|
30 |
print(frame1, frame2)
|
31 |
input_frames = [frame1, frame2]
|
|
|
34 |
input_frames, int(interpolation), interpolator))
|
35 |
|
36 |
#print(frames)
|
37 |
+
mediapy.write_video(f"{n}_to_{n+1}_out.mp4", frames, fps=25)
|
38 |
+
return f"{n}_to_{n+1}_out.mp4"
|
39 |
|
40 |
def get_frames(video_in, step, name, resize_w):
|
41 |
frames = []
|
|
|
117 |
if idx < len(frames_list) - 1:
|
118 |
next_frame = frames_list[idx+1]
|
119 |
|
120 |
+
interpolated_frames = do_interpolation(frame[0], next_frame[0], interpolation, idx) # should return a list of interpolated frames
|
121 |
break_interpolated_video = get_frames(interpolated_frames, "interpol", f"{idx}_", 0)
|
122 |
print(break_interpolated_video[0])
|
123 |
for j, img in enumerate(break_interpolated_video[0][0:len(break_interpolated_video[0])-1]):
|
124 |
print(f"IMG:{img}")
|
125 |
+
os.rename(img, f"{idx}_to_{idx+1}_{j}.png")
|
126 |
+
result_frames.append(f"{idx}_to_{idx+1}_{j}.png")
|
127 |
|
128 |
print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
|
129 |
#print(f"CURRENT FRAMES: {result_frames}")
|
130 |
+
result_frames.append(f"{frames_list[n_frame-1][0]}")
|
131 |
final_vid = create_video(result_frames, fps_output, "interpolated")
|
132 |
|
133 |
files = final_vid
|