Home > Software engineering >  Convert mp4/avi to gif but the gif is very slow
Convert mp4/avi to gif but the gif is very slow

Time:10-04

I use the below to convert my mp4 file to gif file. It worked fine but when I load the gif with browser or local tool, the gif is moving very slow. E.g. It was an animal moving from point A to point B, in the mp4, it moves like normal but when I converted it to gif, it moves 5times(estimate) slower than the mp4.

Code;

from moviepy.editor import VideoFileClip

videoClip = VideoFileClip("my-life.mp4")

videoClip.write_gif("my-life.gif") 

CodePudding user response:

try adding

(<your.gif>,fps=25,program='ffmpeg') or (<your.gif>,fps=25,program='imageio)

` videoClip.write_gif("my-life.gif", <one of the above goes here>")`
  • Related