Secure RTSP Streaming for SBCs with MediaMTX & FFMPEG
Developed by DeMoD LLC
Transform your Single-Board Computer (SBC) into a professional-grade IP camera system. Stream USB webcam feeds over RTSP using FFMPEG and MediaMTX, with support for multi-camera setups, secure authentication, and broad SBC compatibility.
| Feature | Description |
|---|---|
| Multi-Camera Support | Configure unlimited cameras via JSONC with per-camera auth |
| Secure Auth | RTSP basic auth with env: variable support (no plaintext passwords) |
| SBC-Optimized | ARM 32/64-bit, RISC-V, x86-64 — auto-detected binaries |
| Security-First | SHA256 verification, firewall config, non-root execution |
| Three Interfaces | CLI (start.sh), TUI (security_checker.py), Web UI (config.py) |
| Security Rating | 0–100 score with automated + user checks |
| GPL v3 Licensed | Fully open source — all improvements stay free |
| OS Family | Package Manager | Firewall |
|---|---|---|
| Debian-like | apt |
ufw |
| Fedora-like | dnf |
firewalld |
| Architecture | MediaMTX Binary |
|---|---|
| ARM 64-bit (aarch64) | arm64 |
| ARM 32-bit (armv7l) | armv7 |
| RISC-V 64-bit | riscv64 |
| x86-64 | amd64 |
Works on: Raspberry Pi, Orange Pi, VisionFive, Intel NUC, etc.
Recommended Operating Systems & SBCs
Choose your stack based on architecture, power, latency, and processing needs.
All are fully validated with DeMoD Camera Setup.
| Spec | Value |
|---|---|
| CPU | Intel Core i5-1340P (12 cores, up to 4.6 GHz) |
| GPU | Intel Iris Xe (96 EU) — Quick Sync Video |
| RAM | Up to 64 GB LPDDR5 |
| Encoding | 8+ 4K@30fps streams via -c:v h264_qsv |
| Latency | <25ms with PREEMPT_RT |
| Power | ~45–80W under full load |
Pro Setup:
# 1. Flash ArchibaldOS x86_64 to LattePanda Sigma # 2. Run: ./setup.sh # Auto-detects x86_64 + Quick SyncUse
config.py→ enable Quick Sync in FFMPEG:"runOnInit": "ffmpeg -hwaccel qsv -i {device} -c:v h264_qsv -b:v 12M ..."
| Arch | PREEMPT_RT Status | Notes |
|---|---|---|
aarch64 |
Custom patched | ArchibaldOS provides SBC-tuned semi or full RT kernel when possible |
x86_64 |
Mainline + enhanced | ArchibaldOS adds I/O scheduling, beats Fedora on NUCs |
riscv64 |
Experimental | Avoid for hard real-time |
Pro Tip: On LattePanda Sigma, pair with 240W USB-C PD for sustained max performance.
- Linux SBC with
v4l2webcam support - USB webcam(s)
- Internet access (for MediaMTX download)
- Python 3.6+
# 1. Clone or download the repository
git clone https://github.com/demod-llc/camera-setup.git
cd camera-setup
# 2. Make scripts executable
chmod +x setup.sh start.sh
# 3. Run setup (use sudo if prompted)
./setup.sh- Select OS type (Debian/Fedora)
- Select architecture
- Installs:
v4l-utils,wget,tar,python3 - Adds user to
videogroup - Downloads MediaMTX v1.13.1 with SHA256 verification
- Opens port 8554/TCP in firewall
- Optional: Run security checker
./start.sh- Detects webcams
- Prompts for auth (recommended)
- Starts stream at:
rtsp://<ip>:8554/cam
python3 config.pyOpen browser: http://:8000
- Paste multi-camera JSONC
- Or configure single camera via form
- Live security rating
- Start/stop server with one click
Secure by default: Web UI binds to
127.0.0.1. Use reverse proxy for remote access.
python3 security_checker.py- Guided security audit
- Fix issues interactively
- Supports JSONC multi-cam
- Final security score
rtsp://<ip>:8554/cam0
rtsp://user:pass@<ip>:8554/cam1
Test locally:
ffplay rtsp://localhost:8554/cam0Never commit plaintext passwords. Always use
env:VAR_NAME.
crontab -e@reboot /home/user/camera-setup/start.shCreate /etc/systemd/system/demod-camera.service:
[Unit]
Description=DeMoD Camera RTSP Server
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/camera-setup
ExecStart=/usr/bin/python3 config.py
Restart=always
Environment=RTSP_PASS_CAM0=your-secret-here
[Install]
WantedBy=multi-user.targetEnable:
sudo systemctl enable --now demod-camera.service| Practice | Command |
|---|---|
| Use env vars | export RTSP_PASS_CAM0=strongpass |
| Run as non-root | Avoid sudo for start.sh |
| Restrict web UI | Keep 127.0.0.1:8000 or use VPN |
| Enable firewall | Only 8554/TCP open by default |
| Use TLS (optional) | Reverse proxy with Caddy/Nginx |
camera.demod.ltd {
reverse_proxy localhost:8000
basicauth {
user JDJhJDEyJ...
}
}| Issue | Solution |
|---|---|
No webcam detected |
ls /dev/video* or v4l2-ctl --list-devices |
Checksum failed |
Retry ./setup.sh — network issue |
JSONC error |
Validate syntax; use sample |
Stream not playing |
Test with ffplay locally |
High CPU |
Lower bitrate or framerate |
.
├── setup.sh → Installs deps + MediaMTX
├── start.sh → CLI single-cam setup
├── config.py → Web UI (http://:8000)
├── security_checker.py → TUI security audit
├── utils.py → Shared logic
├── config.jsonc.example → Multi-cam template
├── mediamtx → Binary (after setup)
└── mediamtx.yml → Generated config
We welcome contributions!
- Fork and submit a Pull Request
- All code must be GPL v3
- Include copyright header
- Test on real hardware
GNU General Public License v3.0 (GPL-3.0)
Copyright (C) 2025 DeMoD LLC
See LICENSE for full text.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License.
For enterprise support, consulting, or custom integrations:
Contact: DeMoD LLC
DeMoD Camera Setup — Secure. Simple. Scalable.
Let me know if you'd like:
- A GitHub Actions CI workflow
- Docker image
- NixOS module
- Home Assistant integration
- Hardware guide
{ // Multi-camera example "cams": [ { "device": "/dev/video0", "framerate": 30, "bitrate": "800k", "auth": { "user": "admin", "pass": "env:RTSP_PASS_CAM0" // Set via: export RTSP_PASS_CAM0=secret } }, { "device": "/dev/video1", "framerate": 25, "bitrate": "600k" // No auth = public stream } ] }