Posted by Tom, 2009-05-26 Permalink Latest posts List of all posts
Fraps is nice. But it is really choppy on my computer when recording at full resolution. I need to be able to play the game at full speed and deal with encoding later.
I need to record game videos for two things:
1. Promotional purposes (Trailers, etc.)
2. As a reference for the audio guy - see www.catnapgames.com/blog/2… for details.
So I decided to do my own video recorder built into the game.
For that, I created a "proxy" input device that reads all mouse and keyboard input events, adds timestamps to them and writes it all into a file. This is only a few kilobytes of data when I apply GZip compression. Recording the input doesn't slow down the game at all.
Then I run the game again without actually touching the keyboard or mouse and instruct the input recorder to do the exact opposite of what it did before - read the input events from the file and inject them into the game's event queue. Meanwhile the renderer saves each rendered frame into a separate image file.
Finally I run ffmpeg to encode the image files into a single video file.
Optionally I can record audio as well using Audacity and add it to the video using VirtualDub.
Most of this is done automatically via the command line. I get a nice compressed AVI file at the end that I can upload to YouTube.

Comments
Did you use any guides to do this?
I just added another class on top of that which writes each event into a file before adding it into the queue. And for the playback, the same class reads the events from the file and adds them to the queue just as if they had come from the real input devices.
The guys at Oddlabs did something similar for a slightly different purpose: oddlabs.com/blog/?p=20