28 July 2011

single window screen capture script using ffmpeg



#!/bin/sh
INFO=$(xwininfo -frame)

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/\+/,/' )

ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 15 -s $WIN_GEO -i :0.0+$WIN_XY -acodec libfaac -vcodec huffyuv -threads 0 -sameq -y $1.avi
libfaac can be installed in ubuntu 11.04 with:

sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update ; sudo apt-get install ffmpeg libavcodec-extra-52

No comments:

Post a Comment

Pages