Skip to content

Instantly share code, notes, and snippets.

@kennyledet
Created August 19, 2013 05:50
Show Gist options
  • Save kennyledet/6266067 to your computer and use it in GitHub Desktop.
Save kennyledet/6266067 to your computer and use it in GitHub Desktop.
python gif-maker.py {filepath} {start time} {run time} python gif-maker.py movie.mp4 00:00:39 3
# gif-maker.py
# Copyright 2013 Kendrick Ledet
import sys, os
path = sys.argv[1]
start = sys.argv[2]
end = sys.argv[3]
fname = os.path.basename(path)
print fname
#os.system('ffmpeg -i "%s" -vcodec copy -acodec copy -ss %s -t %s temp.avi' % (path, start, end))
os.system('ffmpeg -i "{}" -ss "{}" -t "{}" -an -r 15 -s 320x240 tmp/tmp%06d.gif'.format(path, start, end))
os.system('gifsicle --loop tmp/*.gif > "gifs/{}--{}-{}.gif" '.format(fname.split('.')[0], start.replace('/',':'), end))
os.system('rm tmp/*.gif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment