Streaming Flows
What This Page Covers
This page describes the runtime flows for live streaming, recording, clip creation and playback within the Video Management Capability. It traces each operation from client request through the cloud infrastructure to storage, showing how the components interact at each step.
For camera setup and channel creation prerequisites, see Camera Configuration. For storage layout and retention, see Media Storage.
Live Stream Initialization
Starting a live stream is a multi-step handshake between the client, Cloud VMS, Local Agent and NVR Worker. The stream token carries all the information the Local Agent needs to establish the connection.
Flow
Step-by-Step
-
Channel creation — The client creates a channel on the Cloud NVR via the VMS API (one-time setup per camera).
-
Token request — The client requests a streaming token for the channel. The token encodes:
- The NVR URL to connect to
- A stream authorization session ID (
sid) that identifies the channel
-
Stream start — The client sends the token and the camera's IP address to the Local Agent running on the Zipato Hub or Zipatile.
-
NVR handshake — The Local Agent contacts the Cloud NVR with the
sid. The NVR validates the session and upgrades the connection to a WebSocket. -
Worker assignment — Over the WebSocket, the Cloud NVR provides the NVR Worker URL where the stream should be pushed.
-
Stream active — The Local Agent pulls the stream from the camera (typically via RTSP) and pushes it to the NVR Worker over the WebSocket. The NVR Worker notifies the Cloud NVR that streaming has started.
-
Stream end — When the stream is stopped (by client request or timeout), the NVR Worker notifies the Cloud NVR.
Recording While Streaming
Once a live stream is active, the NVR Worker automatically segments and uploads recordings to S3. No additional client action is needed — recording begins as soon as the stream starts.
Flow
Step-by-Step
-
Stream reception — The NVR Worker receives the live stream from the Local Agent via WebSocket.
-
Segmentation — Every 30 seconds, the NVR Worker creates a recording segment from the stream buffer.
-
S3 upload — The segment is uploaded to the S3 recordings bucket using rclone.
-
Dual notification — Two notification paths fire in parallel:
- S3 sends an event to an SQS queue (used by clip creation)
- The NVR Worker directly notifies the Cloud NVR of the upload
-
Metadata persistence — The Cloud NVR saves recording metadata (channel, time range, S3 path) to the database.
NVR Worker Design
The NVR Worker is stateless and horizontally scalable:
| Component | Role |
|---|---|
| MediaMTX | Stream protocol handling and processing |
| tmpfs | Temporary storage for segments before upload |
| rclone | S3 upload with retry and checksum verification |
Multiple worker instances can run simultaneously, each handling independent streams.
Recording Playback
Playback uses presigned S3 URLs, meaning the client downloads recordings directly from S3 without routing through the VMS infrastructure.
Flow
Step-by-Step
-
Request — The client requests recordings for a channel, optionally filtered by time range.
-
Metadata lookup — The Cloud NVR queries the database for recording entries matching the channel and time range.
-
URL presigning — For each recording, the Cloud NVR generates a presigned S3 GET URL with a limited expiration time.
-
Direct download — The client uses the presigned URLs to download recordings directly from S3. No further authorization is needed — the presigned URL carries its own credentials.
Clip Creation
A clip is a user-defined time range extracted from continuous recordings. Clip creation is asynchronous because the requested time range may extend into the present — the Cloud NVR must wait for recordings that haven't been uploaded yet.
Flow
Step-by-Step
-
Clip request — The client specifies a channel and time range (start and end timestamp). The end time may be in the future.
-
Entry creation — The Cloud NVR creates a clip entry in the database with
status: in_progressand returns the clip ID immediately. -
Existing recordings — The NVR queries the database for recordings that already exist within the time range and appends them to the clip.
-
Waiting for uploads — If the time range includes the present or near-future, the NVR listens on the SQS queue for new recording upload notifications. As each relevant recording arrives, it is appended to the clip.
-
Completion — Once all segments within the time range are accounted for, the clip status is set to
finished. The clip is now accessible via presigned S3 URLs, same as individual recordings.
Clip Lifecycle
| Status | Meaning |
|---|---|
in_progress | Clip is being assembled — some recordings may still be uploading |
finished | All recordings within the time range are included |
The client can poll the clip status or be notified when it transitions to finished.
Snapshot Upload
Snapshots are single-frame captures stored in S3. The upload uses a presigned PUT URL, allowing the client (or Local Agent) to upload directly to S3 without passing image data through the VMS.
Flow
Step-by-Step
-
Entry creation — The client requests a snapshot entry for the channel. The Cloud NVR creates it in the database and presigns an S3 PUT URL.
-
Direct upload — The client (or Local Agent on the hub) uploads the image directly to S3 using the presigned URL.
-
Access — The snapshot can later be retrieved through the same presigned-URL mechanism used for recordings.
RTSP Proxy
For browser clients that cannot directly access cameras behind NAT, the platform provides an RTSP proxy:
The proxy translates HTTP requests into RTSP protocol and relays the stream back to the browser. This allows live viewing without requiring the Local Agent path.
Protocol Summary
| Stream Path | Protocol | Purpose |
|---|---|---|
| Camera → Local Agent | RTSP (typically) | Pull from camera |
| Local Agent → NVR Worker | WebSocket | Push to cloud |
| NVR Worker → S3 | rclone (HTTPS) | Upload segments |
| S3 → Client | HTTPS (presigned) | Playback and download |
| Camera → RTSP Proxy → Browser | RTSP over HTTP | Direct browser viewing |
| Camera → YouTube | RTMP | Public broadcasting |
Where to Continue
| Goal | Page |
|---|---|
| Understand camera setup and channel creation | Camera Configuration |
| Learn about recording, clip and snapshot storage | Media Storage |
| See the full video management model | Overview |