Skip to content

Instantly share code, notes, and snippets.

@greatvc
Last active November 16, 2015 08:56
Show Gist options
  • Select an option

  • Save greatvc/fb36220e1b3b3a77c7f3 to your computer and use it in GitHub Desktop.

Select an option

Save greatvc/fb36220e1b3b3a77c7f3 to your computer and use it in GitHub Desktop.
Check videos if they are corrupted at the end by seeking to 99% of the video. Return true if it is corrupted.
#!/usr/bin/python
import os
import sys
MyVideo=""
def checkfile(filename):
command = "echo 'seek 99 1' | mplayer -slave -msglevel all=4 -benchmark -vo null -nosound \"" + filename + "\" 2>&1"
output = os.popen(command).read()
if output.lower().find('error') == -1:
return True
else:
return False
if __name__ == "__main__":
for filename in sys.argv[1:]:
if not checkfile(filename):
head,tail=os.path.split(filename)
MyVideo=tail[:-4]
print MyVideo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment