Log in

View Full Version : What is mkvtoolnix doing?


hwh
19th April 2023, 12:48
Hi, sorry if this is a stupid question, but I am sure people here know.

I have some MKVs created by OBS. For some reason I picked up this software a couple of years ago, maybe to have a look at some issue with an MKV I had. I noticed it generated a much smaller file than the source.

In other words I "multiplexed" an MKV file with nothing to create an identical MKV file that is like 50MB smaller. I don't know why. And since it's meant to be lossless and acceptable for editors and uploading and so on, I don't want to do something weird to the file to make it unusable.

I also experimented with a very similar file which was remuxed to MP4. Running this MP4 through mkvtoolnix again yields a file about 50MB smaller. I can't find anything wrong with these smaller files but I am suspicious and don't really want my files in MKV anyway. I just don't see why the MKV -> MKV process does anything.

If I remux the MKV mkvtoolnix made back to MP4, it only gains 3MB. So, I just want to know what the hell it's doing to my files that isn't video related. Apparently some kind of bloat is being removed. But is it innocuous?

Asmodian
21st April 2023, 15:13
Apparently some kind of bloat is being removed.

Exactly.

But is it innocuous?

Yes, it is removing (or not re-adding) redundant metadata type information. Nothing important for playback is lost.

Edit:MKV was designed to be efficient, I like how simple and functional it is compared to other file formats.

huhn
22nd April 2023, 01:23
mkv has lossless compression build in just like a "zip".
this can result in massive file size difference between mp4 and the much more superior mkv container.

this is an optional feature so you can also disable it.
if obs doesn't use it that would be it.
this is similarly powerful as a lossless codec on LPCM audio.

Asmodian
22nd April 2023, 22:20
mkv has lossless compression build in just like a "zip".

Isn't that only used for subtitles?

nevcairiel
22nd April 2023, 23:44
Isn't that only used for subtitles?

Usually, yes. You technically can apply it to everything, but its pointless. Compressed streams do not benefit from it.

And its also rather generic zlib or bz2 compression (both are options). For the example on lossless PCM audio - any FLAC stream is going to be significantly smaller, because FLAC knows what audio is and how to compress it, rather then just trying to compress the bytes.

hwh
26th April 2023, 09:51
Ok guys, thanks.

I still don't get it. Deleting all keyframes? It's kind of a minor thing (the file size difference) but smaller files are easier to work with, so I will probably run them through mkvtoolnix as a final step.

I don't really know what the program is for, some kind of splitting, appending and metadata editor. Like whaaa?

Asmodian
26th April 2023, 20:19
It is definitely not deleting all the keyframes! (?!)

The program is for muxing video+audio+subtitles+chapters into Matroska files. What do you mean by "for" if not that?

hwh
30th April 2023, 02:04
It is definitely not deleting all the keyframes! (?!)

The program is for muxing video+audio+subtitles+chapters into Matroska files. What do you mean by "for" if not that?

Ok, I didn't know. Even within different MKVs there apparently can be a lot of invisible overhead.