Search code examples
pythonpython-2.7moviepy

Moviepy generating GIFs from the same point


I have tried to generate a simple GIF file from this video. My code is below:

from moviepy.editor import *
clip = (VideoFileClip("Mighty Kungfu Panda 'Skadoosh'.mp4").subclip((0,0.18),(0,0.21)).resize(0.3))
clip.write_gif("skadoosh2.gif")

But GIF is not generating properly. All i can see, an image of the starting scene of the clip. I have tried different parameters with subclip(). But the result has remained same.


Solution

  • The problem is that 0.18 and 0.21 refer to fractions of seconds, so you are asking for a clip of duration 0.03 !!

    Instead, if you want the clip between t=18s and t=21s, use subclip(18, 21)