Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Capturing X11 video/pulse audio using avconv



(Sorry I wasn't at the meeting tonight.  I really wanted to go but I
work in Marlborough and got out too late)

I'm trying to put a script together to capture the video and audio from
a window.  For instance, let's say I'm watching a Flash video on a
website and I want to capture the Firefox window.  I'm not picky about
the video or audio format.  Lossy is probably OK.  This is on Kubuntu 12.04.

I found a clever post on Youtube on how to do it with ffmpeg, which is
deprecated.  The clever part is he used xwininfo to get the geometry and
offset to capture.  Converting it to avconv and adding some of my own
touches and things I picked up from other links, I ended up with:

---------------------------------------------------------------------------------------------------
echo "*** Click on the window to be recorded ***"
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/+/,/' )
FPS="25"
VIDEO_OPTIONS="-vcodec mpeg4"
AUDIO_OPTIONS="-f alsa -i pulse"
avconv -f x11grab -s ${WIN_GEO} -r ${FPS} -i :0.0+${WIN_XY} -threads 2
-y ${VIDEO_OPTIONS} ${AUDIO_OPTIONS} $1.mpg
---------------------------------------------------------------------------------------------------

This is does a great job of capturing the video, but I just get hissing
from the audio.  I'm guessing that these audio parameters are designed
to capture from an input device, and not "the sound I hear through my
speakers".  Ideally I would be able to capture the sound coming from
that app, but that's a bit crazy, so any sound that's going to the
output would be close enough.

Any ideas?




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org