Last active
December 15, 2021 02:59
-
-
Save kkew3/d20d7c18f7e29e5a406ab4ff13e588f3 to your computer and use it in GitHub Desktop.
Check whether a video file has been corrupted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original command adapted from https://superuser.com/a/100290 | |
import subprocess | |
filename = ... | |
try: | |
_ = subprocess.check_call(['ffmpeg', '-v', 'error', '-i', | |
filename, '-f', 'null', '-']) | |
except subprocess.CalledProcessError: | |
# the subprocess call returns non-zero, which means filename | |
# has been corrupted; | |
# do whatever you want to do here | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment