Skip to content

Instantly share code, notes, and snippets.

@bacinsky
Created March 7, 2015 06:55
Show Gist options
  • Save bacinsky/20f19221f7a127f020da to your computer and use it in GitHub Desktop.
Save bacinsky/20f19221f7a127f020da to your computer and use it in GitHub Desktop.
Creating GIF screenshots
#!/bin/bash
# http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast#answer-201018
# Dependency: xrectsel from xrectsel. Clone the repository and run make to get the executable.
# (If it protests there is no makefile, run ./bootstrap and the ./configure before running `make).
# Delay before starting
DELAY=10
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
}
# Duration and output file
if [ $# -gt 0 ]; then
D="--duration=$@"
else
echo Default recording duration 10s to /tmp/recorded.gif
D="--duration=10 /tmp/recorded.gif"
fi
# xrectsel from https://github.com/lolilolicon/xrectsel
ARGUMENTS=$(xrectsel "--x=%x --y=%y --width=%w --height=%h") || exit -1
echo Delaying $DELAY seconds. After that, byzanz will start
for (( i=$DELAY; i>0; --i )) ; do
echo $i
sleep 1
done
beep
byzanz-record --verbose --delay=0 ${ARGUMENTS} $D
beep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment