Log in

View Full Version : how to check if a video file is corrupted / incomplete / imperfect ?


kenny1999
10th July 2013, 19:52
I find that a lot of video formats can still be played if they are corrupted / incomplete / imperfect. Although Windows media player might not play as much corrupted / incomplete / imperfect video files as other video players, they could still play some WMV files if they are only slightly corrupted. Those video might stop by itself at the last few seconds / minutes. The user might not be able to notice the corrupted / incomplete video file at the very first time.

I would like to know, otherwise than playing each video and guess if it's perfect or not by the end of the playback. Is there any traces that I can determine if a video is perfect or corrupted?

LoRd_MuldeR
10th July 2013, 20:56
There is no easy way to know whether a file is corrupt. At least not if you don't know the checksum (e.g. MD5/SHA-1 hash or at least CRC value) of the "correct" original file.

Most audio, video and container formats simply do not include any checksums themselves, so there is nothing that you could check against :rolleyes:

All you could do is trying to decode the complete file and see whether the decoder spits out any unexpected errors/warnings. For example with FFmpeg:

ffmpeg.exe -loglevel -f yuv4mpegpipe -i c:\foo\file_to_test.mkv - > NUL

Of course this can only find corruptions that produced an out-of-spec bitstream.

It's perfectly possible that the file got corrupted in a way that does not result in an out-of-spec bitstream, but still doesn't produce the intended output (e.g. visual artifacts).

I don't think there is way to detect such errors in an automated way, because in general we don't know how the output is supposed to look...

---

The ability to detect incomplete/truncated files highly depends on the individual file format, I think.

With something like a Transport Stream (where each packet has it's own header) or even Raw a data stream it is impossible to know whether there are any more frames/packets supposed to follow or not.

On the other hand, formats like MP4 have a global data structure with the exact positions of all frames/packets, so if anything is missing that should be straight forward to detect.

kenny1999
11th July 2013, 02:13
There is no easy way to know whether a file is corrupt. At least not if you don't know the checksum (e.g. MD5/SHA-1 hash or at least CRC value) of the "correct" original file.

Most audio, video and container formats simply do not include any checksums themselves, so there is nothing that you could check against :rolleyes:

All you could do is trying to decode the complete file and see whether the decoder spits out any unexpected errors/warnings. For example with FFmpeg:

ffmpeg.exe -loglevel -f yuv4mpegpipe -i c:\foo\file_to_test.mkv - > NUL

Of course this can only find corruptions that produced an out-of-spec bitstream.

It's perfectly possible that the file got corrupted in a way that does not result in an out-of-spec bitstream, but still doesn't produce the intended output (e.g. visual artifacts).

I don't think there is way to detect such errors in an automated way, because in general we don't know how the output is supposed to look...

---

The ability to detect incomplete/truncated files highly depends on the individual file format, I think.

With something like a Transport Stream (where each packet has it's own header) or even Raw a data stream it is impossible to know whether there are any more frames/packets supposed to follow or not.

On the other hand, formats like MP4 have a global data structure with the exact positions of all frames/packets, so if anything is missing that should be straight forward to detect.

It sounds quite complicated.
Will I be able to preview the video under windows 7 if it is imperfect and if it's WMV and MP4? A lot of times I find that an imperfect WMV / MP4 doesn't show preview photo under windows 7.

The video I have to check includes WMV, MP4, MOV and sometimes FLV as well. Will I be able to test these files when the 'original' MD5 will never be available and how to start ? according to your method suggested

Guest
11th July 2013, 04:36
Closing as poorly disguised reposting of the issue from a closed thread.

http://forum.doom9.org/showthread.php?t=168220