first commit
This commit is contained in:
34
sanitycheck.sh
Executable file
34
sanitycheck.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# sanitycheck.sh <file.mp4>
|
||||
#
|
||||
# Returns: "OK" if file looks good, "Not OK" otherwise.
|
||||
|
||||
file="$1"
|
||||
|
||||
if [ -z "$file" ]; then
|
||||
echo "Usage: $0 <file.mp4>"
|
||||
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
|
||||
Reference in New Issue
Block a user