diff --git a/byzanz-record-gui.sh b/byzanz-record-gui.sh new file mode 100755 index 0000000..68ab42c --- /dev/null +++ b/byzanz-record-gui.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc) +# NAME: GIFRecord 0.1 +# DESCRIPTION: A script to record GIF screencasts. +# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html) +# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd) + +# Time and date +TIME=$(date +"%Y-%m-%d_%H%M%S") + +# Delay before starting +DELAY=5 + +# Standard screencast folder +FOLDER="$HOME/Pictures" + +# Default recording duration +DEFDUR=10 + +# 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 + +# Window geometry +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") + +# Notify the user of recording time and delay +notify-send "GIFRecorder" "Recording duration set to $D seconds. Recording will start in $DELAY seconds." + +#Actual recording +sleep $DELAY +beep +byzanz-record -c --verbose --delay=0 --duration=$D --x=$X --y=$Y --width=$W --height=$H "$FOLDER/GIFrecord_$TIME.gif" +beep + +# Notify the user of end of recording. +notify-send "GIFRecorder" "Screencast saved to $FOLDER/GIFrecord_$TIME.gif" diff --git a/byzanz-record-region.sh b/byzanz-record-region.sh new file mode 100755 index 0000000..9f101ea --- /dev/null +++ b/byzanz-record-region.sh @@ -0,0 +1,31 @@ +#!/bin/bash - + +#!/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 diff --git a/byzanz-record-window.sh b/byzanz-record-window.sh new file mode 100755 index 0000000..a847253 --- /dev/null +++ b/byzanz-record-window.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Example: byzanz-record-window 30 -c output.gif + +# 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 + diff --git a/install_byzanz_record.sh b/install_byzanz_record.sh new file mode 100644 index 0000000..c38aacf --- /dev/null +++ b/install_byzanz_record.sh @@ -0,0 +1,17 @@ +#!/bin/bash - + +# take from http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast +sudo apt-get install byzanz + +# example +# byzanz-record --duration=15 --x=200 --y=300 --width=700 --height=400 out.gif + +git clone https://github.com/lolilolicon/xrectsel.git +# install automake tool to avoid "autoreconf: not found" error +# use the following command to install automake tool +sudo apt-get install autoconf automake libtool build-essential checkinstall libx11-dev x11-utils + + +# 1. byzanz-record-window - To select a window for recording. +# 2. byzanz-record-region - To select a part of the screen for recording. +# 3. A simple GUI front-end for 1, by MHC.