mkvmerge attachments switch does not work as intended
I am trying to write a batch file to process MKVs in which I want to remove a specific font that is already present and then remux with a new script and font attachment. A simplified version to illustrate my problem looks like this:
for %%A in (*.mkv) do (
mkvmerge.exe -o %%~nAd.mkv -S -T --no-global-tags -m !4 %%~nA.mkv ^
--language 0:eng --default-track-flag 0:1 %%~nA.ass ^
--attachment-mime-type font/otf --attach-file KozMinProStrippedV3-Heavy.otf
)
In this example, the font I want to remove is Attachment ID 4 according to the --identify
switch.
per the mkvmerge documentation:
-m, --attachments [!]n[:all|first],m[:all|first],...
Copy the attachments with the IDs n, m etc to all or only the first output file. Each ID can be followed by either ':all' (which is the default if neither is entered) or ':first'. If splitting is active then those attachments whose IDs are specified with ':all' are copied to all of the resulting output files while the others are only copied into the first output file. If splitting is not active then both variants have the same effect.
The default is to copy all attachments to all output files.
If the IDs are prefixed with ! then the meaning is reversed: copy everything but the IDs listed after the !.
If I'm understanding this correctly, I should be able to copy all attachments except ID 4 if I prefix it with an exclamation mark !
.
However, it does not work as intended. Instead, all existing attachments are removed, the same effect as using -M, --no-attachments
, and only my 1 added font is present in the resulting files.
-m, --attachments
still works correctly without an exclamation mark, in which it only copies the attachments with the given IDs.
Am I misunderstanding, or is this a bug? I tested this with 3 different MKV and got the same result for all of them. It should easily replicable with any MVK that has multiple attachments.
mkvmerge v71.1.0