If I were wanting to write something that output mpegs of a game or something how I would do it is this (brace yourself this is quite visual)
Code:
In code tags.... stupid thing was complaining at me.
Step 1:
[game video buffer] -> <capture at fixed intervals of 30fps> -> vbuffer
[game sound buffer] -> <capture at a fixed interval of 96kb/s> -> sbuffer
Step 2:
vbuffer
\
<uncompressed data file> -> {compression queue} -> {compress like 320kb/s} -> mbuffer
/
sbuffer
Step 3:
mbuffer -> [output file.]
I would only do it this way because I assume you would be trying to play your game while capturing video. At least if you do something like this technique you are sacrificing quality but not that many fps. Plus you could do the compression as slow as you deemed necessary to keep your fps within reasonable range.