Created
June 6, 2015 17:13
-
-
Save alejoar/32820d8f759d20588796 to your computer and use it in GitHub Desktop.
Record gif from screen (by user Rob W http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast)
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 | |
# 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 |
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 | |
# 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 | |
XWININFO=$(xwininfo) | |
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO") | |
read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO") | |
read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO") | |
read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO") | |
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 --x=$X --y=$Y --width=$W --height=$H $D | |
beep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment