[Python] Resizing video clips with moviepy

Discussão em 'Python' iniciado por Stack, Junho 1, 2025.

  1. Stack

    Stack Membro Participativo

    I've been using moviepy to create an auto editor for putting a clip on top and a clip on the bottom. I'm having trouble resizing my clips. It won't allow me to use the resize command when I import it over. This is the code I am using:

    import os
    import random
    from moviepy.editor import VideoFileClip, CompositeVideoClip, concatenate_videoclips , clips_array, vfx, AudioFileClip, ImageClip
    from moviepy.video.fx import resize


    originalFolder = "c:\\Users\\me\\Desktop\\Content Software\\testfold"
    list = os.listdir(originalFolder)

    minecraftFolder = "c:\\Users\\me\\Desktop\\Content Software\\minecraft"

    minecraftList = os.listdir(minecraftFolder)

    def videoGen(minecraftList, list):
    clipIndex = int(random.random()*len(list))
    filePath1 = os.path.join(originalFolder, list[clipIndex])

    overlayClip = VideoFileClip(filePath1)
    minecraftIndex = int(random.random()*len(minecraftList))
    filePath2 = os.path.join(originalFolder, list[minecraftIndex])

    minecraftClip = VideoFileClip(filePath2)

    clips = ([overlayClip], [minecraftClip])

    combined = clips_array(clips)

    combinedFinal = resize(combined, width=1080, height=1920)

    combinedFinal.write_videofile("test.mp4")


    videoGen(minecraftList, list)```



    I keep getting this error message every time I run the command:

    Traceback (most recent call last):
    File "c:\Users\me\Desktop\Content Software\Minecraft Video Gen.py", line 33, in <module>
    videoGen(minecraftList, list)
    File "c:\Users\me\Desktop\Content Software\Minecraft Video Gen.py", line 28, in videoGen
    combinedFinal = resize(combined, width=1080, height=1920)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: 'module' object is not callable

    What is it that I'm doing wrong that's causing my code to break? using combined.resize() hasn't worked for me either, I'm really confused because nothing in the docs are solving my problem.

    Continue reading...

Compartilhe esta Página