Five CLIs around DaVinci Resolve music-video editing, all inference local on Apple Silicon (MPS/MLX): - vg-roto: SAM 2.1 + MatAnyone click-to-cutout -> ProRes 4444 alpha - vg-index / vg-find: PySceneDetect + mlx-whisper searchable clip library - vg-beats: librosa beat grid -> Resolve marker EDL - vg-transcode: legacy codecs -> ProRes LT, deinterlaced, resumable setup/setup_venvs.sh rebuilds venvs, tool clones, checkpoints and applies patches/matanyone-cv2-reader.patch (torchvision >= 0.23 removed read_video). Verified end-to-end on ultra 2026-08-24; setup/smoke_test.sh covers the lanes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
54 lines
2.8 KiB
Bash
Executable File
54 lines
2.8 KiB
Bash
Executable File
#!/bin/zsh
|
|
# VIDGOD smoke test — fast lanes only (beats, transcode, index, find). ~1-2 min.
|
|
# Add --roto to also run the full SAM2+MatAnyone pipeline on a bundled demo clip (minutes).
|
|
export PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
|
|
VG="$(cd "$(dirname "$0")/.." && pwd)"
|
|
T="$VG/tests/smoke"
|
|
mkdir -p "$T/oldstyle"
|
|
fails=0
|
|
check(){ if [ $1 -eq 0 ]; then echo "PASS: $2"; else echo "FAIL: $2"; fails=$((fails+1)); fi }
|
|
|
|
echo "== 1. vg-beats (synthetic 120bpm click) =="
|
|
"$VG/venvs/index/bin/python" - <<PYEOF
|
|
import numpy as np, soundfile as sf
|
|
sr=22050; dur=20; y=np.zeros(sr*dur)
|
|
for b in np.arange(0,dur,0.5):
|
|
i=int(b*sr); n=min(3000,len(y)-i)
|
|
e=np.exp(-np.arange(n)/500); y[i:i+n]+=0.9*np.sin(2*np.pi*60*np.arange(n)/sr)*e
|
|
sf.write("$T/click120.wav", y, sr)
|
|
PYEOF
|
|
"$VG/bin/vg-beats" "$T/click120.wav" --fps 25 >/dev/null 2>&1
|
|
[ -s "$T/click120.beats.edl" ] && grep -q "ResolveColor" "$T/click120.beats.edl"
|
|
check $? "vg-beats produced marker EDL"
|
|
|
|
echo "== 2. vg-transcode (fake xvid avi + wmv) =="
|
|
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=4:size=640x480:rate=25" -c:v mpeg4 -vtag xvid -qscale:v 5 "$T/oldstyle/fake_xvid.avi"
|
|
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "smptebars=duration=4:size=640x480:rate=25" -f lavfi -i "sine=frequency=440:duration=4" -c:v wmv2 -c:a wmav2 "$T/oldstyle/fake_wmv.wmv"
|
|
"$VG/bin/vg-transcode" "$T/oldstyle" >/dev/null 2>&1
|
|
[ -s "$T/oldstyle-prores/fake_xvid.mov" ] && [ -s "$T/oldstyle-prores/fake_wmv.mov" ]
|
|
check $? "vg-transcode converted both to ProRes"
|
|
|
|
echo "== 3. vg-index + vg-find (speech clip with a hard cut) =="
|
|
if command -v say >/dev/null; then
|
|
say -o "$T/speech.aiff" "The radical robot destroyed the shopping mall. Totally awesome dude."
|
|
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc2=duration=2.5:size=640x360:rate=25" -f lavfi -i "smptebars=duration=2.5:size=640x360:rate=25" -i "$T/speech.aiff" -filter_complex "[0:v][1:v]concat=n=2:v=1[v]" -map "[v]" -map 2:a -c:v libx264 -crf 20 -c:a aac -shortest "$T/dialogue_test.mp4"
|
|
"$VG/bin/vg-index" "$T/dialogue_test.mp4" --force >/dev/null 2>&1
|
|
"$VG/bin/vg-find" radical | grep -qi radical
|
|
check $? "vg-index + vg-find round-trip (whisper heard 'radical')"
|
|
else
|
|
echo "SKIP: no 'say' binary for speech synthesis"
|
|
fi
|
|
|
|
if [ "${1:-}" = "--roto" ]; then
|
|
echo "== 4. vg-roto (bundled demo clip, full SAM2+MatAnyone) =="
|
|
DEMO="$VG/tools/MatAnyone/inputs/video/test-sample3.mp4"
|
|
ffmpeg -hide_banner -loglevel error -y -t 4 -i "$DEMO" -c:v libx264 -crf 12 -an "$T/roto_in.mp4"
|
|
"$VG/bin/vg-roto" "$T/roto_in.mp4" --point 970,220 --point 1150,500 --out "$T/roto_out"
|
|
[ -s "$T/roto_out/roto_in_alpha.mov" ]
|
|
check $? "vg-roto produced ProRes 4444 alpha"
|
|
fi
|
|
|
|
echo
|
|
if [ $fails -eq 0 ]; then echo "SMOKE TEST: all passed"; else echo "SMOKE TEST: $fails FAILED"; fi
|
|
exit $fails
|