Created
February 20, 2015 22:23
-
-
Save vitovalov/5cd969a2989c9752a5cb to your computer and use it in GitHub Desktop.
mp4 to gif using ffmpeg and gifsicle(brew)
This file contains 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
# Author: @vitovalov | |
# Description: pass it a mp4 and you will have a gif | |
# Dependencies: ffmpeg, gifsicle | |
if [ "$#" -le 1 ]; then | |
echo "\nUsage: sh gifit.sh <source path to original mp4> <delay between frames>" | |
echo "Warning! filenames shouldn't contain the extension\n" | |
exit 1 | |
fi | |
ffmpeg -i $1.mp4 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=$2 > $1.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is my version which I tried to optimise ~ hovever Gifsicle seems to not reduce the file size much when already using a palette.
This script can be used as a service in Mac Automator for a quick right click action.
Outside of mac you'll have to either remove
-hwaccel videotoolbox
or replace it with the corresponding hwaccel implementation available on your platform.