For capturing via an emulator:
SCFH DSF for the video bits, and StereoMix or What-U-Hear (depends on what audio drivers/chip you're using) for recording the audio. Most Realtek audio chips as well as Creative Labs products offer these features (though getting them enabled in Windows 7 is sometimes a pain; look on Google, Microsoft's UI isn't intuitive for enabling the StereoMix stuff).
Regarding audio recording: I DO NOT recommend things like
Virtual Audio Cable because the latency induced by this software is atrocious (read the page and you'll understand). Instead just use your audio drivers to capture the audio that goes out your speakers (no need for a physical loopback cable -- that's a pain in the ass anyway and highly error-prone).
For encoding, I use XviD for video, and
LAME ACM for audio.
The reason I use XviD rather than a custom video codec: if you plan on releasing these videos using that codec, people are going to have to download the codec and install it (which folks like me will refuse to do based on the premise that I don't want to deal with even more bullshit installed on my PC), and deal with the 32-bit vs. 64-bit ordeal (some codecs only come in one flavour, while people's OSes vary). Youtube's decompressor back-end (in case you ever upload the videos to Youtube) also understand XviD, while it probably won't understand some custom weird codec.
The reason I use LAME ACM for audio: the stock MP3 codec in Windows XP doesn't provide a lot of granularity.
I do the encoding in VirtualDub.
One thing to keep in mind: if you record your audio source at, say, 44kHz 16-bit,
keep that sampling rate and bit depth in your final result. Do not re-encode to 22kHz or other things; stick with the original settings. Also only use CBR for the audio bits (if you use MP3), do not use VBR. I cannot stress these two points enough. The end result otherwise will be a video that gradually over time loses audio/video synchronisation. You won't see it in the first few minutes, but if you plan on uploading a 30 minute video, I can assure you that you'll run into this problem. And I KNOW everyone has seen such videos and how fucking annoying they are (nobody these days "proofreads" their work!). VirtualDub has some features/bits in it to try and minimise this, but they don't solve the problem. Doing what I describe in this paragraph absolutely solves it. Audio doesn't make up the majority of an encoded video/audio file anyway, so don't mess about with it.