Camstudio is what I use for desktop capture, but it's far too processor intensive for any sort of real-time game capture.
I'd highly recommend either FRAPS (it's $20 and extremely useful) or having a second system that take the output of the one running the game.
[edit]
Oh as far as Codecs go, currently WMV (Series 9-HD) and MOV (Quicktime Intel .268) are the best if you want everyone to be able to see the output.
Sizewise however I tend to use Xvid as it compressed extremely small with very little overall quality loss, especially when used with the DivX 6.x Codecs.