Reference:
- Http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast
1. Software Installation
sudo Install Byzanz
2. Script download
1) byzanz-record-window.sh
#!/bin/bash# Delay before Startingdelay=Ten# Notification to let one know when recording are about to start (and ends)Beep() {Paplay/usr/share/sounds/kde-im-irc-event.ogg &}# Duration and outputfileif[$#-GT0]; ThenD="[email protected]"Else EchoDefault Recording Duration 10s to/tmp/recorded.gif D="--duration=10/tmp/recorded.gif"fiXwininfo=$ (xwininfo) Read X< < (awk-F:'/absolute upper-left X/{print}'<<<"$XWININFO") Read Y< < (awk-F:'/absolute upper-left Y/{print}'<<<"$XWININFO") Read W< < (awk-F:'/width/{print $}'<<<"$XWININFO") Read H< < (awk-F:'/height/{print $}'<<<"$XWININFO")Echodelaying $DELAY seconds. After that, Byzanz'll start for(i= $DELAY; i>0; i)); Do Echo$iSleep 1 DoneBeepByzanz-record--verbose--delay=0--x= $X--y= $Y--width= $W--height=$H $DBeep
2) byzanz-record-region.sh
#!/bin/bash# Delay before Startingdelay=Ten# Notification to let one know when recording are about to start (and ends)Beep() {Paplay/usr/share/sounds/kde-im-irc-event.ogg &}# Duration and outputfileif[$#-GT0]; ThenD="[email protected]"Else EchoDefault Recording Duration 10s to/tmp/recorded.gif D="--duration=10/tmp/recorded.gif"fi# Xrectsel from https://Github.com/lolilolicon/xrectselarguments=$ (Xrectsel"--x=%x--y=%y--width=%w--height=%h") || Exit-1Echodelaying $DELAY seconds. After that, Byzanz'll start for(i= $DELAY; i>0; i)); Do Echo$iSleep 1 DoneBeepByzanz-record--verbose--delay=0${arguments} $DBeep
3)byzanz-record-window-gui.sh
#!/bin/bash# AUTHOR: (c) Rob W -, modified by MHC (http://ASKUBUNTU.COM/USERS/81372/MHC)# Name:gifrecord0.1# description:a script to record GIF screencasts.# license:gnu GPL v3 (http://www.gnu.org/licenses/gpl.html)# Dependencies:byzanz,gdialog,notify-send (InstallViasudoAdd-apt-repository Ppa:fossfreedom/byzanz;
#sudoApt-get Update &&sudoApt-getInstallByzanz Gdialog notify-OSD) # time andDate Time=$(Date+"%y-%m-%d_%h%m%s") # Delay before Startingdelay=Ten# standard Screencast Folderfolder="$HOME/pictures"# Default Recording Durationdefdur=Ten# Notification to let one know when recording are about to start (and ends)Beep() {Paplay/usr/share/sounds/freedesktop/stereo/message-new-instant.oga &}# Custom Recording duration as set by Useruserdur=$ (Gdialog--title"Duration?"--inputbox"Please enter the screencast duration in seconds" $ - 2>&1) # Duration and Outputfileif[$USERDUR-GT0]; ThenD=$USERDURElseD=$DEFDURfi# Window Geometryxwininfo=$ (xwininfo) Read X< < (awk-F:'/absolute upper-left X/{print}'<<<"$XWININFO") Read Y< < (awk-F:'/absolute upper-left Y/{print}'<<<"$XWININFO") Read W< < (awk-F:'/width/{print $}'<<<"$XWININFO") Read H< < (awk-F:'/height/{print $}'<<<"$XWININFO") # Notify The user of recording Timeand delaynotify-send"Gifrecorder" "recording duration set to $D seconds. Recording'll start in $DELAY seconds."#Actual RecordingSleep$DELAYBeepByzanz-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"
3. The program that the installation script relies on
1) Cloning code
- Https://github.com/lolilolicon/xrectsel.git
2) Compile and install
./bootstrap if ./Configure is not present. /configure--prefix=/usrmakesudo make instal
Note: in the execution
./bootstrap
If the following error occurs
./bootstrap:line 1:autoreconf:command Not found
The solution is:
sudo Install autoconf
4. Configure script Execution permissions
sudo chmod 755 ./byzanz-record-region. SH sudochmod755 ./byzanz-record-window. SH sudochmod755 ./byzanz-record-window-gui. SH
5, the trial effect is as follows
./byzanz-record-region. SH
6, for the convenience of later use can be added to the environment variable
Enjoy it.
Linux uses Byzanz to generate GIF picture programs