Make record-window configurable

59af5308deba0d08ea61f6d5fcb5c83364491277
Alexis Sellier committed ago 1 parent 5f3349b0
bin/record-window +4 -1
2 2
3 3
unset x y w h
4 4
5 5
mkdir -p $HOME/recordings
6 6
7 +
FPS=${FPS:-4}
8 +
SCALE=${SCALE:-.5}
9 +
7 10
eval $(xwininfo -id $(xdotool getactivewindow) |
8 11
    sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
9 12
           -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
10 13
           -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
11 14
           -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
16 19
ffmpeg -v warning \
17 20
	     -video_size ${w}x${h} \
18 21
			 -framerate 6 \
19 22
			 -f x11grab \
20 23
			 -i :0.0+${x},${y} \
21 -
			 -vf fps=4,scale=iw*.5:ih*.5:flags=lanczos \
24 +
			 -vf fps=$FPS,scale=iw*$SCALE:ih*$SCALE:flags=lanczos \
22 25
			 -gifflags +transdiff -y \
23 26
			 "$HOME/recordings/recording-$now.gif"
24 27