{"id":30104087,"url":"https://github.com/alh477/demod-camera-setup-script","last_synced_at":"2026-04-19T14:33:51.435Z","repository":{"id":307213415,"uuid":"1028735101","full_name":"ALH477/DeMoD-Camera-Setup-Script","owner":"ALH477","description":"I am building my own PoE IP cams and I wanted to show up the lame ass SWEs at brand name IP cam companies. Use my script to make your own cameras for cheaper, so you don't need to use Internet Explorer compatibility mode. WHY DO THEY EVEN DO THAT, IT IS DISGUSTING AND APISH.","archived":false,"fork":false,"pushed_at":"2025-07-30T02:14:32.000Z","size":289,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T03:56:23.281Z","etag":null,"topics":["apt","bash","bash-script","camera","debian-packages","ffmpeg","gnu","ip","mediamtx","python","python-script","security","ufw"],"latest_commit_sha":null,"homepage":"https://DeMoD.ltd","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ALH477.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security_checker.py","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-30T01:46:11.000Z","updated_at":"2025-07-30T02:40:09.000Z","dependencies_parsed_at":"2025-07-30T03:56:24.715Z","dependency_job_id":"feacbe1e-eafd-47f9-8b55-476f776d6125","html_url":"https://github.com/ALH477/DeMoD-Camera-Setup-Script","commit_stats":null,"previous_names":["alh477/demod-camera-setup-script"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ALH477/DeMoD-Camera-Setup-Script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALH477%2FDeMoD-Camera-Setup-Script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALH477%2FDeMoD-Camera-Setup-Script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALH477%2FDeMoD-Camera-Setup-Script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALH477%2FDeMoD-Camera-Setup-Script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ALH477","download_url":"https://codeload.github.com/ALH477/DeMoD-Camera-Setup-Script/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALH477%2FDeMoD-Camera-Setup-Script/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269646949,"owners_count":24453101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apt","bash","bash-script","camera","debian-packages","ffmpeg","gnu","ip","mediamtx","python","python-script","security","ufw"],"created_at":"2025-08-09T22:14:38.813Z","updated_at":"2026-04-19T14:33:51.416Z","avatar_url":"https://github.com/ALH477.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeMoD Camera Setup  \n**Secure RTSP Streaming for SBCs with MediaMTX \u0026 FFMPEG**\n\n![DeMoD LLC](https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Sierpinski-Trigon-7.svg/200px-Sierpinski-Trigon-7.svg.png)  \n*Developed by [DeMoD LLC](https://demod.ltd)*\n\n---\n\nTransform 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**.\n\n---\n\n## Features\n\n| Feature | Description |\n|-------|-------------|\n| **Multi-Camera Support** | Configure unlimited cameras via JSONC with per-camera auth |\n| **Secure Auth** | RTSP basic auth with `env:` variable support (no plaintext passwords) |\n| **SBC-Optimized** | ARM 32/64-bit, RISC-V, x86-64 — auto-detected binaries |\n| **Security-First** | SHA256 verification, firewall config, non-root execution |\n| **Three Interfaces** | CLI (`start.sh`), TUI (`security_checker.py`), Web UI (`config.py`) |\n| **Security Rating** | 0–100 score with automated + user checks |\n| **GPL v3 Licensed** | Fully open source — all improvements stay free |\n\n---\n\n## Supported Platforms\n\n| OS Family | Package Manager | Firewall |\n|----------|------------------|----------|\n| Debian-like | `apt` | `ufw` |\n| Fedora-like | `dnf` | `firewalld` |\n\n| Architecture | MediaMTX Binary |\n|--------------|-----------------|\n| ARM 64-bit (aarch64) | `arm64` |\n| ARM 32-bit (armv7l) | `armv7` |\n| RISC-V 64-bit | `riscv64` |\n| x86-64 | `amd64` |\n\n\u003e Works on: Raspberry Pi, Orange Pi, VisionFive, Intel NUC, etc.\n---\n\u003e **Recommended Operating Systems \u0026 SBCs**  \n\u003e Choose your stack based on **architecture**, **power**, **latency**, and **processing needs**.  \n\u003e All are **fully validated** with DeMoD Camera Setup.\n\n| OS | Architecture | SBC Example | Power | Real-Time Kernel | Best For | Link |\n|----|--------------|-------------|-------|------------------|----------|------|\n| **ArchibaldOS** | `aarch64`, `x86_64` | **LattePanda Sigma** (i5-1340P) | Low (~5W ARM) / **High (~45–80W x86)** | **PREEMPT_RT** (cross-arch patched) | **Top Universal Choice**\u003cbr\u003eARM (edge) + x86 (max power) | [![ArchibaldOS](https://img.shields.io/badge/ArchibaldOS-ALH477/ArchibaldOS-2ea44f?style=flat\u0026logo=linux)](https://github.com/ALH477/ArchibaldOS) |\n| **Raspberry Pi OS (64-bit)** | `aarch64` | Raspberry Pi 5 | Low (~6W) | `PREEMPT` | Easy Pi setup, GUI | [![Raspberry Pi OS](https://img.shields.io/badge/Raspberry%20Pi%20OS-64bit-C51A4A?style=flat\u0026logo=raspberry-pi)](https://www.raspberrypi.com/software/) |\n| **Armbian** | `aarch64`, `armv7`, `riscv64` | Orange Pi 5 | Low (~4–8W) | `PREEMPT` or `PREEMPT_RT` | Broad SBC support | [![Armbian](https://img.shields.io/badge/Armbian-Minimal-2185D0?style=flat\u0026logo=linux)](https://www.armbian.com) |\n| **Fedora Minimal** | `x86_64` | Intel NUC 13 | High (~15–30W) | **PREEMPT_RT** (`kernel-rt`) | High-performance x86 | [![Fedora](https://img.shields.io/badge/Fedora-Minimal%20(x86_64)-294172?style=flat\u0026logo=fedora)](https://fedoraproject.org/coreos/download?tab=metal_virtualized) |\n\n---\n\n### **Maximum Power: LattePanda Sigma + ArchibaldOS**\n\n| Spec | Value |\n|------|-------|\n| **CPU** | Intel Core **i5-1340P** (12 cores, up to **4.6 GHz**) |\n| **GPU** | Intel Iris Xe (96 EU) — **Quick Sync Video** |\n| **RAM** | Up to **64 GB** LPDDR5 |\n| **Encoding** | **8+ 4K@30fps streams** via `-c:v h264_qsv` |\n| **Latency** | **\u003c25ms** with PREEMPT_RT |\n| **Power** | **~45–80W** under full load |\n\n\u003e **Pro Setup**:\n\u003e ```bash\n\u003e # 1. Flash ArchibaldOS x86_64 to LattePanda Sigma\n\u003e # 2. Run:\n\u003e ./setup.sh  # Auto-detects x86_64 + Quick Sync\n\u003e ```\n\u003e Use `config.py` → enable **Quick Sync** in FFMPEG:\n\u003e ```json\n\u003e \"runOnInit\": \"ffmpeg -hwaccel qsv -i {device} -c:v h264_qsv -b:v 12M ...\"\n\u003e ```\n\n---\n\n### **Real-Time Kernel Nuances**\n\n| Arch | PREEMPT_RT Status | Notes |\n|------|-------------------|-------|\n| `aarch64` | Custom patched | ArchibaldOS provides **SBC-tuned semi or full RT kernel when possible** |\n| `x86_64` | Mainline + enhanced | ArchibaldOS adds **I/O scheduling**, beats Fedora on NUCs |\n| `riscv64` | Experimental | Avoid for hard real-time |\n\n---\n\n\u003e **Pro Tip**: On **LattePanda Sigma**, pair with **240W USB-C PD** for sustained max performance.\n\n---\n\n## Requirements\n\n- Linux SBC with `v4l2` webcam support\n- USB webcam(s)\n- Internet access (for MediaMTX download)\n- Python 3.6+\n\n---\n\n## Installation\n\n```bash\n# 1. Clone or download the repository\ngit clone https://github.com/demod-llc/camera-setup.git\ncd camera-setup\n\n# 2. Make scripts executable\nchmod +x setup.sh start.sh\n\n# 3. Run setup (use sudo if prompted)\n./setup.sh\n```\n\n### Setup Flow:\n1. Select OS type (Debian/Fedora)\n2. Select architecture\n3. Installs: `v4l-utils`, `wget`, `tar`, `python3`\n4. Adds user to `video` group\n5. Downloads **MediaMTX v1.13.1** with **SHA256 verification**\n6. Opens **port 8554/TCP** in firewall\n7. Optional: Run security checker\n\n---\n\n## Usage\n\n### 1. **Quick Start (Single Camera)**\n\n```bash\n./start.sh\n```\n\n- Detects webcams  \n- Prompts for auth (recommended)  \n- Starts stream at: `rtsp://\u003cip\u003e:8554/cam`\n\n---\n\n### 2. **Web Configuration (Recommended)**\n\n```bash\npython3 config.py\n```\n\nOpen browser: [http://\u003csbc-ip\u003e:8000](http://localhost:8000)\n\n- Paste **multi-camera JSONC**  \n- Or configure **single camera** via form  \n- Live **security rating**  \n- Start/stop server with one click\n\n\u003e **Secure by default**: Web UI binds to `127.0.0.1`. Use reverse proxy for remote access.\n\n---\n\n### 3. **TUI Security \u0026 Config**\n\n```bash\npython3 security_checker.py\n```\n\n- Guided security audit  \n- Fix issues interactively  \n- Supports JSONC multi-cam  \n- Final security score\n\n---\n\n## Stream URLs\n\n```text\nrtsp://\u003cip\u003e:8554/cam0\nrtsp://user:pass@\u003cip\u003e:8554/cam1\n```\n\nTest locally:\n```bash\nffplay rtsp://localhost:8554/cam0\n```\n\n---\n\n## Multi-Camera Configuration (`config.jsonc`)\n\n```jsonc\n{\n  // Multi-camera example\n  \"cams\": [\n    {\n      \"device\": \"/dev/video0\",\n      \"framerate\": 30,\n      \"bitrate\": \"800k\",\n      \"auth\": {\n        \"user\": \"admin\",\n        \"pass\": \"env:RTSP_PASS_CAM0\"  // Set via: export RTSP_PASS_CAM0=secret\n      }\n    },\n    {\n      \"device\": \"/dev/video1\",\n      \"framerate\": 25,\n      \"bitrate\": \"600k\"\n      // No auth = public stream\n    }\n  ]\n}\n```\n\n\u003e **Never commit plaintext passwords.** Always use `env:VAR_NAME`.\n\n---\n\n## Auto-Start on Boot\n\n### Option 1: Simple (Single Camera)\n```bash\ncrontab -e\n```\n```cron\n@reboot /home/user/camera-setup/start.sh\n```\n\n### Option 2: Systemd Service (Multi-Camera / Web UI)\n\nCreate `/etc/systemd/system/demod-camera.service`:\n```ini\n[Unit]\nDescription=DeMoD Camera RTSP Server\nAfter=network.target\n\n[Service]\nType=simple\nUser=youruser\nWorkingDirectory=/home/youruser/camera-setup\nExecStart=/usr/bin/python3 config.py\nRestart=always\nEnvironment=RTSP_PASS_CAM0=your-secret-here\n\n[Install]\nWantedBy=multi-user.target\n```\n\nEnable:\n```bash\nsudo systemctl enable --now demod-camera.service\n```\n\n---\n\n## Security Best Practices\n\n| Practice | Command |\n|--------|---------|\n| **Use env vars** | `export RTSP_PASS_CAM0=strongpass` |\n| **Run as non-root** | Avoid `sudo` for `start.sh` |\n| **Restrict web UI** | Keep `127.0.0.1:8000` or use VPN |\n| **Enable firewall** | Only 8554/TCP open by default |\n| **Use TLS (optional)** | Reverse proxy with Caddy/Nginx |\n\n### Recommended: TLS + Auth (Caddy Example)\n\n```caddy\ncamera.demod.ltd {\n    reverse_proxy localhost:8000\n    basicauth {\n        user JDJhJDEyJ...\n    }\n}\n```\n\n---\n\n## Troubleshooting\n\n| Issue | Solution |\n|------|----------|\n| `No webcam detected` | `ls /dev/video*` or `v4l2-ctl --list-devices` |\n| `Checksum failed` | Retry `./setup.sh` — network issue |\n| `JSONC error` | Validate syntax; use sample |\n| `Stream not playing` | Test with `ffplay` locally |\n| `High CPU` | Lower `bitrate` or `framerate` |\n\n---\n\n## Project Structure\n\n```\n.\n├── setup.sh              → Installs deps + MediaMTX\n├── start.sh              → CLI single-cam setup\n├── config.py             → Web UI (http://:8000)\n├── security_checker.py   → TUI security audit\n├── utils.py              → Shared logic\n├── config.jsonc.example  → Multi-cam template\n├── mediamtx              → Binary (after setup)\n└── mediamtx.yml          → Generated config\n```\n\n---\n\n## Contributing\n\nWe welcome contributions!  \n- Fork and submit a **Pull Request**  \n- All code must be **GPL v3**  \n- Include copyright header  \n- Test on real hardware\n\n---\n\n## License\n\n```\nGNU General Public License v3.0 (GPL-3.0)\nCopyright (C) 2025 DeMoD LLC\n```\n\nSee [`LICENSE`](LICENSE) for full text.\n\n\u003e This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License.\n\n---\n\n## Support\n\nFor enterprise support, consulting, or custom integrations:\n\n**Contact**: [DeMoD LLC](https://demod.ltd/contact)\n\n---\n\n**DeMoD Camera Setup — Secure. Simple. Scalable.**\n\nLet me know if you'd like:\n- A **GitHub Actions CI** workflow\n- **Docker image**\n- **NixOS module**\n- **Home Assistant integration**\n- **Hardware guide**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falh477%2Fdemod-camera-setup-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falh477%2Fdemod-camera-setup-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falh477%2Fdemod-camera-setup-script/lists"}