Matroska

From CCCP
Jump to: navigation, search

Matroska is an advanced, open-source, and expansible container that is still under development. It can contain virtually any sort of video, audio, or subtitle track. Matroska Video and Matroska Audio are the two variants, with the latter having little popularity until now. The files will nearly always have an extension .mkv (matroska video) or .mka (matroska audio).

Advantages

  • Supports practically every kind of video, audio, or subtitle track.
    • In particular, AVI does not support H.264 video or Vorbis audio properly, you can put them in, but expect huge files / incompatibilities / weirdness.
  • Low overhead.
    • A Matroska containing exactly the same data as an AVI will be smaller and faster than it. Keep this in mind - Matroska is smaller and faster. It's better for older computers. (Certainly, the difference - especially in speed - is practically irrelevant. But insofar as there is a difference, matroska is faster. So next time someone says mkv is slower, you can (and should) flame them (CCCP staff do not in any way endorse flaming, unless: a) There is no other choice, b) You have made a bona-fide attempt to reason with them already, c) you really really want to).)
  • Supports anamorphic video.
    • AVI can do it if it's encoded directly into the video bitstream, but only if the codec supports it. It's generally considered a bad thing to do, and won't play back correctly on most places.
    • Why anamorphic? Anamorphic allows you to retain the most quality in the video with the least space by avoiding a resize. When you have a widescreen DVD, it's 704x480, anamorphised to 16:9. You can either leave it anamorphic and achieve the best quality, or you can upsize it, making file huge and losing some quality, or you can downsize it, losing large amounts of detail.
  • Supports Variable Frame Rate video.
    • Variable Frame Rate is the ONLY solution to solve hybrid anime that has 23.976 mixed with 29.97 content. AVI doesn't support VFR at all, but it allows you to do a hack to emulate it, by making the video 120 FPS, full of NULL frames. However, this incurs in a huge overhead, making the file much larger than it needs to be.
    • Variable Frame Rate is NOT only for DVDs!! Most fansubs could benefit from it. About half of the animes around are actually VFR, and would look better with proper support for it. What some fansubbers do is simply kill the 29.97 sections, making them 23.976, which makes them all jerky - probably without even realising they're doing so.
  • High error recovery.
    • Seeking a corrupt AVI is a nightmare. Matroska has far better error resilience.
  • Allows files (such as fonts or even a/v codecs) to be attached to the video file.
    • This is particularly relevant for ASS softsubs: without this, you need to make the user download and install fonts separately. Softsubs are important because they let the user switch or disable them, for multiple languages, and because they look much better than hardsubs.
    • Many people argue that softsubs can be stolen, but they often overlook the fact that stealing hardsubs with an OCR (optical character recognition) program is very easy. Point being: if someone wants to steal your subs, they WILL, whether they're soft or hard.
  • Supports DVD-style chapters.
    • An often overlooked feature - Matroska lets you setup chapters, then you can just press the appropriate key (e.g. Page Down) to skip a chapter. So if an anime has a really annoying opening, just hit the "Next Chapter" key, and you're right at the starting point. It really is that easy.
    • Ordered chapters also exist, where you can split a movie across multiple files and have it seek normally. An interesting application of this would be thus: Instead of encoding the OP and ED for every ep of a series, you would instead encode them once as separate files and then use ordered chapters to seamlessly integrate them into the correct part of each episode. Very cool.
  • Future support for DVD-style menus.
  • Extensively documented (unlike other formats, such as OGM).

Disadvantages

  • Lack of support in most embedded devices.
  • No handler for it comes with Windows itself either, you need to install the Haali Media Splitter (included in CCCP) for DirectShow playback support.

CPU usage comparison

TideLineBlueOP-MKV-vs-AVI.png

This image was taken from ^danshi^'s post on this AnimeSuki thread.

His comments:

TideLineBlueOP-MKV-vs-AVI.png

I saved the opening from Hiro's TLB in VirtualDubMod as both AVI and MKV, shut down all programs running in the background and played the files with exactly the same settings in MPC using ffdshow and Haali splitter on my 2 GHz PC.

If your video is jerking or lagging behind the sound, the more probable causes are

  • Very high resolutions (like HDTV).
  • Softsubs, especially with subtitle effects.
  • H.264 video codec (to a lesser extent, also WMV9).
  • Misconfigurations or disadvantageous playback software.
  • Your slow CPU.
  • Shit running in the background or things that go beyond my comprehension.

Why the switch from AVI?

Recently, many groups have used AVI and OGM less in favor of Matroska Video, with the notable exception of fansubs. The main reason behind this is that only Matroska supports two features that play an important role in video quality: anamorphism and Variable Frame Rate. Matroska is also generally considered to be superior to the other containers in every aspect.

Matroska splitters

There are currently three main Matroska DirectShow filters, that can be used to parse a mkv file. These are called "splitters":

Manipulation tools

  • MKVToolnix: A package that allows you to mux Matroska files, extract tracks from existing files and perform many other operations.
  • VirtualDubMod: A variation of VirtualDub that includes OGM and MKV support. (Not Recommended/Obsolete)