XMame capture patch
A hack to allow you to capture the output of the XMame emulator as an mpeg movie


This is a patch to the multiple arcade machine emulator, MAME, in particular to version 0.60.1 (which is probably pretty outdated by the time you read this).
Mame emulates a huge number of classic arcade machines, and also has the possibility of making a recording of the gameplay, so you can keep a recording of your best games for bragging with.
Mame however can only record the input events (like keypresses), and to play back the recording you need the exact same version of mame as the recording was made with, and also the same roms.
This patch hooks in a few bindings to libavcodec (from ffmpeg), and lame, the mp3 encoder. Using a hacked sound output driver, and a hack in the X11 video driver, it now can capture each frame of audio and video, and store it into convenient mpeg streams.
Recording basically on my box works like this:
xmame.x11-videodumper -rompath /mnt/roms -sf 48000 -noafs -fs 0 wakuwak7
Then the game starts (albeit a bit slower, since all output is encoded to mpeg in realtime), and I can play while xmame creates a video.outf and audio.outf file. These files are simply mpeg streams, and can be joined into one mpeg file like this:
tcmplex -i video.outf -p audio.outf -o test.mpg
FFMpeg seems to be fast enough to do this in realtime on modern boxes, but if you do not have a fast enough machine, you can always first play the game normally, storing the keystrokes/events using the -record option:
xmame.x11 -record me_finishing_loht.rec loht
and later converting this offline to an mpeg using:
xmame.x11-videodumper -sf 48000 -noafs -fs 0 -playback me_finishing_loht.rec
tcmplex -i video.outf -p audio.outf -o test.mpg

The patch can be found here.

back to my homepage