First, we need to install the library with pip:
pip3 install moviepy
And then, create python file like this:
from moviepy.editor import VideoFileClip videoClip = VideoFileClip("video.mp4") videoClip.write_gif("video.gif")
In code above, video.mp4 is video filename, and video.gif is filename for the result. Next, run python file and wait until the process is finished.