From 6fdb8c179aa1415fdf4544025b7449b7a01f2a96 Mon Sep 17 00:00:00 2001 From: Abhay Rana Date: Thu, 20 Feb 2014 17:57:32 +0530 Subject: [PATCH] Record to gif --- byzanz-record-region.sh | 29 +++++++++++++++++++++++++++++ byzanz-record-window.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 byzanz-record-region.sh create mode 100755 byzanz-record-window.sh diff --git a/byzanz-record-region.sh b/byzanz-record-region.sh new file mode 100755 index 0000000..2f19117 --- /dev/null +++ b/byzanz-record-region.sh @@ -0,0 +1,29 @@ +#!/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/FFcast2/blob/master/xrectsel.c +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 \ No newline at end of file diff --git a/byzanz-record-window.sh b/byzanz-record-window.sh new file mode 100755 index 0000000..81825fb --- /dev/null +++ b/byzanz-record-window.sh @@ -0,0 +1,32 @@ +#!/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