Files
IPCam_OrangePi_Dashboard/IPCam_OrangePi_Dashboard_v2.md
T
2026-04-26 21:27:00 +07:00

199 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IPCam Orange Pi Dashboard (Updated)
## 1. Overview
IPCam Orange Pi Dashboard is a lightweight web-based surveillance system built on top of MediaMTX.
The system is designed for:
- Orange Pi (low-resource hardware)
- Multiple IP cameras (410 cams)
- No AI processing (unlike Frigate)
- Full control via MediaMTX Control API
---
## 2. Architecture
### Components
- IP Cameras (RTSP - H264 recommended)
- MediaMTX (stream proxy + recorder + API)
- Dashboard Backend (scheduler + API)
- Dashboard Frontend (live view + playback UI)
### Data Flow
Camera → MediaMTX → WebRTC → Dashboard
Camera → MediaMTX → Recording (fMP4) → Storage → Playback UI
---
## 3. Core Features
### 3.1 Live View
- Grid layout (1 / 4 / 9 cameras)
- WebRTC streaming (low latency)
- Auto reconnect
- Lazy loading streams
### 3.2 Playback
- List recordings by:
- Camera
- Date
- Play fMP4 files via HTML5 video
- File-based playback (no timeline initially)
### 3.3 Camera Management
- Add/remove camera (update MediaMTX config)
- Reload MediaMTX if needed
### 3.4 Recording Schedule (IMPORTANT)
- Configure recording time per system:
- Weekdays: 18:00 → 08:00
- Weekend: 24h
- Implemented in Dashboard (NOT MediaMTX)
---
## 4. MediaMTX Integration
### 4.1 Endpoints
- RTSP: rtsp://<server>:8554/<path>
- WebRTC: http://<server>:8889
- API: http://<server>:9997
---
### 4.2 Control API Usage
#### Enable API
```
api: true
apiAddress: :9997
```
---
### 4.3 Toggle Recording via API
#### Enable recording
```
POST /v3/config/paths/patch
{
"paths": {
"cam1": { "record": true }
}
}
```
#### Disable recording
```
POST /v3/config/paths/patch
{
"paths": {
"cam1": { "record": false }
}
}
```
---
### 4.4 Bulk Update
```
{
"paths": {
"cam1": { "record": true },
"cam2": { "record": true },
"cam3": { "record": true },
"cam4": { "record": true }
}
}
```
---
## 5. Scheduler Design
### Logic
- Dashboard backend controls recording
- Runs every 60 seconds
### Example Logic
```
if weekend:
record = true
else:
record = (hour >= 18 or hour < 8)
```
### Implementation
- setInterval / cron job in backend
- Calls MediaMTX API
---
## 6. Storage
### Format
- fMP4 segments
### Path
```
/recordings/<camera>/<timestamp>.fmp4
```
### Notes
- Files created per segment (e.g., 5 minutes)
- Recording starts immediately when enabled
---
## 7. Technology Stack
### Backend
- Node.js (Express) or Python (FastAPI)
- Responsibilities:
- Scheduler
- MediaMTX API integration
- Recording index API
### Frontend
- HTML + JS (or React)
- WebRTC player
- Video playback UI
---
## 8. Performance Requirements
- 45 simultaneous streams
- Minimal CPU usage (no transcoding)
- Stable on Orange Pi
---
## 9. Constraints
- Browser requires H264 (NOT H265)
- WebRTC requires UDP port (8189) open
- Firewall must allow:
- 8554 (RTSP)
- 8889 (WebRTC HTTP)
- 8189/UDP (ICE)
---
## 10. Future Enhancements
- Timeline playback (merge segments)
- Multi-user authentication
- Mobile UI
- Event-based recording (optional)
---
## 11. Summary
- MediaMTX handles streaming + recording
- Dashboard handles logic + scheduling
- Recording is controlled via API (not config reload)
This architecture is optimized for simplicity, performance, and scalability on Orange Pi.