Advertisement
Guest User

find broken video files

a guest
Oct 30th, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. mkcheck () {
  4.         tmp=$(mktemp)
  5.         ffmpeg -v error -threads 1 -i "${1}" -f null - 2>"${tmp}"
  6.         errors=$(grep -E -i 'error|invalid|illegal|damage' "${tmp}" | wc -l)
  7.         if [[ $errors -ge "1" ]]; then
  8.                 echo "File ${1} is BROKEN!!!"
  9.         fi
  10.         rm "${tmp}"
  11. }
  12.  
  13. export -f mkcheck
  14.  
  15. find . -type f \( -iname "*.avi" -o -iname "*.mkv" -o -iname "*.mp4" -o -iname "*.mp*g" -o -iname "*.mov" -o -iname "*.3gp"  \) -print0 | parallel -0 mkcheck
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement