MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / interpolate_video

Function interpolate_video

diffsynth/extensions/FastBlend/api.py:202–254  ·  view source on GitHub ↗
(
    frames_path,
    keyframes_path,
    output_path,
    fps,
    batch_size,
    tracking_window_size,
    minimum_patch_size,
    num_iter,
    guide_weight,
    initialize,
    progress = None,
)

Source from the content-addressed store, hash-verified

200
201
202def interpolate_video(
203 frames_path,
204 keyframes_path,
205 output_path,
206 fps,
207 batch_size,
208 tracking_window_size,
209 minimum_patch_size,
210 num_iter,
211 guide_weight,
212 initialize,
213 progress = None,
214):
215 # input
216 frames_guide, frames_style, index_style, message = check_input_for_interpolating(frames_path, keyframes_path)
217 if len(message) > 0:
218 print(message)
219 # output
220 if output_path == "":
221 output_path = os.path.join(keyframes_path, "output")
222 os.makedirs(output_path, exist_ok=True)
223 print("No valid output_path. Your video will be saved here:", output_path)
224 elif not os.path.exists(output_path):
225 os.makedirs(output_path, exist_ok=True)
226 print("Your video will be saved here:", output_path)
227 output_frames_path = os.path.join(output_path, "frames")
228 output_video_path = os.path.join(output_path, "video.mp4")
229 os.makedirs(output_frames_path, exist_ok=True)
230 # process
231 ebsynth_config = {
232 "minimum_patch_size": minimum_patch_size,
233 "threads_per_block": 8,
234 "num_iter": num_iter,
235 "gpu_id": 0,
236 "guide_weight": guide_weight,
237 "initialize": initialize,
238 "tracking_window_size": tracking_window_size
239 }
240 if len(index_style)==1:
241 InterpolationModeSingleFrameRunner().run(frames_guide, frames_style, index_style, batch_size=batch_size, ebsynth_config=ebsynth_config, save_path=output_frames_path)
242 else:
243 InterpolationModeRunner().run(frames_guide, frames_style, index_style, batch_size=batch_size, ebsynth_config=ebsynth_config, save_path=output_frames_path)
244 try:
245 fps = int(fps)
246 except:
247 fps = 30
248 print("Fps:", fps)
249 print("Saving video...")
250 video_path = save_video(output_frames_path, output_video_path, num_frames=len(frames_guide), fps=fps)
251 print("Success!")
252 print("Your frames are here:", output_frames_path)
253 print("Your video is here:", video_path)
254 return output_path, fps, video_path
255
256
257def on_ui_tabs():

Callers

nothing calls this directly

Calls 5

save_videoFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected