Guest User

find broken video files

a guest
Oct 30th, 2015
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data