Skip to content

Instantly share code, notes, and snippets.

@laygond
Created September 12, 2019 18:07
Show Gist options
  • Save laygond/0679709cfc5ac5b06b41178dcae6374d to your computer and use it in GitHub Desktop.
Save laygond/0679709cfc5ac5b06b41178dcae6374d to your computer and use it in GitHub Desktop.
Python script that will make GIF for you from a video clip.
#https://medium.com/@TejasBob/moviepy-is-awesome-part2-73b04e2338b0
from moviepy.editor import *
import moviepy.video.fx.all as vfx
clip = VideoFileClip(path/to/downloaded/video)
clip = clip.resize(0.4)
sub = clip.subclip(179, 182)
sub = sub.fx(vfx.crop, x1=115, x2=399, y1=0, y2=288)
clip2 = sub.speedx(final_duration=2)
clip3 = clip2.fx(vfx.time_mirror)
final = concatenate_videoclips([clip2, clip3])
final.to_gif("boomerang_like_gif.gif", fps=25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment