PDA

View Full Version : Check the integrity of mkv-files?


jDDk
10th March 2012, 01:03
I've had a bad RAID controller, and some of my MKV files have been damaged - problem is, i don't know which, i just know there's some. I have 1000+ files, so checking them one by one will take a long time.

The issues I'm noticing, are:
- Video glitches (colors getting messed up and picture not 'updating')
- Playback stops (i.e. stops in the middle of playback)
- Duration is messed up (i.e.: supposed to be 1h30m, but is only 20m)

So I need some way to scan them all for errors.
I've tried:
- VideoInspector (says everything is ok - which it isn't)
- mkvverify (error report is odd - doesn't make much sense)
- MatroskaDiag (output is way too big, and only for one file at the time)
- Meteorite (doesn't have an error report feature, it just tries to fix files)


So i thought "if anyone can help me, it gotta be doom9" - i don't know any other forum with a knowledge base as big as here :) I hope someone can assist me with this issue!

Thanks in advance!

mbcd
10th March 2012, 16:03
Had same Problem.

The only way I found out, is to demux or remux them.

I did batch remuxing and saved the logs for each file.
Then I attached them and looked towards word "error".

So I found out which files had errors and I deleted them.

setarip_old
10th March 2012, 19:34
@mbcd

Hi!

And what program(s) did you use to accomplish this?

jDDk
10th March 2012, 20:41
Had same Problem.

The only way I found out, is to demux or remux them.

I did batch remuxing and saved the logs for each file.
Then I attached them and looked towards word "error".

So I found out which files had errors and I deleted them.

Then i would have to remux ~6TB - thats gonna take a loooong time + i have no where to store that much again.

HWK
11th March 2012, 01:59
Try doing in chunks and see if it works out for you.

jDDk
11th March 2012, 11:46
Try doing in chunks and see if it works out for you.

It would still be 6TB i would have to go through - it will take quite a while. Its faster to just play every movie and jump through it.

mbcd
11th March 2012, 14:19
Id had 6TB too, took about 3 Days, but now I have no damaged files anymore.

Best to do with is mkvmerge, simply load mkv in and let remux it, save output to txt-file and youre done after some days.

Come on ... whats if you play only up to minute 45 and damage begings at minute 46 ? Playing chunks doesnt help ANYTHING.

If doing batch is to much work for you, you can still let it as it is, other methods wont bring you a result, maybee you find 13 damaged files with it, but all other 400 files you wont.

Ghitulescu
11th March 2012, 14:58
Good for you that you have the originals, in case these disasters happen :) ....

jDDk
11th March 2012, 15:52
Id had 6TB too, took about 3 Days, but now I have no damaged files anymore.

Best to do with is mkvmerge, simply load mkv in and let remux it, save output to txt-file and youre done after some days.

Come on ... whats if you play only up to minute 45 and damage begings at minute 46 ? Playing chunks doesnt help ANYTHING.

If doing batch is to much work for you, you can still let it as it is, other methods wont bring you a result, maybee you find 13 damaged files with it, but all other 400 files you wont.

I guess it would be possible to just write a batch-script for mkvmerge. When done muxing it would just delete the file again and save the log - then i wouldn't have any space issues.
But would mkvmerge report any errors if there are glitches in the video? I'm not sure if I have any files with just glitches to test with. I did have one file with major issues, and it produced this error with mkvmerge:
"Warning: DTS_Header problem: invalid core sampling frequency"

Problem now, is that in a few seconds it produced 12.000 lines of errors. That's gonna be a MAJOR log by the time it's done - imagine after a few files like this one.



Ghitulescu, thanks for the completely useless post. I know I'm new here and i seek help, but your post is useless. It serves no purpose, at all. I know what you're trying to say, and you failed. Whether i have the originals or not, or if I'm an astronaut, is irrelevant to this thread.

Ghitulescu
11th March 2012, 17:00
Well, RAID is supposed to provide redundancy for such cases (well, some people prefer to drop redundancy in favor of speed), and since no apparatus or company I know provides MKVs, then you should have the originals for your movies ;). It's not completely irrelevant if you don't have the originals...

sneaker_ger
11th March 2012, 18:01
I don't know if mkvmerge can find all bitstream errors. Unfortunately, it does not use the CRC feature. So I assume that remuxing with mkvmerge is not reliable. Maybe it is not possible at all?

If you want to do it anyways, you may be able to batch it:
for %%a in (*.mkv) do (
mkvmerge -o NUL "%%a"
if errorlevel 1 echo %%a >> broken_files.txt
)

jDDk
11th March 2012, 18:19
I don't know if mkvmerge can find all bitstream errors. Unfortunately, it does not use the CRC feature. So I assume that remuxing with mkvmerge is not reliable. Maybe it is not possible at all?

If you want to do it anyways, you may be able to batch it:
for %%a in (*.mkv) do (
mkvmerge -o NUL "%%a"
if errorlevel 1 echo %%a >> broken_files.txt
)

Thanks a lot! Is it possible to make it look into all sub-folders as well? All my files are in nested folders.

sneaker_ger
11th March 2012, 22:18
http://ss64.com/nt/for_r.html

Krawhitham
20th January 2013, 02:12
I don't know if mkvmerge can find all bitstream errors. Unfortunately, it does not use the CRC feature. So I assume that remuxing with mkvmerge is not reliable. Maybe it is not possible at all?

If you want to do it anyways, you may be able to batch it:
for %%a in (*.mkv) do (
mkvmerge -o NUL "%%a"
if errorlevel 1 echo %%a >> broken_files.txt
)

That does not work

I have a file that shows this
'XXXXX-bad.mkv': Using the demultiplexer for the format 'Matroska'.
'XXXXX-bad.mkv' track 0: Using the output module for the format 'AVC/h.264'.
'XXXXX-bad.mkv' track 1: Using the output module for the format 'AC3'.
The file 'NUL' has been opened for writing.
XXXXX-bad.mkv: Error in the Matroska file structure at position 70001026. Resyncing to the next level 1 element.
Resyncing successful at position 71003680.
XXXXX-bad.mkv: Error in the Matroska file structure at position 78678950. Resyncing to the next level 1 element.
Resyncing successful at position 80181008.
XXXXX-bad.mkv: Error in the Matroska file structure at position 107067612. Resyncing to the next level 1 element.
Resyncing successful at position 109136017.
XXXXX-bad.mkv: Error in the Matroska file structure at position 171428941. Resyncing to the next level 1 element.
Resyncing successful at position 175712236.
XXXXX-bad.mkv: Error in the Matroska file structure at position 217548164. Resyncing to the next level 1 element.
Resyncing successful at position 219059554.
XXXXX-bad.mkv: Error in the Matroska file structure at position 295203438. Resyncing to the next level 1 element.
Resyncing successful at position 296277364.
XXXXX-bad.mkv: Error in the Matroska file structure at position 637792027. Resyncing to the next level 1 element.
Resyncing successful at position 639060632.
XXXXX-bad.mkv: Error in the Matroska file structure at position 736324625. Resyncing to the next level 1 element.
Resyncing successful at position 737849650.
XXXXX-bad.mkv: Error in the Matroska file structure at position 784915793. Resyncing to the next level 1 element.
Resyncing successful at position 786362111.
XXXXX-bad.mkv: Error in the Matroska file structure at position 935896384. Resyncing to the next level 1 element.
Resyncing successful at position 937176498.
XXXXX-bad.mkv: Error in the Matroska file structure at position 987922278. Resyncing to the next level 1 element.
Resyncing successful at position 988809802.
XXXXX-bad.mkv: Error in the Matroska file structure at position 994122815. Resyncing to the next level 1 element.
Resyncing successful at position 996298566.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1002315871. Resyncing to the next level 1 element.
Resyncing successful at position 1003273628.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1128334904. Resyncing to the next level 1 element.
Resyncing successful at position 1130311786.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1139831173. Resyncing to the next level 1 element.
Resyncing successful at position 1140883965.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1145126448. Resyncing to the next level 1 element.
Resyncing successful at position 1146178002.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1192560871. Resyncing to the next level 1 element.
Resyncing successful at position 1193373134.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1313043655. Resyncing to the next level 1 element.
Resyncing successful at position 1314564712.
XXXXX-bad.mkv: Error in the Matroska file structure at position 1385415284. Resyncing to the next level 1 element.
Resyncing successful at position 1386397645.
Progress: 100%
The cue entries (the index) are being written...
Muxing took 8 seconds.

But mvkmerge ends with an errorlevel of 0

chainring
20th January 2013, 06:36
Not that I have an answer to your problem, but this really highlights the need to have an md5 or SHA-1 signature for all of your files that would take any amount of time to scan for errors, replace, verify, etc... And please don't take this as a "You should have had hashes of your files!", rather me thinking out loud and realizing it's a good practice to take up.

I only have 1.2TB in movies and I dread the prospect of checking, so I can't imagine what it would be like to go through 6TB...manually. Ouch!

electronicsguy
29th January 2017, 15:05
An update which may help others. If your mkv has missing frame-rate info, mkvmerge may not detect it. However, your TV may not play it (like my Sony Bravia). Snowknight26's answer here helps in correctly detecting this: https://hardforum.com/threads/test-corrupt-mkvs.1640664/. It uses the tool eac3to to check integrity of the mkv file.

If there is an error, just remux it using mkvtoolnix-gui and most of the times the error will go away. If it still doesn't you'll probably have to use handbrake, re-encode and see.