Created
August 26, 2019 15:23
-
-
Save okhlybov/37b8c9012c811b804a9eaf1f6fda60d7 to your computer and use it in GitHub Desktop.
Script to detect and save uncorrupted video files
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
#!/bin/bash | |
# Copy uncorrupted video files found in current directory to the directory $1 | |
IFS=$'\n' | |
for f in `find . -iregex '.*\(avi\|wmv\|mkv\|mp4\|mov\|mpg\|mpeg\)$'`; do | |
ffmpeg -xerror -i "$f" -f null - > /dev/null 2>&1 | |
[[ $? = 0 ]] && { | |
echo "+ $f" | |
cp -p "$f" "$1" | |
} | |
done | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment