Tuesday 25 May 2010

Recording OpenGL applications

Recording software like Istanbul or recordMyDesktop are very useful when recording regular programs, but when it comes to recording OpenGL applications (like games) they are not good, and we need a real-time video capture tool designed to capture OpenGL applications efficiently. One of this applications is glc (another one I tried sometime ago was yukon).

So I gave glc a try, in order to record a car racing game called Speed Dreams. In Ubuntu 9.10 installation of both Speed Dreams and glc is very easy thanks to PlayDeb.net. Once the Speed Dreams was installed, the only problem with it was the sound, which is a known problem in Ubuntu 9.10 with some games. The best solution came from the Ubuntu Forums and involved adding these lines to the file /etc/pulse/daemon.conf:


default-fragments = 5
default-fragment-size =25


Previously I had "solved" the sound problem by creating a file named .alsoftrc, but with that solution no sound was recorded with glc, so I deleted that file.

Once this was in place, we can follow the glc instructions to record a new game, for instance:


angelv@vaiven:~$ glc-capture -o newspeed.glc -k 'F12' speed-dreams


And in order to encode it, we can do it with the encode.sh script (see http://nullkey.ath.cx/projects/glc/wiki/HowtoEncode), although I got a simpler script from http://ubuntuforums.org/archive/index.php/t-587935.html, that works as well:


angelv@vaiven:~$ cat glc-encode
#!/bin/bash
AUDIOFILE=$(echo $1 | sed 's/.glc/.mp3/')
RESULTFILE=$(echo $1 | sed 's/.glc/.avi/')

# Extract audio
glc-play $1 -o - -a 1 | lame -hV2 - $AUDIOFILE

# merge audio with .glc video file
glc-play $1 -o - -y 1 | mencoder -demuxer y4m - -audiofile $AUDIOFILE -oac copy -ovc x264 -x264encopts qp=18:pass=1 -of avi -o $RESULTFILE
angelv@vaiven:~$


With this script we just run


angelv@vaiven:~$ ./glc-encode newspeed.glc


and if all is well, this will create newspeed.avi file.

A demo of the result can be seen at Vimeo

No comments: