Skip to content

Instantly share code, notes, and snippets.

@antzucaro
Created November 20, 2011 23:40
Show Gist options
  • Save antzucaro/1381168 to your computer and use it in GitHub Desktop.
Save antzucaro/1381168 to your computer and use it in GitHub Desktop.
#!/bin/sh
# this bit came from youtube.com/watch?v=_XDa1ahl7fw
INFO=$(xwininfo)
WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')
WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' )
AUDIO_INPUT="-f alsa -i hw:0,0 -ac 2"
VIDEO_INPUT="-f x11grab -r 30 -s $WIN_GEO -i :0.0+$WIN_XY"
#AUDIO_CODEC="-acodec pcm_s16le"
AUDIO_CODEC="-acodec flac"
VIDEO_CODEC="-vcodec libx264 -vpre lossless_ultrafast"
EXTRA_OPTS="-async 100"
EXTRA_OPTS="$EXTRA_OPTS -threads 2"
# seems to make it laggier
#schedtool -I -e \
ffmpeg \
$AUDIO_INPUT $VIDEO_INPUT \
$AUDIO_CODEC $VIDEO_CODEC \
$EXTRA_OPTS \
-y screencap-$(date +%Y%m%d-%H%M%S).mkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment