Last active
April 28, 2016 14:45
-
-
Save glennzw/11cbb1557665671473f350795116ef89 to your computer and use it in GitHub Desktop.
Video File Checker
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 | |
# Check all MP4 video files to see if they're corrupt, then merge into one file. | |
which avprobe | |
if [ $? -ne 0 ]; then echo "Please install avprobe"; exit; fi | |
find . -type f -iname "*.mp4" -print0 | while IFS= read -r -d $'\0' line; do | |
avprobe "$line" &> /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Deleting corrupt file $line" | |
rm "$line" | |
fi | |
done | |
echo "Merging..." | |
filesList="" | |
for file in $(ls *.mp4|sort -n);do | |
filesList="$filesList -cat $file" | |
done | |
MP4Box $filesList -new merged_files_$(date +%Y%m%d_%H%M%S).mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment