Best codec for stuffing stuff to YouTube is h.264, since that's the format used natively. This results in a much higher quality, since no recompression takes place.
I usually record using the built-in FRAPS codec (which is lossless) and then recompress to MP3 (via lame) and h.264 (via x264, but that's just personal preference). My tool of choice for doing this sort of work is VirtualDub, but it's a powerhouse, so its learning curve is quite steep.