Not the most recommended way. Recommended way is to use one of the encoders which encode to mp4 container directly,e.g. megui, automkv etc. If you are familiar with AUTOGK, you may find AUTOMKV easy to use. Since most people here are familiar with virtualdub,the following may be useful.

Tools needed
Virtualdub
x264 vfw codec
download the installer and the guide
and
YAMB

Install the x264 vfw codec and YAMB
Use virtualdub as usual to convert to avi. In the x264 codec select single pass
quantizer mode and quantizer between 24(higher quality) to 28(lower quality).
Encode audio to mp3.

Say your avi is xxx.avi. Open YAMB. Select the extract tab. Load xxx.avi. First extract the video from the avi. Next extract the audio from xxx.avi. Next select the mux tab and add the extracted video and audio files. Mux!

Tips
1. If you already have ffdshow codec, uninstall it. You can find out by using Add or remove programs in control panel.
2.Download the standard vfw installer and install.
3.Read the AVC VFW guide at the site. It has tips on tweaking the codec. You can reduce file size by tweaking the codec at the cost of increasing encoding time. x264 encoding is slow to begin with. If you use single pass quantizer mode, your quality will not be affected while you learn to tweak the codec.
4.As the video codec is not too compatible with the avi container, it is recommended to extract the video and the audio and mux it to mp4.
5.xxx.avi can be edited for removing unwanted portions etc as usual.
6.You can use all your familiar virtualdub filters while encoding the avi.