12

Just downloaded a big mkv file which is more than 20GB. It took me several days to finish the downloading. But, how to check whether the download has been completed, or it was just aborted halfway? I have this question, because for a mkv file, mplayer can still play it until the point it is broken.

Any utility in ubuntu for such kind of checks?

Qiang Xu
  • 257
  • 2
  • 3
  • 7
  • 2
    Do you have a hash or checksum (i.e. MD5/SHA1/CRC32/etc) of the MKV file in question? If you have, you can use the corresponding `md5sum`/`sha1sum`/`crc32`/etc to see if the hash or checksum match. – Yong Jie Wong Nov 15 '13 at 18:52
  • @yjwong: Alas, I don't have such info, :-( – Qiang Xu Nov 15 '13 at 19:01
  • The question is how did you download it? Using a torrent client? – Hinklo Nov 15 '13 at 22:02
  • @Hinklo: No, just http protocol download, took me around several days to finish. Lucky the connection didn't break in the process. – Qiang Xu Nov 19 '13 at 21:51
  • 1
    Just check the exact size of the file you have with the size of the file you meant to download in the first place – Hinklo Nov 20 '13 at 09:16
  • @Hinklo: Problem is, in the website, the original file size was listed as how many GB, like 20.8GB, but my file size is in bytes. When byte is converted to GB, there would be some loss of accuracy. – Qiang Xu Nov 25 '13 at 16:05
  • You can use browser plugins that retrieve actual file size – Danatela May 09 '14 at 11:40

3 Answers3

16

As you do not have checksum info for the file (CRC32, MD5, SHA-1, SHA-256, etc), you could try to validate the Mastroska format itself.

mkvalidator is a simple command line tool to verify Matroska and WebM files for spec conformance. It checks the various bogus or missing key elements against the EBML DocType version of the file and reports the errors/warnings in the command line.

To use:

mkvalidator --details your-big-mkv-file.mkv

However, mkvalidator could only validate the structure of the Mastroska container, not the "payload" (i.e. A/V data) in it. To validate the data portion, you still need a decoder to see if it decodes correctly. From https://superuser.com/a/100290 :

ffmpeg -v error -i file.avi -f null - 2>error.log

This command uses ffmpeg to read in the mkv file and tries to decode it frame by frame. Any errors found in the decoding process will be recorded in error.log file.

Zhuoyun Wei
  • 530
  • 1
  • 6
  • 12
2

The matroska validation tool works great for checking the integrity of the container. Here is a recursive wrapper script that I wrote in python that I use for large libraries. https://github.com/1010dvpt/mkv-validator

1010dvpt
  • 21
  • 1
0

There's the MKVToolNix, mentioned in the official Matroska website, which is a package of tools, one of them is mkinfo which can be used to retrieve some information about Matroska and WebM files.

There's also the mkvalidator as mentioned by the other answers, but I couldn't find recent builds for Linux.

If you check their download page, you will find Ubuntu deb repositories. And once you add the deb repository to your sources list, you will be able to install the command line tools and/or the GUI tool as well.

Here is an example of the output you get when you use mkvinfo on a file:

$ mkvinfo 1fbf4140-3807-49f7-9f78-91bdada71a6e 
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ Maximum EBML ID length: 4
|+ Maximum EBML size length: 8
|+ Document type: webm
|+ Document type version: 4
|+ Document type read version: 2
+ Segment: size unknown
|+ Segment information
| + Timestamp scale: 1000000
| + Multiplexing application: Chrome
| + Writing application: Chrome
|+ Tracks
| + Track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 16615739537438539
|  + Track type: audio
|  + Codec ID: A_OPUS
|  + Codec's private data: size 19
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 1
|   + Bit depth: 32
|+ Cluster

Matroska page mentioning the tool: https://www.matroska.org/downloads/mkvtoolnix.html

MKVToolNix page: https://mkvtoolnix.download/

Zignd
  • 10,774
  • 12
  • 36
  • 62