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

Function smooth_video

diffsynth/extensions/FastBlend/api.py:25–89  ·  view source on GitHub ↗
(
    video_guide,
    video_guide_folder,
    video_style,
    video_style_folder,
    mode,
    window_size,
    batch_size,
    tracking_window_size,
    output_path,
    fps,
    minimum_patch_size,
    num_iter,
    guide_weight,
    initialize,
    progress = None,
)

Source from the content-addressed store, hash-verified

23
24
25def smooth_video(
26 video_guide,
27 video_guide_folder,
28 video_style,
29 video_style_folder,
30 mode,
31 window_size,
32 batch_size,
33 tracking_window_size,
34 output_path,
35 fps,
36 minimum_patch_size,
37 num_iter,
38 guide_weight,
39 initialize,
40 progress = None,
41):
42 # input
43 frames_guide, frames_style, message = check_input_for_blending(video_guide, video_guide_folder, video_style, video_style_folder)
44 if len(message) > 0:
45 print(message)
46 # output
47 if output_path == "":
48 if video_style is None:
49 output_path = os.path.join(video_style_folder, "output")
50 else:
51 output_path = os.path.join(os.path.split(video_style)[0], "output")
52 os.makedirs(output_path, exist_ok=True)
53 print("No valid output_path. Your video will be saved here:", output_path)
54 elif not os.path.exists(output_path):
55 os.makedirs(output_path, exist_ok=True)
56 print("Your video will be saved here:", output_path)
57 frames_path = os.path.join(output_path, "frames")
58 video_path = os.path.join(output_path, "video.mp4")
59 os.makedirs(frames_path, exist_ok=True)
60 # process
61 if mode == "Fast" or mode == "Balanced":
62 tracking_window_size = 0
63 ebsynth_config = {
64 "minimum_patch_size": minimum_patch_size,
65 "threads_per_block": 8,
66 "num_iter": num_iter,
67 "gpu_id": 0,
68 "guide_weight": guide_weight,
69 "initialize": initialize,
70 "tracking_window_size": tracking_window_size,
71 }
72 if mode == "Fast":
73 FastModeRunner().run(frames_guide, frames_style, batch_size=batch_size, window_size=window_size, ebsynth_config=ebsynth_config, save_path=frames_path)
74 elif mode == "Balanced":
75 BalancedModeRunner().run(frames_guide, frames_style, batch_size=batch_size, window_size=window_size, ebsynth_config=ebsynth_config, save_path=frames_path)
76 elif mode == "Accurate":
77 AccurateModeRunner().run(frames_guide, frames_style, batch_size=batch_size, window_size=window_size, ebsynth_config=ebsynth_config, save_path=frames_path)
78 # output
79 try:
80 fps = int(fps)
81 except:
82 fps = get_video_fps(video_style) if video_style is not None else 30

Callers

nothing calls this directly

Calls 7

check_input_for_blendingFunction · 0.85
FastModeRunnerClass · 0.85
BalancedModeRunnerClass · 0.85
AccurateModeRunnerClass · 0.85
get_video_fpsFunction · 0.85
save_videoFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected