Created
January 30, 2017 23:40
-
-
Save irace/a81f95c0a596342427403c87a567ea82 to your computer and use it in GitHub Desktop.
GIF.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# A simple script to generate an animated gif from an mp4 file. | |
# | |
# Some notes: | |
# - To use this you need both ffmpeg and imagemagick installed. You can 'brew install' both of them. | |
# - Our version of github enterprise has a 10MB size limit per file. Make sure your gifs are below that limit. | |
# | |
# This is based on https://gist.github.com/dergachev/4627207 | |
# | |
# Example usage: ./make-gif.sh my-input-video.mp4 | |
# Notes on the arguments: | |
# | |
# -r 10 tells ffmpeg to reduce the frame rate from 25 fps to 10 | |
# -s 320x568 tells ffmpeg the max-width and max-height | |
# --delay=5 tells imagemagick to delay 50ms between each frame | |
ffmpeg -i $1 -s 320x568 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -layers Optimize -loop 0 - out.gif | |
# Gifsicle version. This requires you to 'brew install gifsicle' before using. | |
# This is way faster and generates smaller (filesize) gifs, but the gifs are lower quality than imagemagick's. | |
# ffmpeg -i $1 -s 320x568 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment