Skip to content

Instantly share code, notes, and snippets.

@unstabler
Created October 13, 2014 00:01
Show Gist options
  • Save unstabler/aad1161d3a50c38d42dc to your computer and use it in GitHub Desktop.
Save unstabler/aad1161d3a50c38d42dc to your computer and use it in GitHub Desktop.
ffmpeg x11grab를 이용한 스크린 캡쳐
#!/bin/sh
OUTFILE=$1
if [ -z $OUTFILE ]
then
OUTFILE='out.mp4'
fi
XWININFO=$(xwininfo -frame)
WINDOW_RES=$(echo $XWININFO | perl -ne 'print $1 if /geometry\s+(\d+x\d+)/')
CORNERS=$(echo $XWININFO | perl -ne 'print "$1,$2" if /Corners:\s+([+]\d+)([+]\d+)/')
ffmpeg -y -f alsa -i pulse -f x11grab -s "$WINDOW_RES" -i ":0.0$CORNERS" -r 60 \
-vcodec libx264 -preset ultrafast -crf 18 -acodec libmp3lame -b:a 160k "$OUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment