Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created December 13, 2014 18:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haya14busa/0dd3923d2a1b5ea07af2 to your computer and use it in GitHub Desktop.
Save haya14busa/0dd3923d2a1b5ea07af2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Delay before starting
DELAY=5
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/ubuntu/stereo/message-new-instant.ogg &
}
# Duration and output file
if [ $# -gt 0 ]; then
D="--duration=$@"
else
if [ ! -d ~/tmp/gif ]; then
mkdir -p ~/tmp/gif
else
if [ -f ~/tmp/gif/recorded.gif ]; then
rm ~/tmp/gif/recorded.gif
fi
fi
echo Default recording duration 50s to ~/tmp/gif/recorded.gif
D="--duration=50 ~/tmp/gif/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
byzanz-record --duration=50 --delay=0 ${ARGUMENTS} ~/tmp/gif/recorded.gif
beep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment