#!/usr/bin/env bash # # sanitycheck.sh # # Returns: "OK" if file looks good, "Not OK" otherwise. file="$1" if [ -z "$file" ]; then echo "Usage: $0 " exit 2 fi if [ ! -f "$file" ]; then echo "Not OK (file not found)" exit 1 fi # --- Test 1: metadata sanity check --- ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration \ -of csv=p=0 "$file" > /dev/null 2>&1 probe_status=$? # --- Test 2: deep read/decode --- ffmpeg -v error -xerror -i "$file" -f null - -nostats > /dev/null 2>&1 decode_status=$? if [ $probe_status -eq 0 ] && [ $decode_status -eq 0 ]; then echo "OK" exit 0 else echo "Not OK" exit 1 fi