Skip to content

Instantly share code, notes, and snippets.

@oglops
Last active August 29, 2015 14:05
Show Gist options
  • Save oglops/f1d7f14abec94f4ceedd to your computer and use it in GitHub Desktop.
Save oglops/f1d7f14abec94f4ceedd to your computer and use it in GitHub Desktop.
record specified window with ffmpeg script by 风入松 qq:896806986
#!/bin/bash
#=========================================================================
# FileName: myrecord.sh
# Desc: -- record my desktop by ffmpeg
# Author: tiglog
# Email: tiglog@126.com
# Version: 1.0
# LastChange: 2013-09-20 20:20:51
#=========================================================================
# Usage: myrecord.sh /path/fo/out.flv
if [ $# -ne 1 ]; then
echo -e "Usage: \n\t myrecord.sh <out.flv>\n\n"
exit 0
fi
wininfo=`xwininfo | egrep Width\|Height\|Corners`
w=`echo $wininfo | awk '{print $2}'`
h=`echo $wininfo | awk '{print $4}'`
s=`echo $wininfo | awk '{print $6}'|sed 's/+\([0-9]\+\)$/,\1/'`
ffmpeg -s ${w}x${h} -r 25 -f x11grab -i :0.0${s} -f alsa -ac 2 -ar 44100 -i pulse -qscale 6 $1
# vim:ft=bash
# End of file myrecord.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment