Does using MKVtoolnix in any way alter or damage the file?

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Post Reply
ben_uk
Posts: 80
Joined: Mon Feb 01, 2021 11:41 am

Does using MKVtoolnix in any way alter or damage the file?

Post by ben_uk »

I’ve been doing a few muxes of old BD / DVD soundtracks / audio commentaries which weren’t carried over / laserdisc audio rips which I’m perfectly fine and happy with however I have this underlying anxiety that I am somehow damaging the video stream or it’s going to cock something up when I try and play it with DV etc. I don’t have any means of playing DV at the moment so I’m just anxious about messing around with MKV files.

Could someone possibly lay my mind to rest?
flojo
Posts: 215
Joined: Thu Jun 22, 2023 4:27 am
Location: El Paso

Re: Does using MKVtoolnix in any way alter or damage the file?

Post by flojo »

The only thing to watch for is that the file is written correctly. It has been reported that MKVtoolnox has had a few problems in the past with either file writing or reading certain streams correctly. I've experienced this with a couple Dolby Vision web files (Ted Lasso and Bad Monkey).

I'd argue that unless you're going to watch it immediately, don't touch it. That said, if you can use a method to hash the video in the source file and newly written file, have at it. You surely can read a steam with ffmpeg and pipe it to a hasher, I'm just not sure if you can do this dependably with HDR/DV streams or if meta data can complicate things.
flojo
Posts: 215
Joined: Thu Jun 22, 2023 4:27 am
Location: El Paso

Re: Does using MKVtoolnix in any way alter or damage the file?

Post by flojo »

FWIW, I tried comparing plain h265 streams using mkvmerge and mkvextract and I did get a match after remuxing the video in mkvtoolnix missing 1 subtitle (the source file has 2), I also got a match with a Dolby Vision video stream. Mkvextract can't write to stdout, so if you use these 2 tools expect to create 2 temporary video files for comparison... so 300GB? :-/

Code: Select all

test@test:~/test$ mkvmerge -i source.mkv
File 'source.mkv': container: Matroska
Track ID 0: video (HEVC/H.265/MPEG-H)
Track ID 1: audio (AAC)
Track ID 2: subtitles (SubRip/SRT)
Track ID 3: subtitles (SubRip/SRT)

test@test:~/test$ mkvextract "source.mkv" tracks 0:source.raw --raw
Extracting track 0 with the CodecID 'V_MPEGH/ISO/HEVC' to the file 'source.raw'. Container format: HEVC/H.265 elementary stream
Progress: 100%

### Used mkvtoolnix gui here to create "out.mkv"

test@test:~/test$ mkvmerge -i out.mkv
File 'out.mkv': container: Matroska
Track ID 0: video (HEVC/H.265/MPEG-H)
Track ID 1: audio (AAC)
Track ID 2: subtitles (SubRip/SRT)

test@test:~/test$ mkvextract "out.mkv" tracks 0:out.raw --raw
Extracting track 0 with the CodecID 'V_MPEGH/ISO/HEVC' to the file 'out.raw'. Container format: HEVC/H.265 elementary stream
Progress: 100%

test@test:~/test$ ./rhash --sha256 source.raw out.raw
d4943c4d7db3b82ee726ee48a4f13ccb76b747a1b8f7dadaa97244ccb32fc2a6  source.raw
d4943c4d7db3b82ee726ee48a4f13ccb76b747a1b8f7dadaa97244ccb32fc2a6  out.raw

##
## Now I tried with a .mkv that has DV.
##

test@test:~/test$ mediainfo source_dv* | grep -i hdr
HDR format                               : Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible

test@test:~/test$ mkvmerge -i source_dv*
File 'source_dv.mkv': container: Matroska
Track ID 0: video (HEVC/H.265/MPEG-H)
Track ID 1: audio (E-AC-3)
Track ID 2: subtitles (SubRip/SRT)
Track ID 3: subtitles (SubRip/SRT)
Track ID 4: subtitles (SubRip/SRT)
Track ID 5: subtitles (SubRip/SRT)
Chapters: 4 entries

### Used mkvtoolnix to add a video stream, 1 subtitle and audio.

test@test:~/test$ mkvmerge -i ddd.mkv
File 'ddd.mkv': container: Matroska
Track ID 0: video (HEVC/H.265/MPEG-H)
Track ID 1: video (HEVC/H.265/MPEG-H)
Track ID 2: audio (E-AC-3)
Track ID 3: audio (AAC)
Track ID 4: subtitles (SubRip/SRT)
Track ID 5: subtitles (SubRip/SRT)
Track ID 6: subtitles (SubRip/SRT)
Track ID 7: subtitles (SubRip/SRT)
Track ID 8: subtitles (SubRip/SRT)
Chapters: 4 entries

test@test:~/test$ mkvextract "source_multi.mkv" tracks 0:source_multi.raw --raw
Extracting track 0 with the CodecID 'V_MPEGH/ISO/HEVC' to the file 'source_multi.raw'. Container format: HEVC/H.265 elementary stream
Progress: 100%

test@test:~/test$ ./rhash --sha256 source_dv.raw source_multi.raw
659cdffc37b4052b579cceba286fec2e8f6b0b8c75186c44d229f9db9b20e3f6  source_dv.raw
659cdffc37b4052b579cceba286fec2e8f6b0b8c75186c44d229f9db9b20e3f6  source_multi.raw

Post Reply