Without a doubt are MPEG-4 part 14 and Matroska Video (or as most people know it: MP4 and MKV) the most popular video formats around. When it comes to choosing the appropriate file format for your own video files, a few things have to be considered in order to make a choice between MP4 and MKV.
Let's start with bursting the myth around the assumption that both MP4 and MKV are video compression formats. They are simply not. They are what you call video containers. A video container, as the name implies, contains things a video needs in order to play properly on your tv or pc. They contain items like video codecs, audio codecs and even subtitles. Having them all in one file makes it easier to playback, but also enables the editor to choose methods to reduce file the file size. The editor might choose to reduce the video quality, but improve the audio quality.
MP4 and MKV being containers is important to remember because they might have a .mkv or .mp4 extension, they might have different video extensions for the video media inside the container.
Matroska Video, or MKV, is developed by Mastroska.org as an answer to replace the old AVI video format. The name is similar to that of the Russian 'dolls' called matryoshka. You know, the big doll that each container a smaller matryoshka doll. This is quite fitting, when you consider the fact the MKV is a container format. MKV video formats enable the user to capture endless amounts of video, audio and subtitle formats in one single file.
MKV and WebM files are related. WebM is a restricted version of MKV. The restriction is in the video codecs. WebM only allows the use of VP8 and VP9 codecs. In short, all WebM files are MKV, but not all MKV files are consistent with WebM
MP4 is the probably the better known video format of the two. It is the standard output of many video camera's and smartphones. Although MP4 is, similar to MKV, a container format, it offers a bit more restrictions in terms of encapsulating formats. For instance, MP4 doesn't offer the possibility to embed ASS like MKV does.
So how to MP4 and MKV compare head to head? Check out the table below.
|H.264, H.265, MPEG1, MPEG2, MPEG4 ...
|H.264, H.265, Xvid, MPEG4, ...
|FLAC, ALAC, AC3, AAC, ...
|ALAC, MP3, AAC, ...
|ASS, SSA, ...
|Not ideal for mobile devices.
|Ideal for mobile devices and pc
As has been said above, MKV has been developed to overthrow AVI. MP4, however, is the successor to the popular MPEG-1, MPEG-2 etc and has become the industry standard. Being the industry standard, MP4 has a much greater compatibility with videosoftware and video players. For instance, YouTube practically demands MP4 for uploads. This is the reason Iphones and Androids have chosen MP4 for their players. Third party software might still enable you to play MKV files on your smartphone though.
It's worth noting that MP4 is controlled and patented by MPEG, while MKV is an open-source project. This makes licenses for players, editors and video software a lot easier.
Both containers are similar, and the choice for video format lies in personal preference and usability. There is no clear difference in quality. The difference are less subtle than that. MP4 has broad browser, device and software support and are often smaller in file size compared to MKV. MKV, being open-source software, is much better supported in free software. It also supports practically all codecs and has better subtitle support. If you prefer Google's latest codec VP9, you should go for MKV (or WebM). Do you want broad device support? Go for MP4.
Both file formats support H.264 video codec. This means the quality of the video is similar. The difference are in the usability and functionality of the two container formats.
MKV is designed by Mastroska in order to replace the AVI format. Everything that has been used in creating the MKV format is patented, which means it can be used and distributed without licenses.
MP4 supports different subtitle formats, but not as many as MKV. MKV support ASS formats, whereas MP4 does not.