Created
September 27, 2016 17:31
-
-
Save mwcz/e92f4bfdf7260557c0b196b745070d8c to your computer and use it in GitHub Desktop.
gif command for recording animated gifs in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: gif SECONDS FILENAME | |
# example: gif 4 out.gif | |
# then drag a box :D | |
# Delay before starting | |
DELAY=0 | |
# Duration and output file | |
if [ $# -gt 0 ]; then | |
D="--duration=$@" | |
else | |
FILE="/tmp/$(date +%s).gif" | |
echo Default recording duration ${DELAY}s to $FILE | |
D="--duration=10 $FILE" | |
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 | |
byzanz-record -c --verbose --delay=0 ${ARGUMENTS} $D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment