Harrison Crettol

Python Groundhog Tracker

A collection of Python scripts I put together to automatically record, edit, and track Goober, a groundhog living under my porch. Instead of scrubbing through hours of blank video, this toolkit only records when he moves, trims the clips, tracks him with OpenCV, and formats the output for social media.

View Code on GitHub
Goober the Groundhog eating grass
Subject: Goober [ Active ]
Goober Demo Video [ Tracking ]
The Tech Stack & Workflow

Step 1: Catching Goober (spy_cam.py)

A live motion-detection camera using an old laptop and USB webcam. It constantly watches the feed but only hits "record" when it detects movement.

python spy_cam.py

Step 2: Cutting Dead Air (trim_vid.py)

A quick command-line tool to chop the video down to just the good parts, eliminating the empty frames before and after he appears.

python trim_vid.py -i Videos/test1.mp4 -o Videos/tmp/trimmed.mp4 -s 2 -e 10

Step 3: Tracking the Action (post_process_tracking.py)

The core logic. It opens the trimmed video, allows me to draw an initial bounding box, and then uses OpenCV's MOG2 background subtraction to track him frame-by-frame.

python post_process_tracking.py -i Videos/tmp/trimmed.mp4 -o Videos/tmp/tracked.mp4

Step 4: Phone-Friendly Formatting (crop_vid.py)

Slices the widescreen feed into a perfect 1080x1920 vertical video, ready to drop straight into YouTube Shorts or TikTok.

python crop_vid.py -i Videos/tmp/tracked.mp4 -o FINAL_OUTPUT.mp4
Field Recon Images