Main code surely is a code from Quake sources(you can find them in the Inet by "q1source.zip" search query). I removed many things from it(like OpenGL, vid_*, net_* files), that we don't need by the problem statement and will clean code further. Also I took avcodec library from ffmpeg package. FFMpeg is a swiss knife for video processing under Linux and it's avcodec lib is really fast and beautiful. That's mainly all I had.
Dem2mpg can grab video only in software rendering mode, but I'll add support for OpenGL grabbing soon. Immediately after video update for frame in Quake, AddMpgFrame function is called, which is in mpeg.c file. It takes screen buffer(in WxH*1byte format), converts it into YUV sequence and give it to avcodec routines. Isn't it beautiful?
Mpeg encoding has basic MMX support. Now, it is considered to work _only_ under Linux on x86 platform. But it can be ported on any platform and OS further.
This first version creates soundless files. Maybe, dem2mpg will able to save sound into mpeg in the future, it's possible, but I'll take a look on it later. Now, personally I put on soundtracks with System Of A Down and NIN songs :-)
Also I'm going to enable converting into various formats, not only MPEG1. The main candidats are MPEG4, MJPEG and DivX;-) codecs. Anyway, now I convert MPEG1 video into DivX;-) and add sound with transcode - this is simply the grandiose amazing project, I really adore it, thanks to it's developers.