# NVR Test Camera (RTSP Test Pattern Generator)

Serves 1-4 RTSP test streams using mediamtx + ffmpeg. Each stream is a
labeled test pattern with timestamp overlay at configurable resolution.

## Quick Start

```bash
docker run --rm --network host dividia/nvr-testcam
```

Streams available at:
- `rtsp://HOST:8554/cam1` (1920x1080, 15fps, "Front Door")
- `rtsp://HOST:8554/cam2` (1920x1080, 15fps, "Parking Lot")
- `rtsp://HOST:8554/cam3` (1280x720, 15fps, "Loading Dock")
- `rtsp://HOST:8554/cam4` (1280x720, 10fps, "Office")

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `NUM_STREAMS` | 4 | Number of test streams (1-4) |
| `RTSP_PORT` | 8554 | RTSP listen port |

## NVR Camera Configuration

Add cameras in the NVR web UI (Setup > Cameras) with:
- **Path**: `rtsp://127.0.0.1:8554/cam1` (through cam4)
- **Record Type**: `motion` (produces vmd_type internal for recording)

Or via database:
```sql
INSERT INTO Device (sPath, sRecordType, fEnable)
VALUES ('rtsp://127.0.0.1:8554/cam1', 'motion', 1);
```

## Running on Windows (WSL2)

Inside WSL2 alongside NVR containers (both use network_mode: host):
```bash
wsl -d Ubuntu -- docker run -d --rm --network host --name testcam dividia/nvr-testcam
```

From Windows:
```
nvr shell backend
# then inside the container, configure cameras via RPC or DB
```

## Build & Push

```bash
cd docker/testcam/
docker build -t dividia/nvr-testcam:latest .
docker push dividia/nvr-testcam:latest
```
