2 # Fugly script to use ffmpeg to capture a given window 
   4 INFO
=$
(xwininfo 
-frame) 
   6 WIN_GEO
=$
(echo $INFO | 
grep -oEe 'geometry [0-9]+x[0-9]+' | 
grep -oEe '[0-9]+x[0-9]+') 
   7 WIN_XY
=$
(echo $INFO | 
grep -oEe 'Corners: \+[0-9]+\+[0-9]+' | 
grep -oEe '[0-9]+\+[0-9]+' | 
sed -e 's/\+/,/') 
   8 WIN_X
=$
(echo $WIN_GEO | cut 
-d "x" -f 1 | 
awk '{print $1+$1%2}') 
   9 WIN_Y
=$
(echo $WIN_GEO | cut 
-d "x" -f 2 | 
awk '{print $1+$1%2}') 
  11 ffmpeg 
-f alsa 
-ac 1 -i pulse 
-f x11grab 
-r 30 -s ${WIN_X}x${WIN_Y} -i :0.0+${WIN_XY} -vcodec libx264 -vpre lossless_ultrafast -acodec libmp3lame ${HOME}/screencast-$
(date +%F-
%H-
%M-
%S
).mkv