Zulko / moviepy

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

Mayavi example not working #954

Closed brey closed 1 year ago

brey commented 5 years ago

The examples for mayavi animations e.g.

Steps to Reproduce the Problem

import numpy as np
import mayavi.mlab as mlab
import  moviepy.editor as mpy

duration= 2 # duration of the animation in seconds (it will loop)

# MAKE A FIGURE WITH MAYAVI

fig_myv = mlab.figure(size=(220,220), bgcolor=(1,1,1))
X, Y = np.linspace(-2,2,200), np.linspace(-2,2,200)
XX, YY = np.meshgrid(X,Y)
ZZ = lambda d: np.sinc(XX**2+YY**2)+np.sin(XX+d)

# ANIMATE THE FIGURE WITH MOVIEPY, WRITE AN ANIMATED GIF

def make_frame(t):
    mlab.clf() # clear the figure (to reset the colors)
    mlab.mesh(YY,XX,ZZ(2*np.pi*t/duration), figure=fig_myv)
    return mlab.screenshot(antialiased=True)

animation = mpy.VideoClip(make_frame, duration=duration)
animation.write_gif("sinc.gif", fps=20)

are failing with ...

Actual Behavior

ValueError: cannot reshape array of size 12 into shape (0,0,3)

Specifications

keikoro commented 1 year ago

Closing this issue as it's old and based on an old MoviePy version, so impossible to tell if it's still relevant.

Do report back – following our issue template – if the problem persists when you try with the latest master (not the last PyPI release).