[Python] Resize the video using MoviePy

Discussão em 'Python' iniciado por Stack, Abril 10, 2025.

  1. Stack

    Stack Membro Participativo

    Following is my code:

    from moviepy.editor import VideoFileClip
    from moviepy.video.fx.resize import resize
    from PIL import Image

    video_path = "2textani.mp4"
    output_path = "now good1.mp4"
    new_width = 640
    new_height = 480

    video_clip = VideoFileClip(video_path)
    resized_clip = video_clip.resize((new_width, new_height), PIL.Image.Resampling.LANCZOS)
    resized_clip.write_videofile(output_path)


    and I am getting following error:

    Traceback (most recent call last):
    resized_clip = video_clip.resize((new_width, new_height), PIL.Image.Resampling.LANCZOS)
    NameError: name 'PIL' is not defined


    I have following version

    • moviepy==1.0.3
    • Pillow==10.0.0

    Continue reading...

Compartilhe esta Página