4 mkvinfo track summary
Moritz Bunkus edited this page 2019-06-16 22:39:01 +02:00

mkvinfo outputs too much information or not enough information (e.g. no track information)

The problem

Two distinct problems with the same answer:

  1. mkvinfo outputs too much information. I only need a concise listing of the tracks in a file.
  2. mkvinfo does not output any track information.

The background

Skip to the answer if you're only interested in the how but not in the why.

A Matroska file has a pretty flexible layout. There are several level 1 elements like clusters, chapters, tags and the track information. The order of those elements is not fixed. In order to make it easy for a player to find those elements they must be listed in an index; in Matroska terms that index is called the meta seek element.

For example, the chapters can be located at the end of the file. As long as there's a meta seek element at the beginning of the file pointing to those chapters a player can find them quickly without having to read the whole file. The same applies to track headers (e.g. those might be re-located to the end by applications like mkvpropedit or MKVToolNix GUI's header editor if they don't have enough space at the beginning of the file to fit the changed headers into).

See All tracks vanished after mkvpropedit or header editor for a more in-depth explanation.

mkvinfo is a development tool. Its purpose is to read a file from beginning to the end and to report the elements the moment they've been read. As this information can be overwhelming mkvinfo stops as soon as the first cluster is encountered by default.

Taken together this means that mkvinfo will not find and output the track headers if they're located at the end of the file.

The answer

mkvmerge contains an identification mode whose output is supposed to be readable by both a human and a machine: one line per track, very compact output format. On top of that mkvmerge reads a file like player does (following the meta seek elements) and can therefore find the track headers wherever they are. It can output that information for all the file types it supports as input formats, not just for Matroska files.

For a quick summary use mkvmerge --identify yourfile.mkv. For even more details such as track languages, file titles etc. you can also use mkvmerge --identify-verbose yourfile.mkv. Please note that the output is escaped in a specific way.

Categories: metadata