> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# RTSP Live Monitoring Wall

> Turn always-on RTSP cameras into a searchable monitoring wall where quiet footage is skipped before extraction, kept segments carry gate verdicts, and email.

![RTSP Live Monitoring Wall](https://mixpeek.com/templates/rtsp-live-monitoring/wall-top.webp)

Turn always-on RTSP cameras into a searchable monitoring wall where quiet footage is skipped before extraction, kept segments carry gate verdicts, and email alerts fire from retriever results.

> [card] [Deploy in Studio](https://studio.mixpeek.com/manifests/apply?url=https%3A%2F%2Fmixpeek.com%2Ftemplates%2Frtsp-live-monitoring.namespace.yaml\&manifest_url=https%3A%2F%2Fmixpeek.com%2Ftemplates%2Frtsp-live-monitoring.namespace.yaml\&src=template-rtsp-live-monitoring\&template=rtsp-live-monitoring\&template_name=RTSP+Live+Monitoring+Wall\&sync=1\&utm_source=docs\&utm_medium=template_deploy\&utm_campaign=mvs_onramp)
>
> Creates every resource below in your organization, with sample data.

> [card] [Download the manifest](https://mixpeek.com/templates/rtsp-live-monitoring.namespace.yaml)
>
> `rtsp-live-monitoring.namespace.yaml`, the file Studio and the API apply.

> [card] [Template page](https://mixpeek.com/templates/rtsp-live-monitoring)
>
> The demo and the use case on mixpeek.com.

## At a glance

| | |
| - | - |
| **Creates** | 1 namespace, 1 bucket, 2 collections, 7 retrievers, 4 alerts, 1 trigger |
| **Extractors** | [`passthrough_extractor`](https://docs.mixpeek.com/docs/extract/extractors#passthrough) v1, [`multimodal_extractor`](https://docs.mixpeek.com/docs/extract/extractors#multimodal) v2 |
| **Models** | [Gemini Embedding 2](https://mixpeek.com/models/gemini-embedding-2) |
| **Daily spend budget** | 1 USD, set on the namespace. Queries are not capped. |
| **Sample data** | 2 objects, uploaded to `camera-segments` when you apply |
| **Version** | 1.0, updated 2026-09-08 |

## How the pieces connect

Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.

```mermaid theme={null}
flowchart LR
  b0[("camera-segments")]
  c1["segments-index<br/>passthrough_extractor v1"]
  c2["segments-analysis<br/>multimodal_extractor v2"]
  r3{{"similar-segments"}}
  r4{{"segment-search"}}
  r5{{"match-monitor"}}
  r6{{"match-control"}}
  r7{{"unjudged-monitor"}}
  r8{{"analysis-monitor"}}
  r9{{"recent-segments"}}
  b0 --> c1
  b0 --> c2
  c2 --> r3
  c2 --> r4
  c2 --> r8
  c1 --> r9
```

## Deploy it

> [tab] API
>
> **1. Get the manifest**
>
> ```bash theme={null}
> curl -sO https://mixpeek.com/templates/rtsp-live-monitoring.namespace.yaml
> ```
>
> **2. Validate it**
>
> Validate runs every check apply runs and creates nothing. Fix each entry in `errors`, then run it again.
>
> ```bash theme={null}
> curl -X POST https://api.mixpeek.com/v1/manifest/validate \
>   -H "Authorization: Bearer $MIXPEEK_API_KEY" \
>   -F "manifest_file=@rtsp-live-monitoring.namespace.yaml"
> ```
>
> **3. Apply it**
>
> Apply creates every resource in one call. `wait_for_seed=true` also waits until the sample objects are processed, so the first query below has documents to return.
>
> ```bash theme={null}
> curl -X POST "https://api.mixpeek.com/v1/manifest/apply?wait_for_seed=true" \
>   -H "Authorization: Bearer $MIXPEEK_API_KEY" \
>   -F "manifest_file=@rtsp-live-monitoring.namespace.yaml"
> ```
>
> The response lists each resource with its outcome in `resources`. Apply refuses a resource that already exists and rolls the whole apply back, so to apply the file again over this namespace add `?mode=create_missing`, which creates only what is missing.

> [tab] Studio
>
> Open [Deploy in Studio](https://studio.mixpeek.com/manifests/apply?url=https%3A%2F%2Fmixpeek.com%2Ftemplates%2Frtsp-live-monitoring.namespace.yaml\&manifest_url=https%3A%2F%2Fmixpeek.com%2Ftemplates%2Frtsp-live-monitoring.namespace.yaml\&src=template-rtsp-live-monitoring\&template=rtsp-live-monitoring\&template_name=RTSP+Live+Monitoring+Wall\&sync=1\&utm_source=docs\&utm_medium=template_deploy\&utm_campaign=mvs_onramp), sign in, choose where to deploy, and select **Apply to my workspace**. Studio shows each resource as it is created.

## Run the first query

Look up the namespace id by name, then run `segment-search`. Check `status` and `warnings` along with `documents`: a run that times out still answers 200, with `status` `degraded`.

```bash cURL theme={null}
NAMESPACE_ID=$(curl -s https://api.mixpeek.com/v1/namespaces/rtsp-live-monitoring \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" | jq -r .namespace_id)

curl -X POST https://api.mixpeek.com/v1/retrievers/segment-search/execute \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"query": "people dancing"}}' \
  | jq '{status, warnings, documents: [.documents[] | {document_id, score}]}'
```

```python Python theme={null}
import os, requests

AUTH = {"Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}"}
ns = requests.get("https://api.mixpeek.com/v1/namespaces/rtsp-live-monitoring", headers=AUTH).json()

run = requests.post(
    "https://api.mixpeek.com/v1/retrievers/segment-search/execute",
    headers={**AUTH, "X-Namespace": ns["namespace_id"]},
    json={"inputs": {"query": "people dancing"}},
).json()

print(run["status"], run["warnings"])  # "completed" on a clean run
for doc in run["documents"]:
    print(doc["document_id"], doc["score"])
```

```javascript JavaScript theme={null}
const auth = { Authorization: `Bearer ${process.env.MIXPEEK_API_KEY}` };
const ns = await fetch("https://api.mixpeek.com/v1/namespaces/rtsp-live-monitoring", { headers: auth }).then((r) => r.json());

const run = await fetch("https://api.mixpeek.com/v1/retrievers/segment-search/execute", {
  method: "POST",
  headers: { ...auth, "X-Namespace": ns.namespace_id, "Content-Type": "application/json" },
  body: JSON.stringify({"inputs": {"query": "people dancing"}}),
}).then((r) => r.json());

console.log(run.status, run.warnings); // "completed" on a clean run
for (const doc of run.documents) console.log(doc.document_id, doc.score);
```

## Add your own data

Each object you add to a bucket is processed by every collection that reads it. This adds one object to `camera-segments`. `NAMESPACE_ID` is the id from the namespace lookup above.

```bash cURL theme={null}
curl -X POST "https://api.mixpeek.com/v1/buckets/camera-segments/objects?auto_process=true" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{"captured_at": "example", "segment_index": 1, "gate_applied": true, "gate_top_score": 1.5, "gate_match_count": 1, "blobs": [{"property": "segment", "type": "video", "data": "https://example.com/clip.mp4"}]}'
```

```python Python theme={null}
import os, requests

HEADERS = {"Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}", "X-Namespace": os.environ["NAMESPACE_ID"]}

obj = requests.post(
    "https://api.mixpeek.com/v1/buckets/camera-segments/objects",
    params={"auto_process": "true"},
    headers=HEADERS,
    json={
        "captured_at": "example",
        "segment_index": 1,
        "gate_applied": True,
        "gate_top_score": 1.5,
        "gate_match_count": 1,
        "blobs": [
            {
                "property": "segment",
                "type": "video",
                "data": "https://example.com/clip.mp4"
            }
        ]
    },
).json()
print(obj["object_id"], obj["status"])  # PENDING until processing finishes
```

```javascript JavaScript theme={null}
const headers = {
  Authorization: `Bearer ${process.env.MIXPEEK_API_KEY}`,
  "X-Namespace": process.env.NAMESPACE_ID,
  "Content-Type": "application/json",
};

const obj = await fetch("https://api.mixpeek.com/v1/buckets/camera-segments/objects?auto_process=true", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "captured_at": "example",
    "segment_index": 1,
    "gate_applied": true,
    "gate_top_score": 1.5,
    "gate_match_count": 1,
    "blobs": [
      {
        "property": "segment",
        "type": "video",
        "data": "https://example.com/clip.mp4"
      }
    ]
  }),
}).then((r) => r.json());
console.log(obj.object_id, obj.status); // PENDING until processing finishes
```

The object is `PENDING` until processing finishes, then `COMPLETED` or `FAILED`. [Buckets and objects](https://docs.mixpeek.com/docs/ingest/buckets.md) covers object states, retries and duplicates.

## Retrievers

### `similar-segments`

The admission gate: embeds a captured segment and searches the analysed footage for its nearest match.

**Stages:** [`feature_search`](https://docs.mixpeek.com/docs/retrieve/stages#feature-search)

**Searches:** `segments-analysis`

| Input | Type | Required | Description |
| - | - | - | - |
| `segment` | video | yes | The media to match; encoded by the index below and compared against it |

### `segment-search`

Type what you are looking for, for example 'yellow taxi', and search the analysed footage. The analyst's entry point after an alert.

**Stages:** [`feature_search`](https://docs.mixpeek.com/docs/retrieve/stages#feature-search)

**Searches:** `segments-analysis`

| Input | Type | Required | Description |
| - | - | - | - |
| `query` | text | yes | What to look for; searched across every index below |

### `match-monitor`

Alert 1's discriminator. It reads the bucket itself, where an object is searchable the moment it lands, and keeps the arriving object when the gate judged it and the verdict cleared 0.5. Materialises into matched-footage.

**Searches:** `camera-segments`

| Input | Type | Required | Description |
| - | - | - | - |
| `captured_at` | text | yes | captured\_at of the arriving object, supplied by the alert attachment |

### `match-control`

The same filter at a bar nothing clears. An alert on this staying silent is what makes a firing on match-monitor mean something. Materialises into matched-footage-control.

**Searches:** `camera-segments`

| Input | Type | Required | Description |
| - | - | - | - |
| `captured_at` | text | yes | captured\_at of the arriving object, supplied by the alert attachment |

### `unjudged-monitor`

Segments the gate could not judge. On a new namespace the corpus is empty, so the first segments arrive unjudged and this carries them into analysis; once the corpus exists it goes quiet. Materialises into unjudged-footage.

**Searches:** `camera-segments`

| Input | Type | Required | Description |
| - | - | - | - |
| `captured_at` | text | yes | captured\_at of the arriving object, supplied by the alert attachment |

### `analysis-monitor`

Alert 2's discriminator, on the analysis collection. A segment that decomposed into more than one scene had motion inside the captured window. Materialises into matched-analysis.

**Searches:** `segments-analysis`

| Input | Type | Required | Description |
| - | - | - | - |
| `marker` | text | no | Constant supplied by the alert attachment; the filter is what selects |

### `recent-segments`

Every kept segment, newest first in the index. The health watch runs this because it needs no input, so an error or a slow run means the wall itself is unwell. Materialises into wall-health-watch.

**Searches:** `segments-index`

| Input | Type | Required | Description |
| - | - | - | - |
| `limit` | text | no | Optional cap on documents grouped per run |

## Collections

Each collection runs one extractor over a bucket, or over another collection's documents.

> [accordion] segments-index
>
> Payload view of every kept segment: the verdict fields are readable and filterable here without waiting for analysis. Feeds recent-segments.
>
> **Reads** bucket `camera-segments` with [`passthrough_extractor`](https://docs.mixpeek.com/docs/extract/extractors#passthrough) v1.
>
> | Document field | Type |
> | - | - |
> | `content_url` | string |
> | `content_type` | string |
> | `size_bytes` | integer |
> | `metadata` | object |

> [accordion] segments-analysis
>
> Multimodal embeddings of the segments an alert sent here, and the corpus the admission gate searches, so the gate sharpens as matched footage accrues. Feeds similar-segments, segment-search, analysis-monitor, matched-analysis.
>
> **Reads** bucket `camera-segments` with [`multimodal_extractor`](https://docs.mixpeek.com/docs/extract/extractors#multimodal) v2.
>
> **Inputs:** `video` ← `segment`
>
> | Document field | Type |
> | - | - |
> | `start_time` | number |
> | `end_time` | number |
> | `start_frame` | integer |
> | `end_frame` | integer |
> | `segment_time_frame` | string |
> | `cue_time_frame` | string |
> | `fps` | number |
> | `source_fps` | number |
> | `analysis_fps` | number |
> | `duration` | number |
> | `width` | integer |
> | `height` | integer |
> | `aspect_ratio` | number |
> | `transcription` | string |
> | `transcription_segments` | array\<object> |
> | `description` | string |
> | `ocr_text` | string |
> | `json_output` | object |
> | `thumbnail_url` | string |
> | `source_video_url` | string |
> | `video_segment_url` | string |
> | `multimodal_extractor_v2_multimodal_embedding` | array\<number> |
> | `multimodal_extractor_v2_transcription_embedding` | array\<number> |
> | `multimodal_extractor_v2_ocr_embedding` | array\<number> |
> | `multimodal_extractor_v2_description_embedding` | array\<number> |
> | `internal_metadata` | object |

## Also created

**[Alerts](https://docs.mixpeek.com/docs/enrich/alerts-and-triggers.md)**

* `matched-footage`: Alert 1. Fires as an object lands carrying a verdict that cleared the bar, emails the org notifications address (Settings -> Notifications; unset means opted out) and batches the object into segments-analysis.
* `matched-footage-control`: Control for alert 1: the same filter at a bar nothing clears. Quiet is healthy, and quiet next to a firing matched-footage is the proof the alert discriminates.
* `unjudged-footage`: Carries footage the gate could not judge into analysis rather than leaving it unanalysed. This seeds the gate's corpus on a new namespace and goes quiet once the gate has something to search.
* `matched-analysis`: Alert 2. Fires when analysed footage lands that broke into more than one scene, which means something moved inside the captured window.

**[Triggers](https://docs.mixpeek.com/docs/enrich/alerts-and-triggers.md)**

* `wall-health-watch`: Scheduled watch: runs recent-segments every 5 minutes and emails when the run errors or breaches the latency bound. An empty result is healthy before a camera is added and never pages.

> [accordion] Cost estimate at list price
>
> At 10,000 items a month (2 minutes or 10 pages each) and 100,000 queries, this template costs about **7,272.39 USD a month** (727.22 USD per 1,000 items). The namespace's daily spend budget pauses new batches before you pass it.
>
> | Part | USD a month |
> | - | - |
> | Processing | 7,272.00 |
> | Storage | 0.19 |
> | Queries | 0.20 |
> | Processing in `segments-index` | 900.00 |
> | Processing in `segments-analysis` | 6,372.00 |

## The manifest

Every resource above comes from this file. Change it and apply it again with `?mode=upsert` to update what exists. [Manifests](https://docs.mixpeek.com/docs/manage/manifests.md) documents each field.

```yaml rtsp-live-monitoring.namespace.yaml expandable theme={null}
# rtsp-live-monitoring: one manifest spins up the namespace.
# Platform manifest schema (GET /v1/discovery/schema). Validate with POST /v1/manifest/validate,
# apply with POST /v1/manifest/apply or the Deploy button. Wiring comes from the flow diagram:
# edges are bucket -> collection sources, collection -> retriever scope, retriever -> view.
# Applying a SECOND time, over a namespace this template already created: use
# POST /v1/manifest/apply?mode=create_missing, which creates what is missing and leaves
# what exists alone. The default, create_only, fails the WHOLE apply and rolls it back if
# any resource already exists, so an upgrade looks like a dead end without this. Use
# mode=upsert to also patch resources that exist but have drifted from this file.
version: '1.0'
metadata:
  name: rtsp-live-monitoring
  description: "Namespace template rtsp-live-monitoring. Generated from the flow diagram on mixpeek.com/templates/rtsp-live-monitoring."
namespaces:
  - name: rtsp-live-monitoring
    description: "Everything below lives in this namespace."
    feature_extractors:
      - name: passthrough_extractor
        version: v1
      - name: multimodal_extractor
        version: v2
    # Daily spend budget, in dollars of what you are charged (1,000 credits a dollar).
    # New batches pause once the namespace has spent this much today; queries are not capped.
    # Raise it later on the namespace: PATCH /v1/namespaces/<id> {"spend_budget": {"daily_usd": N}}.
    budget:
      daily_usd: 1

# Add your camera. This block is the shape the sync below expects:
# create the connection in Studio (Settings -> Connections) or uncomment
# this and apply again with a url you can reach. Apply live-tests a
# connection, so a url that is wrong or unreachable fails the whole
# deploy; left commented, the namespace comes up complete and waits.
# storage_connections:
#   - name: camera-feed
#     provider: rtsp
#     description: "Your camera. Paste its rtsp:// url here, add a credentials block if it needs one, and apply again with mode=create_missing. The gate retriever judges each segment before admission; gate_on_error publish means a broken gate costs extraction, never footage."
#     config:
#       url: "rtsp://strmr3.sha.maryland.gov/rtplive/3801d561005e00d00057fa36c4235c0a"
#       transport: tcp
#       segment_seconds: 10
#       segments_per_run: 3
#       scene_change_threshold: 6
#       gate_retriever_id: similar-segments
#       gate_on_error: publish
#       gate_timeout_seconds: 30
buckets:
  - name: camera-segments
    namespace: rtsp-live-monitoring
    description: "No source connected yet. Upload files here, or connect a storage source to this bucket in Studio."
    schema:
      properties:
        segment:
          type: video
        captured_at:
          type: string
        segment_index:
          type: integer
        gate_applied:
          type: boolean
        gate_top_score:
          type: number
        gate_match_count:
          type: integer
    # Alerts that run as each object lands, on the bucket's own collection.
    alert_applications:
      - alert: matched-footage
        input_mappings:
          - input_key: captured_at
            source: {source_type: document_field, path: captured_at}
      - alert: matched-footage-control
        input_mappings:
          - input_key: captured_at
            source: {source_type: document_field, path: captured_at}
      - alert: unjudged-footage
        input_mappings:
          - input_key: captured_at
            source: {source_type: document_field, path: captured_at}

# bucket_syncs:
#   - name: camera-sync
#     bucket: camera-segments
#     connection: camera-feed
#     source_path: camera-feed
#     sync_mode: continuous
#     polling_interval_seconds: 300
#     # note: Captures 30 of every 300 seconds (segment_seconds x segments_per_run per poll). It feeds segments-index and the bucket's own collection; segments-analysis is fed only by the alerts' batch action, so it holds what matched rather than everything captured.
#     batch_collection_ids:
#       - segments-index
#     schema_mapping:
#       mappings:
#         segment:
#           target_type: blob
#           blob_type: video
#           blob_property: segment
#           source:
#             type: file
#         captured_at:
#           target_type: field
#           source:
#             type: rtsp_field
#             field: captured_at
#         segment_index:
#           target_type: field
#           source:
#             type: rtsp_field
#             field: segment_index
#         gate_applied:
#           target_type: field
#           source:
#             type: rtsp_field
#             field: applied
#         gate_top_score:
#           target_type: field
#           source:
#             type: rtsp_field
#             field: top_score
#         gate_match_count:
#           target_type: field
#           source:
#             type: rtsp_field
#             field: match_count
collections:
  - name: segments-index
    namespace: rtsp-live-monitoring
    description: "Payload view of every kept segment: the verdict fields are readable and filterable here without waiting for analysis. Feeds recent-segments."
    source:
      type: bucket
      bucket: camera-segments
    feature_extractor:
      name: passthrough_extractor
      version: v1
      field_passthrough: []
    enabled: true
  - name: segments-analysis
    namespace: rtsp-live-monitoring
    description: "Multimodal embeddings of the segments an alert sent here, and the corpus the admission gate searches, so the gate sharpens as matched footage accrues. Feeds similar-segments, segment-search, analysis-monitor, matched-analysis."
    source:
      type: bucket
      bucket: camera-segments
    feature_extractor:
      name: multimodal_extractor
      version: v2
      input_mappings:
        video: segment
      field_passthrough: []
    alert_applications:
      - alert: matched-analysis
        input_mappings:
          - input_key: marker
            source: {source_type: constant, value: "ingest"}
    enabled: true
retrievers:
  - name: similar-segments
    namespace: rtsp-live-monitoring
    description: "The admission gate: embeds a captured segment and searches the analysed footage for its nearest match."
    collections:
      - segments-analysis
    input_schema:
      segment:
        type: video
        required: true
        description: "The media to match; encoded by the index below and compared against it"
    stages:
      - stage_name: search
        stage_id: feature_search
        parameters:
          searches:
            - feature_uri: "mixpeek://multimodal_extractor@v2/gemini-embedding-2"
              query:
                input_mode: content
                value: "{{INPUT.segment}}"
              top_k: 25
          fusion: rrf
          final_top_k: 25
    tags:
      - template:rtsp-live-monitoring
  - name: segment-search
    namespace: rtsp-live-monitoring
    description: "Type what you are looking for, for example 'yellow taxi', and search the analysed footage. The analyst's entry point after an alert."
    collections:
      - segments-analysis
    input_schema:
      query:
        type: text
        required: true
        description: "What to look for; searched across every index below"
    stages:
      - stage_name: search
        stage_id: feature_search
        parameters:
          searches:
            - feature_uri: "mixpeek://multimodal_extractor@v2/gemini-embedding-2"
              query:
                input_mode: text
                value: "{{INPUT.query}}"
              top_k: 10
          fusion: rrf
          final_top_k: 10
    tags:
      - template:rtsp-live-monitoring
  - name: match-monitor
    namespace: rtsp-live-monitoring
    description: "Alert 1's discriminator. It reads the bucket itself, where an object is searchable the moment it lands, and keeps the arriving object when the gate judged it and the verdict cleared 0.5. Materialises into matched-footage."
    collections:
      - camera-segments
    input_schema:
      captured_at:
        type: text
        required: true
        description: "captured_at of the arriving object, supplied by the alert attachment"
    stages:
      - stage_name: verdict_filter
        config:
          stage_id: attribute_filter
          parameters:
            conditions:
              AND:
                - field: captured_at
                  operator: eq
                  value: "{{INPUT.captured_at}}"
                - field: gate_applied
                  operator: eq
                  value: true
                - field: gate_top_score
                  operator: gte
                  value: 0.5
    tags:
      - template:rtsp-live-monitoring
  - name: match-control
    namespace: rtsp-live-monitoring
    description: "The same filter at a bar nothing clears. An alert on this staying silent is what makes a firing on match-monitor mean something. Materialises into matched-footage-control."
    collections:
      - camera-segments
    input_schema:
      captured_at:
        type: text
        required: true
        description: "captured_at of the arriving object, supplied by the alert attachment"
    stages:
      - stage_name: verdict_filter
        config:
          stage_id: attribute_filter
          parameters:
            conditions:
              AND:
                - field: captured_at
                  operator: eq
                  value: "{{INPUT.captured_at}}"
                - field: gate_applied
                  operator: eq
                  value: true
                - field: gate_top_score
                  operator: gte
                  value: 0.99
    tags:
      - template:rtsp-live-monitoring
  - name: unjudged-monitor
    namespace: rtsp-live-monitoring
    description: "Segments the gate could not judge. On a new namespace the corpus is empty, so the first segments arrive unjudged and this carries them into analysis; once the corpus exists it goes quiet. Materialises into unjudged-footage."
    collections:
      - camera-segments
    input_schema:
      captured_at:
        type: text
        required: true
        description: "captured_at of the arriving object, supplied by the alert attachment"
    stages:
      - stage_name: verdict_filter
        config:
          stage_id: attribute_filter
          parameters:
            conditions:
              AND:
                - field: captured_at
                  operator: eq
                  value: "{{INPUT.captured_at}}"
                - field: gate_applied
                  operator: eq
                  value: false
    tags:
      - template:rtsp-live-monitoring
  - name: analysis-monitor
    namespace: rtsp-live-monitoring
    description: "Alert 2's discriminator, on the analysis collection. A segment that decomposed into more than one scene had motion inside the captured window. Materialises into matched-analysis."
    collections:
      - segments-analysis
    input_schema:
      marker:
        type: text
        required: false
        description: "Constant supplied by the alert attachment; the filter is what selects"
    stages:
      - stage_name: verdict_filter
        config:
          stage_id: attribute_filter
          parameters:
            conditions:
              AND:
                - field: start_time
                  operator: gt
                  value: 0
    tags:
      - template:rtsp-live-monitoring
  - name: recent-segments
    namespace: rtsp-live-monitoring
    description: "Every kept segment, newest first in the index. The health watch runs this because it needs no input, so an error or a slow run means the wall itself is unwell. Materialises into wall-health-watch."
    collections:
      - segments-index
    input_schema:
      limit:
        type: text
        required: false
        description: "Optional cap on documents grouped per run"
    stages:
      - stage_name: verdict_filter
        config:
          stage_id: attribute_filter
          parameters:
            conditions:
              AND:
                - field: segment_index
                  operator: gte
                  value: 0
    tags:
      - template:rtsp-live-monitoring
alerts:
  - name: matched-footage
    namespace: rtsp-live-monitoring
    description: "Alert 1. Fires as an object lands carrying a verdict that cleared the bar, emails the org notifications address (Settings -> Notifications; unset means opted out) and batches the object into segments-analysis."
    source: retriever
    retriever: match-monitor
    trigger_on: results
    notification_config:
      channels:
        - channel_type: email
        - channel_type: batch
          config:
            collection_id: segments-analysis
      include_matches: true
      include_scores: true
    enabled: true
  - name: matched-footage-control
    namespace: rtsp-live-monitoring
    description: "Control for alert 1: the same filter at a bar nothing clears. Quiet is healthy, and quiet next to a firing matched-footage is the proof the alert discriminates."
    source: retriever
    retriever: match-control
    trigger_on: results
    notification_config:
      channels:
        - channel_type: email
      include_matches: true
      include_scores: true
    enabled: true
  - name: unjudged-footage
    namespace: rtsp-live-monitoring
    description: "Carries footage the gate could not judge into analysis rather than leaving it unanalysed. This seeds the gate's corpus on a new namespace and goes quiet once the gate has something to search."
    source: retriever
    retriever: unjudged-monitor
    trigger_on: results
    notification_config:
      channels:
        - channel_type: batch
          config:
            collection_id: segments-analysis
      include_matches: true
      include_scores: false
    enabled: true
  - name: matched-analysis
    namespace: rtsp-live-monitoring
    description: "Alert 2. Fires when analysed footage lands that broke into more than one scene, which means something moved inside the captured window."
    source: retriever
    retriever: analysis-monitor
    trigger_on: results
    notification_config:
      channels:
        - channel_type: email
      include_matches: true
      include_scores: true
    enabled: true
triggers:
  - name: wall-health-watch
    namespace: rtsp-live-monitoring
    description: "Scheduled watch: runs recent-segments every 5 minutes and emails when the run errors or breaches the latency bound. An empty result is healthy before a camera is added and never pages."
    action_type: retriever_execution
    trigger_type: interval
    schedule_config:
      interval_seconds: 300
    action_config:
      retriever: recent-segments
      inputs: {}
      skip_cache: true
      acceptance:
        max_total_time_ms: 15000
        max_stage_latency_breaches: 0
      notification_config:
        channels:
          - channel_type: email
        notify_on: failure

# Plan 11.14: two public-domain films stand in for camera segments, ingested by
# one bounded batch after apply, and the use case they must satisfy.
seed:
  - bucket: camera-segments
    max_objects: 2
    objects:
      - blobs: {segment: samples/starter/videos/norelco-speed.mp4}
      - blobs: {segment: samples/starter/videos/mexican-hat-dance.mp4}
acceptance:
  max_cost_usd: 0.5
  steps:
    - name: segments-listed
      kind: documents
      collection: segments-index
      expect: {min_documents: 2}
    - name: segments-analysed
      kind: documents
      collection: segments-analysis
      expect: {min_documents: 2}
    - name: segment-search-answers
      kind: query
      retriever: segment-search
      inputs: {query: people dancing}
      expect: {min_results: 1}
```

## Hand it to an agent

Paste this prompt into Claude Code, Cursor or another coding agent. To give the agent this whole page instead, use **Copy page** in the menu at the top of the page, or point it at the page's Markdown at `https://mixpeek.com/docs/templates/rtsp-live-monitoring.md`.

```text Prompt theme={null}
Set up the Mixpeek "RTSP Live Monitoring Wall" template in my organization. My API key is in MIXPEEK_API_KEY.
1. Download https://mixpeek.com/templates/rtsp-live-monitoring.namespace.yaml to rtsp-live-monitoring.namespace.yaml.
2. POST it to https://api.mixpeek.com/v1/manifest/validate as the multipart field manifest_file, with the header Authorization: Bearer $MIXPEEK_API_KEY. Fix every entry in errors and validate again.
3. POST the same file to https://api.mixpeek.com/v1/manifest/apply?wait_for_seed=true. Every entry in resources should be created.
4. GET https://api.mixpeek.com/v1/namespaces/rtsp-live-monitoring and keep namespace_id. Send it as the X-Namespace header on every call below.
5. POST {"inputs": {"query": "people dancing"}} to https://api.mixpeek.com/v1/retrievers/segment-search/execute. Read documents, check that status is completed, and print warnings.
Reference for this template: https://mixpeek.com/docs/templates/rtsp-live-monitoring.md
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.