Spaces:
Runtime error
Runtime error
Commit History
-
feat(scan): right-click scan-mode alerting + per-camera pose
Scan mode runs parallel low-fps inference sessions per CCTV with no HLS overhead, triggered via right-click on the FE map. Each session owns a RuleEngine that fires on sustained_count rules and persists alerts (JPEG snapshot + H.264 MP4 clip from a ring buffer) into the shared `alerts` table with source='cctv-scan'. Backbone: - ScanSessionWorker: capture -> infer -> rules -> ring buffer - RuleEngine: sustained_count with cold-start guard + per-rule cooldown + progress_snapshot() for the FE probability bar - FrameRingBuffer: deque + JPEG snapshot + H.264 MP4 encode via ffmpeg subprocess (cv2 mp4v fallback when ffmpeg absent) - AlertsDAO: INSERT/UPDATE/query against the Prisma-owned `alerts` table - ScanEventBus: thread-safe pub/sub bridging worker threads to async WS - Registry: second worker pool (MAX_SCAN_STREAMS) sharing the detector Pose pipeline: coverage polygon + per-detection geo projection now use heading_deg / fov_deg from cctv_streams when present (falls back to GEO_* e…d6b1333
-
fix(hls): snapshot read playlist/segment to avoid Content-Length race
FileResponse stat'd then streamed the file while ffmpeg was rolling playlist.m3u8 / .ts segments concurrently, so the response body grew past the precomputed Content-Length and uvicorn raised "Response content longer than Content-Length". Read whole bytes into memory and return Response so Content-Length matches what we send.399ad59
-
feat: real-time CCTV YOLO analytics with bbox-baked HLS
Per-camera worker decoupled into four stages: - capture (StreamReader): decodes upstream HLS, tags frames with capture timestamp, pushes to a bounded ring (drop-oldest) - pace: monotonic-clock thread ticks at HLS_FPS, pops the next frame from the ring, annotates with the detection that was current at that capture time (bbox stays glued to the visible frame even with ring delay) - encode: ffmpeg in true CFR (-r N -fps_mode cfr), libx264 or videotoolbox; segments split on exact second boundaries - inference: YOLO + ByteTrack on its own thread at TARGET_INFER_FPS; never blocks the capture / pace / encode chain Detection coords scaled from source space (e.g. 1920x1080) to output space (e.g. 1280x720) before annotation. Persistent state in a single cctv_session_metrics row per camera (UPSERT each tick, started_at frozen across reconnects). Realtime WS pushes analytics + geo-tagged detections with per-camera coverage polygon. Embed-ready: any client drops <video src=playlist.m3u…40e0b51