Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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