Skip to content

feat: Frigate NVR reverse engineering for edge gateway v2#13

Draft
Thanukamax wants to merge 1 commit intomainfrom
feat/nvr-frigate-study
Draft

feat: Frigate NVR reverse engineering for edge gateway v2#13
Thanukamax wants to merge 1 commit intomainfrom
feat/nvr-frigate-study

Conversation

@Thanukamax
Copy link
Copy Markdown
Contributor

Summary

Reverse engineer Frigate NVR (MIT licensed) to study and repurpose its architecture for CROW's edge gateway. Frigate's clean separation of stream handling, detection, and event management maps directly to cctv-cli's needs.

Continues from: #10 (feat/gateway-v1 — Edge Ingest Gateway CLI, Phases 0-6)

Why Frigate

Criteria Why it fits
License MIT — maximum freedom to study + adapt
RTSP lifecycle go2rtc handles connection management, reconnects, codec negotiation, multi-consumer fan-out — replaces our raw ffmpeg -i rtsp:// calls
Motion/event system Zone-based detection triggers, event cooldowns, state machine — fills in our OnvifMotionWatcher stub
ONVIF frigate/ptz/onvif.py — integration patterns for our ONVIF motion gating
Architecture Microservice-ish (go2rtc + detector + event engine) — same direction as our sampler → uploader pipeline
Codebase Clean Python, well-separated concerns, excellent docs at frigate.video

Components to study

  1. go2rtc (Go, MIT) — RTSP connection lifecycle, health monitoring, reconnect logic
  2. frigate/detectors/ — How detection results feed back into event system
  3. frigate/events/ — Event state machine, cooldowns, zone logic
  4. frigate/config.py — Multi-camera YAML config pattern (compare with store.example.yaml)
  5. frigate/ptz/onvif.py — ONVIF integration for filling in OnvifMotionWatcher

Planned work

  • Document Frigate's architecture and map components to CROW equivalents
  • Replace raw FFmpeg RTSP calls with go2rtc-inspired connection manager
  • Implement real ONVIF event handling (based on Frigate's onvif.py patterns)
  • Add zone-based motion detection / event state machine
  • Integrate event-driven recording triggers with the existing sampler pipeline
  • Update multi-camera config to support Frigate-style YAML definitions

Skipped alternatives

  • ZoneMinder — 20-year legacy C++/Perl/PHP monolith, hard to navigate
  • Shinobi — Mixed GPL/paid licensing, less clean Node.js codebase
  • Moonfire NVR — Excellent Rust but too narrow (no motion detection, no ONVIF)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a88708e-a3ee-4fce-838e-70f01ccf1e84

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/nvr-frigate-study

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant