Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.56k stars 1.57k forks source link

I can't use Mask. Trying using 1 Image.png + 1 Video.mp4 #1815

Open webcrawlerBR opened 2 years ago

webcrawlerBR commented 2 years ago

I can't render video using a image mask, can anyone help me out with this

The error raised is: ValueError: operands could not be broadcast together with shapes (850,850,3) (850,850)

It seems is about alpha channel, but i don't know how to solve it

Image I'm using: https://ibb.co/LYQJNcX Video I`m using: https://we.tl/t-stEzMAwGgI

See my code below

image_mask = ImageClip('images/circle-mask.png', ismask=True) videoclip = VideoFileClip('videos/beach.mp4').set_mask(image_mask).resize(image_mask.size)

video = CompositeVideoClip(
    [
        videoclip,
        image_mask
    ],
    size=image_mask.size). \
    set_duration(5)`
stephan352 commented 2 years ago

Have you tried using a normal black and white image instead? Usually just using a simple black and white image/video works fine for me.

keikoro commented 2 years ago

OP, please always follow the issue template because info on OS and MoviePy version used is often relevant to trying to debug issues.