We might as well split the question to , a tool and a codec ( or lets say you care about audio too then 'codecs' ).
Since many tools, editing software use the codes you have installed it's usually an out of a box thing if you have a codec pack installed since you already have what you need.
The reason for that is that many free codecs come with encoders out of the box ( Xvid for example ) but non-free codecs don't ( DivX decoder is free, the encoder is not ).
I think the best package out there is FFMpeg, regardless of it's name it includes several codecs and not just MPEG, a downside of it is that it only comes with a command line tool that takes ages to learn how to use.
Then comes the tool you use,
as mentioned already , VirtualDub is a great tool, it's not an editing software, it's more like an advanced encoder. Like I said above FFMpeg is a bit complicated to use but there are tons of tools for it so those things are just GUIs for FFMpeg itself a good example is WinFF it's just an encoder/decoder GUI that supports tons of formats, with different containers ( MP4, AVI, MKV just to name some ) it also comes with predefined profiles, which is good but again if you want to set it up yourself it's a pain in the a** since you have to figure out the commands for it. And lastly there are the mentioned apps like Sony Vegas, costs money but it's worth it if you can afford it, a little easier to set up, but still you have to know how to setup a video encoder to get exactly what you want.
And lastly, you may want to use some audio codecs, but again you may already have ones that are perfectly suitable for you, installed on your PC.
Our advice is that you should get WinFF ( completely free app ) and look for a suitable settings ( MPEG-4 - H.264 Video would be a good choice ).