Skip to content

Instantly share code, notes, and snippets.

@baitisj
Created February 26, 2017 02:02
Show Gist options
  • Save baitisj/0cdb59ec53488b1b8dec85c4c29de660 to your computer and use it in GitHub Desktop.
Save baitisj/0cdb59ec53488b1b8dec85c4c29de660 to your computer and use it in GitHub Desktop.
Click on a window to perform screen grab at 5 FPS
#!/bin/sh
echo "Click on a window to record."
properties=`xwininfo | grep ":"`
width=`echo "$properties" | grep "Width: " | tr -d '[:space:]' | cut -d ':' -f 2`
height=`echo "$properties" | grep "Height: " | tr -d '[:space:]' | cut -d ':' -f 2`
ulx=`echo "$properties" | grep "Absolute upper-left X:" | tr -d '[:space:]' | cut -d ':' -f 2`
uly=`echo "$properties" | grep "Absolute upper-left Y:" | tr -d '[:space:]' | cut -d ':' -f 2`
ffmpeg -loglevel quiet -f x11grab \
-framerate 5 \
-video_size ${width}x${height} \
-i :0.0+${ulx},${uly} \
-vcodec libx264 \
-qp 0 \
-preset ultrafast \
/var/tmp/output.mkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment