---
name: kamivision-recorder
version: 1.0.0
description: "RTSP/RTMP camera stream recording with AI-powered video search. Start/stop recording, check status, search clips by natural language, list recent events, view logs."
user-invocable: true
disable-model-invocation: false
homepage: https://kamiclaw-skill.kamihome.com
metadata: { "openclaw": { "emoji": "📹", "requires": { "bins": ["python3"], "env": [] }, "hardware": { "required": { "camera": "RTSP-compatible camera", "storage": "30GB available space" }, "optional": { "ram": "8GB minimum, 16GB recommended" } } } }
---
# Kamivision Video Recorder & Search

Record camera streams 24/7 and search footage by natural language description. Setup takes 2 minutes. Sign up at https://kamiclaw-skill.kamihome.com for 200 free credits.

## Capabilities

1. **Start recording** — launch background stream recording
2. **Stop recording** — stop background recording
3. **Check status** — view recording process status
4. **Search video** — find clips by natural language (with optional time range)
5. **List recent events** — show recent non-static video events
6. **View logs** — display recording logs

## Trigger Words

| Intent          | Trigger Words                                                             |
| --------------- | ------------------------------------------------------------------------- |
| Start recording | start record, start recording, start camera, start monitor, launch stream |
| Stop recording  | stop record, stop recording, stop camera, stop monitor, kill recording    |
| Check status    | recording status, camera status, is recording, check status               |
| Search video    | search video, find video, find clip, look for, search footage             |
| List recent     | recent events, recent clips, list events, what happened, show recent      |
| View logs       | show logs, view logs, recording logs, check logs                          |

If no trigger word matches, use semantic understanding to route to the closest intent.

## First-Time Setup

Run the setup script to create the virtual environment (Python 3.10+) and install dependencies:

```bash
bash {baseDir}/setup.sh
```

## Pre-Recording Configuration

Before EVERY recording start, confirm the Required Parameters with the user.

### Flow

1. Read config from `{baseDir}/stream_config.json`
2. Display all Required Parameters with current values
3. Ask user to confirm or update
4. Only after confirmation → start recording

### Required Parameters

#### STREAM_URL

- **Purpose**: RTSP/RTMP stream URL passed to `cv2.VideoCapture()`
- **Format**: `rtsp://username:password@IP:port/path`
- **How to get**: Check camera admin interface for RTSP URL (Hikvision: `rtsp://user:pass@ip:554/Streaming/Channels/1`, Dahua: `rtsp://user:pass@ip:554/cam/realmonitor?channel=1&subtype=0`)
- **Error behavior**: After 100 consecutive frame failures → reconnect (up to `MAX_RECONNECT` times). All retries fail → recording stops.

#### KAMI_API_KEY

- **Purpose**: Auth key for Kamivision API (`X-API-Key` header). Required for video description and search.
- **Format**: String starting with `sk_live_`
- **How to get**: Sign up at https://kamiclaw-skill.kamihome.com → API Keys → create/copy key
- **Error behavior**: Invalid key → API returns 401/403, retries up to `KAMI_API_RETRY` times. All fail → recording stops.

### Config Update

After user confirms: read config → update changed fields → write back → start recording.

## Command Execution

All commands use `.venv/bin/python` and `stream_recoder2.py` with `--config {baseDir}/stream_config.json`.

### Start Recording

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --start-daemon --log-file {baseDir}/stream_recorder.log
```

Parse JSON output: `status: "started"` → show PID; `status: "already_running"` → show PID; error → show message.

### Stop Recording

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --stop-daemon
```

### Check Status

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --status
```

### Search Video

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --search "QUERY" --json
```

With time range (format `YYYY-MM-DD_HH:MM:SS`):

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --search "QUERY" --time-start "START" --time-end "END" --json
```

Natural language time ("today morning", "yesterday afternoon") → convert to `YYYY-MM-DD_HH:MM:SS`.

### List Recent Events

```bash
{baseDir}/.venv/bin/python {baseDir}/stream_recoder2.py --config {baseDir}/stream_config.json --list HOURS --json
```

Default HOURS to 24 if not specified.

### View Logs

```bash
tail -100 {baseDir}/stream_recorder.log
```

## Privacy

For privacy policy and data handling details, visit https://kamiclaw-skill.kamihome.com/privacy

## Language

Respond in the same language the user uses.
