A commandline tool to convert SCREENCAST.mov into ANIMATED.gif
Here's what happens when you apply it to demo.mov
screengif.rb - Convert your screencast into a gif.
Usage:
screengif.rb [options] [--input FILENAME.mov] [--output OUTPUTFILE.gif]
Examples:
./screengif.rb --input demo.mov --output out.gif
cat somefile.gif | ./screengif.rb --progressbar --framerate 10 --delay 50 --delay-last 5 > out.gif
Specific options:
-i, --input FILENAME.mov Use ffmpeg to convert FILENAME.mov into PPM image stream and process results.
If missing, will process PPM or GIF image stream from STDIN.
-o, --output FILENAME.gif Output resulting GIF data to FILENAME.gif. (defaults to STDOUT).
-p, --progressbar Overlay progress bar on the animation.
-d, --delay MS Animation frame delay, in tens of ms. (default: 10)
--delay-last MS Animation frame delay of last frame, in tens of ms. (default: 50)
-r, --framerate FPS Specify amount of frames per second to keep. (default: 10)
--max-width PIXELS Output image max width, in pixels. (default: 600)
--max-height PIXELS Output image max width, in pixels. (default: 600)
--no-coalesce Skip Magick::ImageList#coalesce() if input doesn't need it.
--no-gifsicle Prevent filter the output through gifsicle. Greatly increases output file size.
-h, --help Show this message
-v, --verbose Verbose output
--version Show version
The following works with OS X and homebrew:
git clone https://github.com/dergachev/screengif.git
cd screengif
# x-quartz is a dependency for gifsicle, no longer installed starting on 10.8
brew cask install x-quartz
open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg # runs the XQuartz installer
brew install ffmpeg imagemagick gifsicle
# brew install ghostscript # not sure if this is necessary
See https://gist.github.com/dergachev/4627207#os-x-screencast-to-animated-gif
for a guide on how to use Quicktime Player to record a screencast on OS X.
Keep in mind that other tools (like Screenflow) produce better video quality.
If you install copy-public-url, the following will automatically upload your new gif to Dropbox:
cp out.gif ~/Dropbox/Public/screenshots
- http://freezeframe.chrisantonellis.com/ (js library to freeze/play gifs)
- http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast
-
http://railscasts.com/episodes/374-image-manipulation?view=asciicast
-
https://github.com/markandrus/imgswiss/blob/master/pipeline.rb (ffmpeg -> imagemagick via rmagick -> gif)
-
http://www.imagemagick.org/RMagick/doc/constants.html#GravityType
-
http://www.imagemagick.org/RMagick/doc/clip_path.rb.html (define_clip_path example)
- http://www.imagemagick.org/Usage/draw/
- http://www.imagemagick.org/Usage/anim_opt/
- http://www.imagemagick.org/Usage/transform/#fx
- http://www.imagemagick.org/Usage/layers/
- http://www.imagemagick.org/script/command-line-options.php#delete
- http://www.imagemagick.org/script/fx.php
- http://www.imagemagick.org/script/escape.php
- http://www.imagemagick.org/Usage/annotating/#watermarking
- http://www.imagemagick.org/Usage/anim_mods/#frame_mod
- http://www.ioncannon.net/linux/81/5-imagemagick-command-line-examples-part-1/
- http://andreinc.net/2011/09/04/bash-scripting-best-practice/
- http://stackoverflow.com/questions/242538/unix-shell-script-find-out-which-directory-the-script-file-resides
- TODO: implement tests; see https://github.com/pgericson/progress_bar/blob/master/test/arguments_test.rb
- TODO: look at mixlib-{shellout,cli,logger}; https://github.com/opscode/mixlib-shellout
- TODO: look at https://github.com/bitboxer/simple_progressbar/blob/master/lib/simple_progressbar.rb