Sometimes producing a good animated GIF requires a few advanced tweaks, for which scripting can help. So I added a GIF export feature to MoviePy, a Python package originally written for video editing.
Converting a video excerpt into a GIF
In what follows we import MoviePy, we open the video file, we select the part between 1’22.65 (1 minute 22.65 seconds) and 1’23.2, reduce its size (to 30% of the original) and save it as a GIF:
from moviepy.editor import * clip = (VideoFileClip("./frozen_trailer.mp4") .subclip((1,22.65),(1,23.2)) .resize(0.3)) clip.write_gif("use_your_head.gif")