I've tried most of the guides and programs to convert those mkv with h264+aac and rmvb, but nothing worked for me. I wanted to convert those files to avi to be played on a standalone player.
Since I've been using the KMPlayer for playing all video files, except DVDs, I've noticed that option in the menu: Capture>Capture as Video File.
Using this option I converted mkv (h264+aac) and rmvb files to avi (XVID+mp3) with no effort at all. It would probably convert any other video or audio format, as well.
I just opened a video file with KMPlayer and selected audio (if there are more than one) then I went to Capture>Capture as Video File.
A window pops out, where it is possible to choose various options. When you look there, it is, more or less self-explanatory.

This is what I choose:

Video>Encode Video Stream
Input>RGB24
Encoder>(I left the default "Internal... - which appears to be XVID) and set the quality to 90-95%

Audio>Encode Audio Stream
I left the default mp3.

Click start and then start a playback.

The quality of resulted video is very close to source video (appears to me).
The resulted file is approx. 700MB/hour, but it would vary with variable options.
It is also possible to encode only a video or audio separately.

A conversion is in real time, so a playback has to be started, and a conversion ends when a playback reaches the end of a video file. Such a conversion does not use a lot of PC resources.

The resulted avi (XVID) plays nicely on a standalone player.