Having trouble finding a solution to this. I have a folder with a few thousand movies in it, and maybe 20-30 are corrupt. I'm trying to find a way to list these corrupt files (NOT delete them). They are named nicely, and all located in one directory (/media/NS02/Movies/*)

I found that XBMC cannot find quality information of these files, and tried dumping a list of the damaged ones to no avail. I also tried using mediainfo. I'm particularly interested in this approach, as I would also like printed a list of videos that aren't 720P (separately).

The video files are MKV, MP4 and avi. I am not particularly worried about getting AVI quality. How could I achieve these? I prefer CLI approaches.

1 Answer 1


I'm not sure about the behaviour of corrupt video files. I'll just give suggestions for possible behaviours.

Will these files not play at all? Or will the playback crash somewhere in the middle of the movie?

If it is the former, you can try mplayer -vo null -ao null on a file, make sure that mplayer doesn't quit in the first 2-3 seconds, kill mplayer and move to the next. Should be easy enough to script and shouldn't take more than an hour for 1000 movies.

If it is the latter, again there are two possibilities.

  1. mplayer cannot seek to any position beyond the crash point.
  2. mplayer can seek to a position beyond the crash point and play smoothly.

Case 1 can be handled by opening a file with echo 'seek 95 1' | mplayer -vo null -ao null -slave and checking if mplayer crashes. This command just opens the file and tries to seek to 95% time position.

Case 2 means that a crash cannot be detected by looking at any point of the file other than the crash point. So, the only way to go about it will be to decode the entire file and see if the decoding fails at some point. There are ways to decode files faster than real time playback, but still I'd expect this process to go on for days, possibly months. It's up to you to decide whether detecting 20-30 corrupt files among a few thousand is really worth this much effort.

Detecting videos that aren't 720p:

mplayer file.extn -frames 0 -vo null -ao null 2> /dev/null | grep VIDEO | awk '{ print $3 }' prints the resolution of the video. You can use this to generate the required list.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .