EDIT 2: Did not notice that it was old thread previous poster ressurected
apology for this, but my answer may help others searching for this topic to get on correct path.
First of all by what people write here most do not know basic difference between container and codec. No offence but MKV, AVI and MP4 are all just containers.
They can determine compatibility with players or how many video, audio, subtitles can it hold at same time and some other stuff, but it does not affect quality directly. What determines quality is codec used for encoding of video. Container format may limit which codec you can use. There were older xvid and divx but those are not used anymore. After that you got codecs like mpeg-2 and now more popular mpeg-4 (h.263). Currently most popular is mpeg-4 AVC (h.264). For more info consult appropriate wiki page
.
Here is wiki page with nice table of many containers with their support for codecs, not sure if it's accurate but it looked fine on 1st look.
http/en.wikipedia.org/wiki/Comparison_of_container_formats
So 1st of all you may not need to convert anything. What you want to do actually is called remux of file. That mean you take video with it's original codec from one container and place it into another container. If new container support that format everything will work fine and you won't loose any quality.
Try to google "avi-mux_gui" by description it should do exactly that remuxing of mkv to avi and other way. I did not ever use that software so no guarantee. I got to it by googling "avi remux" and it was 2nd hit.
EDIT: I personally use MKV with h.264 or original codec remuxed to MKV container. For tv i use WD TV Live like poster above and it have np with it. It gained lot of popularity and most of modern devices/programs support it. But I can imagine some applications or devices may not accept MKV so remuxing is best way if codec is supported in AVI and on the device/program.
This is improtant because even if AVI itself may accept codec device/program you want to play it on may not support it.
In that case you would have to convert to other codec. My recommendation would be to use h.264 codec if target device/program accept it (which all modern should). Or classic mpeg-4 for higher compatibility (for example on some portable devices). For encoding to h.264 I use handbreak and for mux/remux of files i use mkv extractor or mkv merge.