If this is for a mobile device, then there has to be some down-sampling of video quality (particularly resolution) and audio quality since mobiles can't handle original format quality files (slower CPUs, less memory than a computer).
Spb makes a decent program that converts to mobile format (I'm assuming you're using Windows and not a Mac to do this). It's not free though, so you would have to trial it or buy it.
On the Mac, Handbrake plus Visual Hub or iSquint are the way to go (Visual Hub is discontinued but you should be able to find iSquint on Mac download sites since it was a free app). Handbrake is also free.