Created Creating byte identical files (markdown)

Moritz Bunkus 2015-02-07 18:17:03 +01:00
parent fa64136863
commit d320b073fd

@ -0,0 +1,19 @@
# 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 allow this in an easy way. There are several [elements in a Matroska file](http://www.matroska.org/technical/specs/index.html) 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.
mkvmerge knows a switch that will use fixed values for all of the elements listed above. However, files created this way have serious issues: they violate the Matroska specifications, may cause problems during playback (especially with advanced features like segment linking, ordered chapters etc) and are not future-proof. The only reason this switch exists in the first place is that it is used for regression testing during mkvmerge's development. For this reason I will not name the switch here.
There is a solution 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/Mac people usually use [rsync](http://de.wikipedia.org/wiki/Rsync). On Windows people usually use a native port of rsync called [DeltaCopy](http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp). Another alternative for both operating systems is [Unison](http://www.cis.upenn.edu/~bcpierce/unison/).
Categories: [merging](Category-merging)