Remux Videos for iTunes Playability?
I have been fighting this issue myself, with some success - but mostly, I have reverted to getting more of my collection in MP4 in the first place.

Subler is a must have to begin. It effortlessly does remuxing of MKV to MP4, including soft subtitles and iTunes Metadata. So for most MKVs, it is a breeze to get them into iTunes in a tidy manner.

When it comes to AVI and other formats, it's a bit trickier. AVI tend to be used with video codecs such as DivX or XviD, and although they could be remuxed into an MP4 container, it seems iTunes will not read it.

If you wanna play around with remuxing, your best bet is ffmpeg. You will need to compile it yourself or Google for binaries.

I'd advice you to convert your MKVs using Subler, and to re-rip/re-download the AVIs in a newer format where possible. What is left you can transcode using Handbrake.