How to check the integrity of a video file (avi, mpeg, mp4…)

avimpegverification

This title could be somewhat misleading, so let me explain …

I'm downloading a video file … mpeg, avi – being one of the popular formats. Now, if I am downloading it, and the download breaks in the middle of the uhm … download, then, for example, Windows Media Player will give out some error and refuse to play it (although the file is, let's say, 98% complete). But, players like KMPlayer, or MediaPlayer Classic will play it up until that point (as the matter of fact, they can play it while it is being downloaded as well).

So, I'm interested, … without using any means of download (download managers and alike) to secure the file is completely downloaded, how can one verify whether the video file is downloaded whole, and that it is complete ?

Best Answer

You can use a feature in ffmpeg video converter: if you will specify it to recode video to nothing it will just read input file and report any errors that will appear. This is very fast process because video frames are just being read, checked and silently dropped.

Example command line: (for Linux)

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

-v error means a certain level of verbosity (to show some errors that are normally hidden because they don't affect playability a much).

You will get a full error log with some generic information about file ffmpeg will output, so this will probably require your attention, through filters can be written to perform batch check of similar files.

FFmpeg is also available for Windows here. The command line will be almost identical with an exception of stderr redirect:

ffmpeg.exe -v error -i file.avi -f null - >error.log 2>&1
Related Question