Skip to content

Instantly share code, notes, and snippets.

@robinp
Created August 29, 2016 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinp/ef5975ff7463ce5b423220b0263a0dca to your computer and use it in GitHub Desktop.
Save robinp/ef5975ff7463ce5b423220b0263a0dca to your computer and use it in GitHub Desktop.
How to save a screen region to gif.
# Need to install ffcast, and advisedly also xrectsel (on arch can do from AUR)
# Below command will let you select a region with the mouse, than stream it to ffmpeg.
# Many args magic (taken from SO), but allegedly it saves as lossless.
ffcast -s % ffmpeg -f x11grab -show_region 1 -framerate 20 -video_size %s -i %D+%c -codec:v huffyuv -vf crop="iw-mod(iw\\,2):ih-mod(ih\\,2)" out.avi
# Use ImageMagick to covert to gif - works great!
convert -set delay 5 -layers Optimize out.avi out.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment