You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Moviepy2 to render a video based on images. There is one image that should be the background image the whole video. Multiple images should be faded in, showed for a few seconds and faded out again sequentially.
My code generates the video but the foreground_clip is not faded in and out. During the fading I only see a black box.
def create_video(background_image_path, foreground_images_folder, output_video_path):
# Load and resize the background image
background_clip = ImageClip(background_image_path)
print(background_clip)
print(background_clip.size)
background_clip = background_clip.resized(VIDEO_RESOLUTION).with_duration(IMAGE_DISPLAY_DURATION)
# List all images in the foreground images folder
foreground_images = [os.path.join(foreground_images_folder, img) for img in os.listdir(foreground_images_folder) if img.endswith(('png', 'jpg', 'jpeg'))]
# Create video clips for each foreground image
clips = []
for img_path in foreground_images:
print(f"Processing image: {img_path}")
foreground_clip = ImageClip(img_path).resized(0.8).with_duration(IMAGE_DISPLAY_DURATION)
foreground_clip = foreground_clip.with_position('center').with_effects([vfx.CrossFadeIn(1)]).with_effects([vfx.CrossFadeOut(1)])
composite_clip = CompositeVideoClip([background_clip, foreground_clip])
clips.append(composite_clip)
#clips.append(foreground_clip)
# Concatenate all clips
final_clip = concatenate_videoclips(clips, method="compose")
# Write the final video to a file
final_clip.write_videofile(output_video_path, fps=24)
Expected Behavior
I would expect to see my background image and a fading in foreground image.
Actual Behavior
During the fade in and out time I see only a black box
Steps to Reproduce the Problem
Specifications
Python Version: 3.12.3
MoviePy Version: 2.1.1
Platform Name: Ubuntu
Platform Version: 24.04.1 LTS
The text was updated successfully, but these errors were encountered:
It seems I cannot reproduce the problem with your code, could you provide the resources (videos, images, etc.) you are using ? Also you might need to set use_bgclip = True in composite.
I'm using Moviepy2 to render a video based on images. There is one image that should be the background image the whole video. Multiple images should be faded in, showed for a few seconds and faded out again sequentially.
My code generates the video but the
foreground_clip
is not faded in and out. During the fading I only see a black box.Expected Behavior
I would expect to see my background image and a fading in foreground image.
Actual Behavior
During the fade in and out time I see only a black box
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: