The Problem

Many small‑business and home‑owners want AI‑enhanced video monitoring but lack the engineering resources to stitch together object detection, tracking, clip search, and push notifications on top of an RTSP camera feed. Existing solutions either require expensive proprietary hardware or force users into closed ecosystems. This repo attempts to fill that gap by turning any RTSP‑enabled camera—or an old iPhone—into a state‑of‑the‑art AI security camera with minimal setup.

What This Does

The Python backend (clearcam.py) launches an NVR that ingests RTSP streams, runs YOLOv9 object detection (detection/yolov9.py), and tracks objects with the OC‑Sort engine (ocsorttracker/ocsort.py). Detected events are stored as clipped video (clip.py) and indexed for search via a CLIP‑based embedding store (utils/cliptokenizer.py, test/clip_images/). The iOS app (ios/clearcam/) and Android client (android/clearcam/app/) provide live preview, event browsing, and push notifications; premium user IDs are entered in the iOS SettingsScreen.kt to authorize remote stream access. A lightweight HTTP server (mainview.html, player.html) lets anyone browse events from a browser.

How To Use It

Setup

Install Python dependencies: pip install -r requirements.txt (requires ffmpeg, tinygrad, numpy, cv2). For iOS: git clone https://github.com/roryclear/clearcam.git then open ios/clearcam.xcodeproj. The project targets iOS 15+ and requires no external Cocoa pods. Android builds use the existing Gradle files (android/clearcam/app/build.gradle, android/clearcam/build.gradle); no separate lockfile is provided.

Configuration

No secret keys are checked into the repo. After running python3 clearcam.py, enter your Clearcam premium user ID (visible in the iOS app) to enable remote streams and notifications. The optional BEAM=2 flag (BEAM=2 python3 clearcam.py) activates an extra performance path on first run.

Running it

Start the Python NVR: python3 clearcam.py. Open localhost:8080 in a browser to view live feed, events, and search results. On mobile, launch the installed app and sign in with the same premium ID to receive push alerts.

Real‑World Use

A field technician can deploy a single Raspberry Pi or an always‑on laptop running clearcam.py to monitor multiple RTSP cameras at a remote site. When a person is detected, the system clips the moment, stores an embedding, and pushes a notification to the technician’s iPhone. Later, searching “person in hallway” returns the relevant clip instantly, eliminating the need to scrub through hours of footage.

Code Health & Issues

No CI/CD pipeline – there is no .github/ workflow or other CI configuration, so every change must be manually tested. Dependencies declared without a lockfile – requirements.txt and android/clearcam/app/build.gradle list versions but no requirements.lock or gradle.lock is present, making reproducible builds across environments uncertain. Unit tests exist (14 files under test/), but they are not integrated into any automated gate; running them requires manual invocation. No input validation on the RTSP URL – the Python entry point accepts any string; malformed URLs could cause crashes or resource exhaustion. Secrets not stored in code – the premium user ID is entered at runtime, which is a reasonable pattern, but the iOS SecretManager.* files hint at a key‑storage mechanism that is not exposed in the public repo.

Overall the codebase is functional for prototyping and hobbyist use, but it lacks the automation and dependency hygiene expected in a production‑grade product.

The Bottom Line

This repo provides a workable, end‑to‑end AI camera stack for anyone with an RTSP source and a willingness to run Python or build native mobile clients. Its strengths are the integrated detection/tracking pipeline and the browser‑based event viewer. Weaknesses are the absent CI/CD, missing lockfiles, and unguarded RTSP handling, which make it better suited for developers and small deployments than for mission‑critical security installations.