Created
May 26, 2016 20:17
-
-
Save Jacajack/b93548694418b9fbc9dd57a425266dbd to your computer and use it in GitHub Desktop.
Record screen region with Byzanz and xrectsel
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 | |
#Records selected screen region, with GUI | |
#This is combined version of GIF recording scripts, that can be found here: http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast | |
#Thanks to Rob W, and the other author (unmentioned), for creating this lovely scripts | |
#I do not own any rights to code I didn't write | |
# ~Jacajack | |
DELAY=5 #Delay before starting | |
DEFDUR=10 #Default recording duration | |
TIME=$(date +"%Y-%m-%d_%H%M%S") #Timestamp | |
FOLDER="$HOME/Pictures/Byzanz" #Default output directory | |
#Sound notification to let one know when recording is about to start (and ends) | |
beep() { | |
paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga & | |
} | |
#Custom recording duration as set by user | |
USERDUR=$(gdialog --title "Duration?" --inputbox "Please enter the screencast duration in seconds" 200 100 2>&1) | |
#Duration and output file | |
if [ $USERDUR -gt 0 ]; then | |
D=$USERDUR | |
else | |
D=$DEFDUR | |
fi | |
#Get coordinates using xrectsel from https://github.com/lolilolicon/xrectsel | |
REGION=$(xrectsel "--x=%x --y=%y --width=%w --height=%h") || exit -1 | |
notify-send "GIFRecorder" "Recording duration set to $D seconds. Recording will start in $DELAY seconds." | |
for (( i=$DELAY; i>0; --i )) ; do | |
sleep 1 | |
done | |
#Record | |
beep | |
byzanz-record --cursor --verbose --delay=0 ${REGION} --duration=$D "$FOLDER/byzanz-record-region-$TIME.gif" | |
beep | |
notify-send "GIFRecorder" "Screencast saved to $FOLDER/byzanz-record-region-$TIME.gif" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment