
I was working with grayscale back at the time. This code above also depends on the pixel format. Where FFMPEG_BIN = "ffmpeg.exe" # on Windows Self.proc = sp.Popen(cmd, bufsize= self.bufsize, You read the video with subprocess: cmd = (+ '-i' + self.filename + Catch the idea, for if you just copy the code it won't work, because I will paste parts of my own. I'll try to sketch here what I have used. # transform the clip and write every frame as a jpegĬlip.fl_image(vertical_flip).to_images_sequence("images%03d.jpeg") Vertical_flip = lambda frame: frame # 'frame' is a numpy array In the following example, I load a gif, I flip each frame vertically, and write each of them as an JPEG image: from moviepy.editor import VideoFileClip You can also output jpeg, still using ffmpeg, but that requires that you stay with numpy images (you can use PIL, but you will need to retransform the resulting frames to numpy arrays before saving them as JPEG).

# now frame is a numpy array, do wathever you want

For instance: from moviepy.editor import VideoFileClipĬlip = VideoFileClip('myanimation.gif') # can be gif or movie I second the solution of u/Kaxitaz, but just in case it's useful, MoviePy also uses ffmpeg to convert your gif into numpy arrays (the core code looks 90% like the one given by Kaxitaz, so if you can use one, you can use the other).
