Expert Insights

How a Computer Vision Pipeline Runs on Existing CCTV: From RTSP Stream to Alert

A production computer vision system on existing CCTV is a pipeline of six stages: pull the RTSP stream, decode and sample frames, detect objects, track them across frames, evaluate rules against zones and time, and deliver a debounced alert. The design decisions that matter are frame sampling rate, where inference runs, and how rules are expressed so a plant supervisor can change them; done well, an alert reaches a phone in under two seconds from a camera the plant already owned.

2 December 202612 min readTanisha Soni

Most explanations of video analytics stop at "AI watches the camera". This article is the version an engineer would want: what the data path actually looks like when a system such as UrSpayce VISTA takes a feed from a five-year-old IP camera and turns it into a PPE alert on a supervisor's phone. The structure below is common to serious systems; the choices inside each stage are where products differ.

Stage 1: ingestion

Almost every IP camera and NVR exposes RTSP (Real Time Streaming Protocol) with H.264 or H.265 video. The pipeline opens one RTSP session per camera, or pulls from the NVR's substream when the camera is already saturated with connections. Two practical rules: use the substream (typically 640 to 1280 pixels wide) rather than the 4K main stream, because detection models are trained at those resolutions anyway, and keep a watchdog that reconnects on stream stalls, because cameras drop sessions after power blips and firmware updates far more often than their datasheets admit.

Stage 2: decoding and frame sampling

Decoding H.265 at 25 frames per second for 200 cameras is more expensive than running the detection model. Hardware decoders on the GPU or NPU handle this; a CPU-only box runs out of headroom at a few dozen streams. The pipeline then samples: a PPE check needs two to four frames per second, a queue count one frame every two seconds, an intrusion rule on a fence line perhaps eight frames per second. Sampling per use case, not per camera, is the single biggest lever on cost. A frame is dropped, never queued, when the model falls behind; stale frames produce stale alerts.

Stage 3: detection

A detector (the YOLO family and similar single-stage models dominate for this workload) returns boxes and classes per frame: person, helmet, vest, forklift, fire extinguisher. Three things decide quality in the field:

  • Training data from the actual environment. A helmet model trained on construction-site photos struggles with the matte helmets and sodium lighting of a foundry. Fine-tuning on a few hundred frames from the customer's own cameras typically moves precision more than any architecture change.
  • Resolution and small objects. A glove at 20 metres is a dozen pixels. Either crop the region of interest before inference or accept that some checks need a camera closer to the task.
  • Quantisation for the edge. Models are exported to INT8 or FP16 to fit the edge box; the accuracy loss is small if calibration data comes from the site.

Stage 4: tracking and re-identification

Detection alone cannot answer "how long was this person in the zone". A tracker associates boxes across frames into tracks with IDs; modern trackers combine motion prediction with appearance features and survive brief occlusions. Re-identification links the same person across cameras, which matters for tailgating at a turnstile or for counting unique visitors rather than crossings. Where a use case does not need identity, the system should not compute it: an occupancy count is an integer, and keeping it that way is both cheaper and simpler under the DPDP Act (see our DPDP checklist).

Stage 5: rules, zones and time

The model says "person without helmet at pixel 412, 300". The rule says "inside the press-shop zone, between 06:00 and 22:00, for more than three seconds, excluding the walkway". Rules live outside the model so a supervisor can draw a zone, set a dwell time and pick the shift without a vendor ticket. VISTA ships 37-plus rule templates on this pattern. Three rule features prevent most false alarms: a minimum dwell (a helmet removed to wipe a brow is not a breach), a zone mask that excludes reflections and screens, and a per-rule confidence threshold set from the site's own validation data.

Stage 6: debouncing and delivery

A person without a helmet for two minutes should produce one alert, not 240. The pipeline debounces by track ID and rule, attaches a snapshot (not a clip, unless the rule demands it), and delivers to WhatsApp, SMS, the control-room screen or a helpdesk ticket. End-to-end latency from frame capture to phone is under two seconds on an edge deployment; cloud paths add the uplink.

Edge or cloud: where each stage runs

StageEdge box in the plantCloudWhat usually decides it
Ingestion and decodeAlwaysOnly for small camera countsBandwidth: 200 streams cannot leave a plant
Detection and trackingPreferredPossibleLatency and data residency
RulesYes, with cloud-managed configurationYesMust survive a WAN outage
Dashboards, multi-site reportingNoYesNeeds all sites in one place
Model updatesPulled from cloudBuilt in cloudVersion control across sites

What to measure in production

Precision per rule (alerts that were real), recall sampled weekly by reviewing random clips, median latency, dropped-frame rate per camera, and model version per site. A pipeline without these numbers is a demo; one with them is a system a safety officer will trust.

Where UrSpayce fits

VISTA implements this pipeline on existing cameras, in the cloud or on an on-site edge box, with rules editable by the site and alerts in under two seconds, and hands events to the same platform that runs helpdesk and attendance. For the buyer's view, read the manufacturing guide; for the technical trial, bring five camera feeds.

Frequently asked questions

Can video analytics run on old analog or 720p cameras?

Yes for most safety and counting use cases, provided the camera reaches an NVR or encoder that exposes RTSP; models run at 640 to 1280 pixels wide, so a 720p substream is sufficient. Fine-detail checks such as gloves at 20 metres need a closer camera.

How many cameras can one edge box handle?

It depends on frames per second per use case; a GPU-equipped box typically handles 30 to 60 substreams at two to four frames per second with hardware decoding, far fewer if every stream is analysed at full frame rate.

What is the difference between detection and tracking?

Detection finds objects in a single frame; tracking links those detections across frames into a track with an ID, which is what allows dwell-time rules, counting unique people and tailgating checks.

Why do video analytics systems produce false alarms?

Mostly from rules without dwell time or zone masks, models trained on other environments, and reflections or screens inside the field of view. Site-specific fine-tuning and per-rule thresholds fix most of it.

How fast can an alert reach a phone?

Under two seconds from frame capture on an edge deployment such as UrSpayce VISTA; cloud inference adds the uplink time and depends on bandwidth.

Does the pipeline have to store video?

No. Most rules need a snapshot, not a clip, and counts need no image at all; storing events rather than footage reduces both cost and personal-data exposure under India's DPDP Act.

See UrSpayce in action

One AI-native platform for visitors, spaces, IoT, computer vision, AI agents and procurement — across India, the US and the GCC.

Book a free demo