Skip to content

Instantly share code, notes, and snippets.

@pituz
Created September 21, 2014 01:07
Show Gist options
  • Save pituz/4c4c14b571b834462946 to your computer and use it in GitHub Desktop.
Save pituz/4c4c14b571b834462946 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
f="${1-$$.mkv}"
rate=25
echo "Click a window to record.."
coords=( $(xwininfo | awk '/Absolute upper-left [XY]:/ {print $4} /Width:|Height:/ {print $2}') )
#aopts=(-f alsa -i live)
#aopts=(-f pulse -i default)
aopts=()
ffmpeg -s $((coords[3]/2*2))x$((coords[4]/2*2)) -r $rate -f x11grab -show_region 1 -i ${DISPLAY}+${coords[1]},${coords[2]} $aopts -c:v libx264 -pix_fmt yuv420p -qp 0 -tune zerolatency -preset ultrafast -y $f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment