This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.
Forked from https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
- Open "Quicktime Player",
- Go to File -> New Screen Recording
- Selected screen portion by dragging a rectangle, recorded 13 second video.
- Go to File -> Export -> As Movie
- Saved the video in full quality with the filename
in.mov
- Saved the video in full quality with the filename
Create a palette image from the video:
ffmpeg -y -i in.mov -vf fps=10,palettegen palette.png
Convert into a GIF using the palette
ffmpeg -i in.mov -i palette.png -filter_complex "fps=10,paletteuse" out.gif
Combined together into a bash function which also resizes to 640x? (thanks to @robertoentringer and @nick):
function movtogif () {
tempfile=.mov-to-gif-$(date +"%s").png
ffmpeg -i $1 -vf "scale=640:-2" "${1%.mov}-resized.mov"
ffmpeg -stats -y -i "${1%.mov}-resized.mov" -vf fps=10,palettegen $tempfile
ffmpeg -stats -i "${1%.mov}-resized.mov" -i $tempfile -filter_complex "fps=10,paletteuse" "${1%.mov}.gif"
rm $tempfile "${1%.mov}-resized.mov"
}
movtogif original.mov
The conversion process requires the following command-line tools:
- ffmpeg to process the video file
If you use homebrew and homebrew-cask software packages, just type this in:
brew install ffmpeg
- http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality/556031#556031
- http://schneems.com/post/41104255619/use-gifs-in-your-pull-request-for-good-not-evil (primary source!)
- http://www.reddit.com/r/programming/comments/16zu7d/use_gifs_in_your_pull_requests_for_good_not_evil/
- http://superuser.com/questions/436056/how-can-i-get-ffmpeg-to-convert-a-mov-to-a-gif#_=_
- http://gnuski.blogspot.ca/2012/06/creating-animate-gif-with-free-software.html
- Extend https://github.com/dergachev/copy-public-url folder action for this use case
- it would automate the conversion before copying Dropbox public URL
- assign the folder action to ~/Dropbox/Public/Screenshots/gif
- consider finding a way to simplify the dependency installation
Another version that also reduces the dimensions by 50% (useful if you're recording on a retina screen):