Skip to content

Instantly share code, notes, and snippets.

@okhlybov
Created August 26, 2019 15:23
Show Gist options
  • Save okhlybov/37b8c9012c811b804a9eaf1f6fda60d7 to your computer and use it in GitHub Desktop.
Save okhlybov/37b8c9012c811b804a9eaf1f6fda60d7 to your computer and use it in GitHub Desktop.
Script to detect and save uncorrupted video files
#!/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