Screen_save_gif
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 10 Feb 2015 13:21:37 +0000 (14:21 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 10 Feb 2015 13:21:37 +0000 (14:21 +0100)
screen_save_gif [new file with mode: 0755]

diff --git a/screen_save_gif b/screen_save_gif
new file mode 100755 (executable)
index 0000000..a6b529f
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+TMP_AVI=$(mktemp /tmp/outXXXXXXXXXX.avi)
+GEOMETRY=`ffcast -s % echo "%D+%g"`
+
+DISP=`echo $GEOMETRY | cut -d'+' -f1`
+SIZE=`echo $GEOMETRY | cut -d'+' -f2`
+X=`echo $GEOMETRY | cut -d'+' -f3`
+Y=`echo $GEOMETRY | cut -d'+' -f4`
+
+if [ -z "$1" ]; then
+  OUTPUT=out.gif
+else
+  OUTPUT=${1}.gif
+fi
+
+ffmpeg -y -f x11grab -framerate 25 -video_size $SIZE -i $DISP+$X,$Y -codec:v huffyuv -vf crop="iw-mod(iw\,2):ih-mod(ih\,2)" $TMP_AVI
+convert -set delay 10 -layers Optimize $TMP_AVI $OUTPUT