Update Automatic tag generation

Moritz Bunkus 2019-02-27 08:00:44 +00:00
parent deeb1335cc
commit 66cc294e29

@ -1,10 +1,6 @@
# What are those tags generated by mkvmerge 7.0.0 and newer? How do I get rid of them?
# Tags containing statistics about tracks
## The problem
There are many tags like `NUMBER_OF_FRAMES` and `BPS` in each output file I create with mkvmerge 7.0.0 or newer. Where do they come from? What are they for? How do I get rid of them?
## The answer
## Problem and solution
The Matroska track headers do not offer fields for statistical data (see also e.g. the FAQ entry about [meta data being lost during muxing](Meta-data-fields-like-bitrate-lost)). As adding new Matroska elements has proven problematic for existing players in the past, it was decided to store such information in tags instead.
@ -12,19 +8,13 @@ Starting with v7.0.0, mkvmerge will automatically calculate a number of statisti
Here's a list of all the tags that are generated, their format and their meaning:
- `NUMBER_OF_BYTES` — the total number of encoded bytes this track consists of before any of Matroska's content encoding schemes (e.g. lossless track compression) is applied.
- `NUMBER_OF_FRAMES` — the number of Matroska blocks present in the track. Note that if you have an interlaced video track, then this number usually contains the number of interlaced fields, not the number of full frames.
- `DURATION` — the total duration for this track. This is calculated as the difference between the highest sum of a track's timecode + its duration and the lowest timecode. Mathematically speaking it's `MAX(timecode[m] + duration[m]) - MIN(timecode[n])` for all indexes `m`, `n`. The format used is `HH:MM:SS.nnnnnnnnn` (`HH` # hours, `MM` minutes, `SS` # seconds, `nnnnnnnnn` nanoseconds).
- `BPS` — the track's bit rate in bits per second. This is simply the `NUMBER_OF_BYTES` multiplied by 8 divided by `DURATION` in seconds.
- `_STATISTICS_WRITING_APP` contains mkvmerge's version information. It can be used to identify which application has created those statistics. If this differs from the segment header field `WRITING_APP`, the tags may be out of date (meaning another app A was used to remux a file that contains valid statistics but A hasn't bothered to update the statistics tags itself). See the section *Determining if the tags are up to date* below for details.
- `_STATISTICS_WRITING_DATE_UTC` contains a timestamp when the statistics tags where created in the format `YYYY-MM-DD HH:MM:SS`. Comparing this to the `date` value in the segment info header allows you to determine whether or not the tags are up to date. See the section *Determining if the tags are up to date* below for details.
- `_STATISTICS_TAGS` is a space-separated list of the statistics tags that have been written by the app referenced by `_STATISTICS_WRITING_APP`. For mkvmerge this tag contains `BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES`.
* `NUMBER_OF_BYTES` — the total number of encoded bytes this track consists of before any of Matroska's content encoding schemes (e.g. lossless track compression) is applied.
* `NUMBER_OF_FRAMES` — the number of Matroska blocks present in the track. Note that if you have an interlaced video track, then this number usually contains the number of interlaced fields, not the number of full frames.
* `DURATION` — the total duration for this track. This is calculated as the difference between the highest sum of a track's timecode + its duration and the lowest timecode. Mathematically speaking it's `MAX(timecode[m] + duration[m]) - MIN(timecode[n])` for all indexes `m`, `n`. The format used is `HH:MM:SS.nnnnnnnnn` (`HH` # hours, `MM` minutes, `SS` # seconds, `nnnnnnnnn` nanoseconds).
* `BPS` — the track's bit rate in bits per second. This is simply the `NUMBER_OF_BYTES` multiplied by 8 divided by `DURATION` in seconds.
* `_STATISTICS_WRITING_APP` contains mkvmerge's version information. It can be used to identify which application has created those statistics. If this differs from the segment header field `WRITING_APP`, the tags may be out of date (meaning another app A was used to remux a file that contains valid statistics but A hasn't bothered to update the statistics tags itself). See the section *Determining if the tags are up to date* below for details.
* `_STATISTICS_WRITING_DATE_UTC` contains a timestamp when the statistics tags where created in the format `YYYY-MM-DD HH:MM:SS`. Comparing this to the `date` value in the segment info header allows you to determine whether or not the tags are up to date. See the section *Determining if the tags are up to date* below for details.
* `_STATISTICS_TAGS` is a space-separated list of the statistics tags that have been written by the app referenced by `_STATISTICS_WRITING_APP`. For mkvmerge this tag contains `BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES`.
Note that if you re-mux a file that already contains these statistical tags, mkvmerge will replace them with updated statistics.