Verify Integrity of Videos Files With FFmpeg

By Johannes Filter
Published Feb 4, 2020

Using ffmeg to verify the integrity of video files. Parallelized by using GNU parallel, filesnames of problematic files are written to a text file.

#!/bin/bash
process_one() {
  local file=$1 && echo $file
  local out=$(ffmpeg -threads 1 -v error -i "$file" -f null - 2>&1);
  if [ "$out" = ""  ]; then
    echo "looks good"
  else
    echo $out && echo $file >> problem.txt
  fi
}

export -f process_one
parallel process_one ::: video_directory/*.mp4