0

The following lines:

currentImageClip = ImageClip(r'path/to/image')
imageClipWithCaption = CompositeVideoClip([ColorClip(size=(1080, 720), color='black'), currentImageClip])

gives me the following error:

Traceback (most recent call last):
  File "C:\Users\samlb\Documents\folder\pythonFile.py", line 140, in makeVideo
    imageClipWithCaption = CompositeVideoClip([ColorClip(size=(1080, 720), color='black'), currentImageClip])
  File "C:\Users\samlb\AppData\Roaming\Python\Python39\site-packages\moviepy\video\VideoClip.py", line 1157, in __init__
    np.tile(color, w * h).reshape(shape), is_mask=is_mask, duration=duration
ValueError: cannot reshape array of size 777600 into shape (720,1080,5)

How can I avoid this error? Does it have something to do with the type of image I'm trying to composite?

This is the image I'm using (.png):

enter image description here

General Info: Python 3.9.13, moviepy 2.0.0.dev2-, Windows 10

Relevant moviepy code:

ImageClip in https://github.com/Zulko/moviepy/blob/master/moviepy/video/VideoClip.py CompositeVideoClip in https://github.com/Zulko/moviepy/blob/master/moviepy/video/compositing/CompositeVideoClip.py

  • Can you please post more code? Such as the imports for `ImageClip` and `CompositeVideoClip` also the product of 720,1080,5 is exactly half of the required 7776000, maybe this can help you debug – Caridorc Feb 14 '23 at 15:22
  • Maybe try changing the `duration` argument – Caridorc Feb 14 '23 at 15:25
  • @Caridorc ImageClip is be found here: https://github.com/Zulko/moviepy/blob/master/moviepy/video/VideoClip.py CompositeVideoClip is be found here: https://github.com/Zulko/moviepy/blob/master/moviepy/video/compositing/CompositeVideoClip.py – THEMOUNTAINSANDTHESKIES Feb 14 '23 at 15:35

0 Answers0