and the other reason for the mkv container is because it lets to interlace more then 1 audio stream into it.
h264 is a extention of mpg4 (divx/xvid) it was initially designed for low bitrate stuff to get better quality at lower bitrates compared to xvid.
h264 is very cpu intensive and time consuming. So i would suggest using xvid.