Skip to content

Instantly share code, notes, and snippets.

@carlmartus
Created April 9, 2014 08:17
Webm capture window with avconv
#!/bin/sh
SCREENRES=1280x1024
BITRATE=1000K
FPS=30
TEMP=`mktemp -u`
xwininfo > $TEMP
WINX=`grep "Absolute upper-left X" $TEMP | awk '{ print $4 }'`
WINY=`grep "Absolute upper-left Y" $TEMP | awk '{ print $4 }'`
WINW=`grep Width $TEMP | awk '{ print $2 }'`
WINH=`grep Height $TEMP | awk '{ print $2 }'`
CROPSTR=$WINW:$WINH:$WINX:$WINY
TEMPAVI=`mktemp -u`.avi
echo "Crop: $CROPSTR"
trap 'echo BYE' 2 3
avconv -y -f x11grab -s $SCREENRES -i :0.0 -r $FPS -an -c rawvideo -vf crop=$CROPSTR $TEMPAVI
echo "Output: $1"
avconv -y -i $TEMPAVI -an -b 800K $1
rm $TEMPAVI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment