HACKING 120% {Hacking, programmazione, computer & molto altro}

Byzanz, registrare gif su linux

« Older   Newer »
  Share  
view post Posted on 10/9/2014, 00:49     +1   -1
Avatar

Water can take unforseen forms.

Group:
Founder
Posts:
5,273
Reputation:
+1,147
Location:
Shabang

Status:


Byzanz č un'utility da riga di comando che permette di registrare .gif di ciņ che stiamo facendo, possiamo registrare una finestra, un'area o tutto lo schermo.

Per installare:

CODICE
sudo add-apt-repository -y ppa:fossfreedom/byzanz
sudo apt-get update
sudo apt-get install -y byzanz


Parametri di chiamata:

CODICE
Application Options:

      -a, --audio
             Record audio from the default input device. This only  works  if
             the output format supports it and will otherwise cause an error.

      -c, --cursor
             Record mouse cursor

      -d, --duration=SECS
             Duration of animation (default: 10 seconds)

      --delay=SECS
             Delay before start (default: 1 second)

      --display=DISPLAY
             X display to use

      -h, --height=PIXEL
             Height of recording rectangle

      -v, --verbose
             Be verbos

      -w, --width=PIXEL
             Width of recording rectangle

      -x, --x=PIXEL
             X coordinate of rectangle to record

      -y, --y=PIXEL
             Y coordinate of rectangle to record


Esempio di chiamata:

CODICE
byzanz-record --duration=15 --x=400 --y=400 --width=800 --height=600 output.gif



Il problema di byzanz, come si puņ ben capire, č che come parametri di posizione vuole i pixel e le dimensioni e questo puņ essere un problema, ecco quindi due script che fanno al caso nostro (presi da askubuntu: http://askubuntu.com/questions/107726/how-...of-a-screencast)

Per registrare una finestra:

CODICE
#!/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


Registrare con gui:

CODICE
#!/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=10

# 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"



Se avete domande, chiedete pure :)
 
Web  Top
0 replies since 10/9/2014, 00:49   56 views
  Share