tFixed the gif option - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit b9633c3869060d77c139b6768fc98a92b820d838
(DIR) parent 1cbcba3dd3b3d231d6c0059f10a845c4a03ca18f
(HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Mon, 4 Nov 2013 01:22:48 +0100
Fixed the gif option
Diffstat:
M instagram | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/instagram b/instagram
t@@ -24,7 +24,7 @@ Usage : instagram [-tmuwh] [-g number] [-s screen] [filename.png]
-w : take only a window for the shot (choose with pointer)
-h : display this help
-d path : save the shot in <path>
- -g number : create a gif out of <number> shot (0.5 second between shots)
+ -g : create a gif (press ctrl-C to stop)
-s screen : use only the screen number <screen> for the shot
Also, do not give path to shot. They're saved to $SSHOT_DIR by default.
t@@ -48,12 +48,12 @@ function upload() {
# default window id
WINDOW='root'
-while getopts ":htmuwd:g:s:" opt; do
+while getopts ":htmuwd:gs:" opt; do
case $opt in
t) THUMB=1 ;;
m) MULTI=1 ;;
d) SSHOT_DIR=$OPTARG ;;
- g) GIF=$OPTARG ;;
+ g) GIF=1 ;;
s) SCREEN=$OPTARG ;;
u) UPLOAD=1 ;;
w) WINDOW=$(xprop|grep 'window id'|cut -d\ -f7);;
t@@ -82,11 +82,10 @@ if [[ "$MULTI" = "1" ]] || [[ -n $SCREEN ]]; then
elif [ -n "$GIF" ]; then
mkdir $SSHOT_DIR/tmp
- for i in $(seq 0 $GIF); do
- import -window ${WINDOW} $SSHOT_DIR/tmp/gif${i}_${OUTPUT}
- sleep 0.5
- done
- convert -delay 100 -loop 0 $SSHOT_DIR/tmp/gif*$OUTPUT $SSHOT_DIR/${1/jpg/gif}
+ ffmpeg -f x11grab -s 1440x900 -r 25 -i :0.0 $SSHOT_DIR/tmp/out.mov
+ ffmpeg -i $SSHOT_DIR/tmp/out.mov -r 1 -f image2 $SSHOT_DIR/tmp/%05d.jpg
+ convert -delay 100 $SSHOT_DIR/tmp/*.jpg $SSHOT_DIR/${OUTPUT}
+ rm -rf $SSHOT_DIR/tmp
else
import -window ${WINDOW} $SSHOT_DIR/$OUTPUT
[[ -n $THUMB ]] && import -window ${WINDOW} -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT}