I'm using VirtualDub and the K-Lite codec pack.
It is up to you which avi codec and which bitrate you use. Divx is the best but Xvid is pretty good too.
Btw, playing device is also important. I mean I watch the same divx on my lcd and my monitor and the TV epic beats the visual quality due to 100hZ refreshing.
If it is for a mobile device like phone or something, I suggest 3gp. Low detail but so will be the screen that you wont notice it. And size drops like 70% or so (a 650 mb movie becomes 120 or so)