4 Creating byte identical files
Moritz Bunkus edited this page 2021-07-05 13:01:52 +00:00

Is it possible to create byte-identical files if the source files and the mux settings are identical?

The problem

Use cases could include muxing on different computers that already have copies of the source files without having to upload the resulting file itself.

The answer

Technically, it is possible, but mkvmerge does not do this by default. There are several elements in a Matroska file that differ with each muxing, even if everything else is the same between different mux runs. These include but are not limited to the muxing date (DateUTC) and all unique IDs (track UIDs, attachment UIDs, segment UIDs, chapter UIDs etc etc).

If you use different builds of MKVToolNix then you'll also have the WritingApp differ as it contains mkvmerge's version number and build timestamp. This may be the case e.g. if you want to mux on two different machines. Additionally different versions of MKVToolNix and the libraries used support different elements and may make choices about how to layout everything differently.

All that being said, there is a command line option that allows the creation of byte-identical files under certain circumstances: --deterministic <seed> Please see its documentation for details.

There is a possible alternative if you're willing to run other software directly after the muxing process. What most people do if they want to have byte-identical files is mux the two files with identical settings and then use a file synchronization tool for copying only the differences between the two files. This is a pretty fast process as the amount of bytes the two resulting files differ by is very small.

There are several OpenSource programs that are suited perfectly for this job. On Linux/Unix/macOS people usually use rsync. On Windows people usually use a native port of rsync called DeltaCopy. Another alternative for both operating systems is Unison.

Categories: merging