1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 | # cribd
`cribd` turns one RTSP camera stream into browser-friendly WebRTC for a local, private baby monitor. [MediaMTX](https://github.com/bluenviron/mediamtx) handles the media path; optional hardware adapters can provide camera-specific events without putting vendor logic in the server.
> [!WARNING]
> This project is not a medical device or a substitute for safe-sleep practices, direct supervision, or any medically indicated monitor.
## Status
The current prototype runs on an Apple silicon Mac, serves one stream through MediaMTX's built-in viewer, and is loopback-only by default. It can also serve devices on the same local network. Custom viewers, event adapters, remote access, persistence, and Raspberry Pi deployment come later.
## Run locally
Requires macOS 26 on Apple silicon, Apple's [`container`](https://github.com/apple/container) CLI 1.0 or later, and an RTSP camera.
```sh
cp .env.example .env
# Set CRIBD_RTSP_URL in .env.
./bin/cribd
```
Open `http://localhost:8889/crib`. Use H.264 video with Opus, G722, PCMA, or PCMU audio for WebRTC playback.
To view from another device, use the Mac's LAN IPv4 address—not the camera's:
```sh
CRIBD_HOST=192.168.1.10 ./bin/cribd
```
Then open `http://192.168.1.10:8889/crib` from a device on the same network.
The launcher runs MediaMTX 1.20.0 and binds its WebRTC ports to the selected address. Docker and Docker Compose are not required; `docker.io` is only the OCI image registry.
## Architecture
```text
camera -> RTSP -> cribd/MediaMTX -> WebRTC -> viewer
camera -> vendor event API -> optional adapter -> generic events -> cribd
```
The media path is required and independent of adapters. Adapter failures must never interrupt video or audio.
### Core
- Configure the camera as MediaMTX path `/crib`.
- Route RTSP media to WebRTC and reconnect after interruptions.
- Report camera, stream, and server health.
- Accept generic events when an adapter is configured.
### Optional hardware adapter
- Authenticate with the camera's event API.
- Subscribe and reconnect independently of the media path.
- Discover capabilities such as motion or crying.
- Translate vendor data into generic events.
The core does not know how Reolink or another vendor delivers events. Without an adapter, event features are unavailable.
## Constraints
- Local viewing must work without public internet access.
- Stream failures and frozen frames must become obvious within seconds.
- The stack must recover after camera, process, or power interruptions.
- Camera and adapter credentials remain on the home server.
- Nothing is exposed directly to the public internet.
- Remote access will use Tailscale identity and device authorization.
## Roadmap
1. Prove RTSP to MediaMTX to browser WebRTC on a Mac.
2. Add the viewer, health reporting, and explicit offline states.
3. Test a dedicated camera, night vision, audio, and restart recovery.
4. Move the stack to a Raspberry Pi and add automatic startup.
5. Add Tailscale, define the event interface, and build a Reolink adapter.
## License
Licensed under the [MIT License](LICENSE).
|