TMPGenc is widely considered the best MPEG2 encoder. Use Flask for going MPEG2->MPEG4. Use virtual Dub for AVI, DivX, OpenDivX, etc.
AVI is simply a container file, you can place any kind of video/audio stream you want in it. DivX and OpenDivX happen to use AVI as their container file format.