0 Understanding mkvinfo's output
Moritz Bunkus edited this page 2019-06-16 22:39:01 +02:00

Understanding mkvinfo's output

The problem

You see that mkvinfo outputs quite a lot of elements, but some are missing. Sometimes whole important sections like the track headers aren't shown either.

Explanation

mkvinfo is mostly a development and anlysis tool. It therefore doesn't work like a regular player would. It reads a file sequentially: from start to finish without seeking. When it finds an element it outputs that element.

mkvinfo does not output elements that are not present in the file. This confuses users who expect to see a "language" element with "eng" as the value because they've set the track's language to "English". However, mkvmerge does not write elements that are set to their default values and therefore they're not present in the file, and mkvinfo doesn't show them.

mkvinfo has two different output modes: the tree mode that is active by default and the summary mode activated with -s (--summary).

Tree mode

This is the default. For each EBML element found in the file a single line is output. The line is indented by the Matroska element's depth inside the Matroska element tree.

As this output can get very long mkvinfo stops when it finds the first cluster by default. This implies that all elements located behind the first cluster aren't output. This applies often to elements like attachments or chapters, but also the index (the "cues" in Matroska terms). It can even apply to the track headers: if tools like MKVToolNix GUI's header editor or mkvpropedit need to write more data to the track headers than space is available at the start of the file (e.g. when you add long track names to a file) then the track headers will be relocated to the end of the file, and a meta index entry will be created at the start pointing to them.

You can tell mkvinfo to continue when it finds the first cluster by adding one -v (--verbose) parameter. The more -v parameters you add the more verbose the output will be after that, including things like element's positions, checksums etc.

There's only one such point where mkvinfo will stop: before the first cluster if no -v is used.

Summary mode

In summary mode mkvinfo's output is meant to be terse. The track headers are condensed into a single line per track. Each frame is reported as a single line, no matter if it's stored in a BlockGroup or a SimpleBlock. Other elements are not output.

Summary mode is useful for comparing file content on a higher level than on an element-per-element level. It can be used for different things:

  • getting an overview of how many frames are in a file
  • quick overview of frame types (I/P/B frames)
  • checking whether or not the frame content of two files equal by applying other Unix tools like grep or diff the mkvinfo's output

Alternative: mkvmerge's identification

If all you need is a quick overview of which tracks, attachments, chapters and tags are present in a file then you should consider using mkvmerge's identification mode. That's what the GUI calls behind the scenes when you add a file, too. As an additional bonus mkvmerge reads a file like a player should: by starting at the beginning and quickly following the meta seek elements in order to find the important elements.

You can invoke the identification mode with mkvmerge --identify yourfile.mkv (shortcut: mkvmerge -i yourfile.mkv) or, for additional properties for each item and output in JSON format, as mkvmerge --identififcation-format json --identify yourfile.mkv (shortcut: mkvmerge -J yourfile.mkv).

Categories: metadata