From a2e18df4c81da03851821278d926eeaf9c65cbf4 Mon Sep 17 00:00:00 2001 From: cellzero Date: Thu, 26 Dec 2024 15:36:28 +0800 Subject: [PATCH] Fix aspect_ratio for better results --- comfyui/comfyui_nodes.py | 2 +- predict_i2v.py | 2 +- predict_i2v_80g.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comfyui/comfyui_nodes.py b/comfyui/comfyui_nodes.py index b2ac549..3af9285 100644 --- a/comfyui/comfyui_nodes.py +++ b/comfyui/comfyui_nodes.py @@ -361,7 +361,7 @@ class Ruyi_I2VSampler: original_width, original_height = start_img[0].size if type(start_img) is list else Image.open(start_img).size closest_size, closest_ratio = get_closest_ratio(original_height, original_width, ratios=aspect_ratio_sample_size) height, width = [int(x / 16) * 16 for x in closest_size] - aspect_ratio = "16:9" if width > height else "9:16" + aspect_ratio = "16:9" # Do not change, currently "16:9" works better # Get Pipeline pipeline = ruyi_model['pipeline'] diff --git a/predict_i2v.py b/predict_i2v.py index 333940b..6adf59f 100644 --- a/predict_i2v.py +++ b/predict_i2v.py @@ -26,7 +26,7 @@ video_length = 120 # The max video length is 120 frames (24 frames base_resolution = 512 # # The pixels in the generated video are approximately 512 x 512. Values in the range of [384, 896] typically produce good video quality. video_size = None # Override base_resolution. Format: [height, width], e.g., [384, 672] # Control settings -aspect_ratio = "16:9" # Choose in ["16:9", "9:16"], note that this is only the hint +aspect_ratio = "16:9" # Do not change, currently "16:9" works better motion = "auto" # Motion control, choose in ["1", "2", "3", "4", "auto"] camera_direction = "auto" # Camera control, choose in ["static", "left", "right", "up", "down", "auto"] # Sampler settings diff --git a/predict_i2v_80g.py b/predict_i2v_80g.py index 11338db..d835da8 100644 --- a/predict_i2v_80g.py +++ b/predict_i2v_80g.py @@ -26,7 +26,7 @@ video_length = 120 # The max video length is 120 frames (24 frames base_resolution = 512 # # The pixels in the generated video are approximately 512 x 512. Values in the range of [384, 896] typically produce good video quality. video_size = None # Override base_resolution. Format: [height, width], e.g., [384, 672] # Control settings -aspect_ratio = "9:16" # Choose in ["16:9", "9:16"], note that this is only the hint +aspect_ratio = "16:9" # Do not change, currently "16:9" works better motion = "auto" # Motion control, choose in ["1", "2", "3", "4", "auto"] camera_direction = "auto" # Camera control, choose in ["static", "left", "right", "up", "down", "auto"] # Sampler settings