Monday, May 28, 2012

Screencasting in Linux

I discovered a very useful command to record a desktop window using FFMPEG.
Credits to egrounds.org

Using the video captured from FFMPEG, and audio captured from an external Zoom H1 digital recorder,
I can combine these two recordings into a decent screencast.



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

echo $WIN_GEO
echo $WIN_XY

ffmpeg -f x11grab -r 15 -s $WIN_GEO -i :0.0+$WIN_XY -vcodec mpeg4 -sameq -y /tmp/$1.avi