I have found that this program really works well for encoding AVI files to ffmpeg or H.264 files for the internet.
Previously, I have tried other ways of getting video to work seamlessly, and it hasn't worked to my satisfaction.
I now put avi's through Handbrake, into ffmpeg (web optimized), and the quality is acceptable, and the files run smoothly on YouTube.
Here is where to get it.
http://handbrake.fr/downloads.php
FYI...