From ce30d56dddacab003d7591cb8bfdae0b5ca6673c Mon Sep 17 00:00:00 2001 From: Chev Date: Sat, 24 May 2025 19:37:12 -0700 Subject: [PATCH] Change method of resize to use fx.resize.resize This code is old, pretty sure I did this because the old method didn't work anymore (would cause an error) --- main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 6ba12c4..ad0b70e 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ from os import listdir, mkdir, path import moviepy.audio from moviepy import editor from moviepy.video import fx +from moviepy.video.fx import resize """ TODO: @@ -187,17 +188,18 @@ print(f"Compiling {videoAmount} videos... ", end="\r") for index, video in enumerate(randomVideos): print(f"Compiling {videoAmount} videos... {get_progress_bar_str(index, len(randomVideos), progress_bar_len=40)}", end="\r") - newClip = editor.VideoFileClip(video).resize(height=480) #target_resolution=(512, 512) + newClip = editor.VideoFileClip(video) + sizedClip = fx.resize.resize(newClip, height=480) randomDuration = rng.uniform(*video_clip_times) - if newClip.duration > randomDuration: - startOffset = rng.uniform(0, newClip.duration - randomDuration) - newClip = newClip.subclip(startOffset, startOffset+randomDuration) + if sizedClip.duration > randomDuration: + startOffset = rng.uniform(0, sizedClip.duration - randomDuration) + sizedClip = sizedClip.subclip(startOffset, startOffset+randomDuration) if rng.choice([True, True, False]) and shouldUseEffects: - newClip = rng.choice(videoEffects)(newClip) #apply a random effect + sizedClip = rng.choice(videoEffects)(sizedClip) #apply a random effect - videoObjects.append(newClip) + videoObjects.append(sizedClip) print(f"Compiling {videoAmount} videos... {get_progress_bar_str(1, 1, progress_bar_len=40)}") print("Finished compiling videos.")