diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65f1f06 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 NextNVR Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 650f416..23d0544 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,38 @@ # NextNVR -A lightweight, self-hosted video recorder for IP cameras. Records 8 RTSP streams into 5-minute MP4 clips with near-zero CPU usage. Built for the **Casa Alba Mindelo** guesthouse. +A simple, single-binary IP camera recorder. Think of it as a dashcam for your property. + +--- + +## Why NextNVR? + +The open-source NVR landscape is rich with incredible projects — Frigate, Shinobi, ZoneMinder, Blue Iris alternatives — backed by passionate communities. They're powerful. They're feature-packed. But they've also become complex. Docker containers, AI pipelines, multi-service architectures, cloud integrations — for many users, it's too much. + +**NextNVR is different.** It does one thing: continuously record your IP cameras to disk and let you review the footage. No AI, no cloud, no Docker — just a single Go binary you can run on a Raspberry Pi 5, an old thin client, or a VM. Deploy it in 30 seconds with a one-liner. + +This project was built with the help of AI — designed through conversation, refined through iteration, and shaped by the simple principle that surveillance software should be boring. It should just work. --- ## Quick Install -Copy and paste this single line into your terminal: - ```bash curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash ``` -That's it. The script installs everything needed and starts NextNVR automatically. - -Once done, open the web interface in your browser (the script prints the URL). +That's it. The script installs everything and starts NextNVR automatically. --- ## Supported Systems -| Distro | Package Manager | Status | +| Distro | Package Manager | Architecture | |---|---|---| -| Debian 12+ / Ubuntu 22.04+ | `apt` | ✅ Tested | -| Fedora 40+ / RHEL 9+ | `dnf` / `yum` | ✅ | -| Arch Linux | `pacman` | ✅ | -| Alpine Linux | `apk` | ✅ | -| Other (systemd) | auto-detect | ✅ | -| Other (no systemd) | fallback to `nohup` | ✅ | - -- **ARM64** (Raspberry Pi, etc.) — auto-detected -- **Root or sudo** — handles both +| Debian 12+ / Ubuntu 22.04+ | `apt` | amd64, arm64 | +| Fedora 40+ / RHEL 9+ | `dnf` / `yum` | amd64, arm64 | +| Arch Linux | `pacman` | amd64, arm64 | +| Alpine Linux | `apk` | amd64, arm64 | +| Raspberry Pi 5 | any above | arm64 | --- @@ -38,103 +40,60 @@ Once done, open the web interface in your browser (the script prints the URL). | Feature | Detail | |---|---| -| 📹 **Recording** | 8 cameras simultaneously, 5-minute MP4 clips | -| 💾 **Storage** | Saves to `/mnt/recordings/` — keeps 18 days, auto-deletes older | -| 🖥️ **Live Wall** | 4×2 grid showing all cameras at once. Click one to enlarge. | -| 🔍 **Playback** | Browse recordings by camera and date with presets (Today, Yesterday, Last 7 Days) | -| ⚙️ **Setup Wizard** | Scans your network for cameras and helps you name them | -| 🔒 **Local Only** | Everything runs on your own hardware. No cloud, no subscriptions. | +| 📹 **Recording** | Up to 8 cameras simultaneously, 5-minute MP4 clips, zero transcoding | +| 💾 **Storage** | Flat per-camera directories, 7-day retention, auto-cleanup | +| 🖥️ **Live Wall** | 4×2 grid with auto-refreshing snapshots. Click for full live stream | +| 🔍 **Playback** | Browse recordings by camera and date with snapshot thumbnails | +| ⚙️ **Setup Wizard** | ONVIF auto-discovery scans your network and pre-fills camera details | +| 🔒 **100% Local** | Everything runs on your hardware. No cloud, no subscriptions, no telemetry | --- -### Remote Access (Optional) +## Remote Access (Optional) -To access NextNVR from outside your home network: - -1. **Dynamic DNS** — use a free provider like DuckDNS, No-IP, or Cloudflare to get a domain name (e.g. `myhouse.duckdns.org`) -2. **Port forwarding** — in your router settings, forward port `8080` to the NextNVR server - -Then access your cameras from anywhere: `http://myhouse.duckdns.org:8080` - -> ⚠️ For production use, put NextNVR behind a reverse proxy (like Zoraxy or Nginx) with HTTPS. Only port 443 needs to be forwarded — live streams are proxied through NextNVR automatically. +1. **Dynamic DNS** — use DuckDNS, No-IP, or Cloudflare for a domain name +2. **Port forwarding** — forward port `8080` to the NextNVR server +3. For production, put NextNVR behind a reverse proxy (Zoraxy, Nginx) with HTTPS --- -## Server +## Roadmap -| What | Detail | +| Feature | Status | |---|---| -| Web interface | `http://:8080` | -| Config file | `/opt/nextnvr/config.yaml` | -| Recordings | `/mnt/recordings/` | -| Logs | `sudo journalctl -u nextnvr -f` (systemd) or `tail -f /opt/nextnvr/nextnvr.log` (nohup) | +| Continuous recording (`-c copy`, zero transcoding) | ✅ Done | +| ONVIF auto-discovery + web setup wizard | ✅ Done | +| Live wall with snapshot grid + focus view | ✅ Done | +| Playback browser with date presets | ✅ Done | +| 7-day retention with auto-cleanup | ✅ Done | +| **Camera-triggered recording** (ONVIF motion/person detection events via API) | 🔜 Planned | +| **NAS/SMB storage support** (record to network share) | 🔜 Planned | +| **Multi-platform builds** (Raspberry Pi, ARM SBCs) | 🔜 Planned | -### Useful Commands +### Not Planned + +- ❌ Cloud connectivity of any kind +- ❌ AI/ML object detection (use your camera's built-in detection) +- ❌ Mobile apps (the web UI is responsive and PWA-ready) +- ❌ User authentication (put it behind a reverse proxy) + +--- + +## Server Commands ```bash -sudo systemctl status nextnvr # is it running? -sudo systemctl restart nextnvr # restart after changing config -sudo systemctl stop nextnvr # stop recording -sudo journalctl -u nextnvr -f # watch live logs +sudo systemctl status nextnvr # is it running? +sudo systemctl restart nextnvr # restart +sudo journalctl -u nextnvr -f # watch logs ``` +Config file: `/opt/nextnvr/config.yaml` +Recordings: `/mnt/recordings/` + --- -## How It Works +## License -``` -IP Cameras NextNVR Your Browser -─────────── ────────── ───────────── -192.168.1.201 ─┐ -192.168.1.202 ─┤ RTSP FFmpeg -c copy .mp4 http://192.168.1.10:8080 -192.168.1.203 ─┼──────────► (no re-encoding) ────────► Live Wall + Playback - ... ┤ 5 min segments Settings + Setup -192.168.1.209 ─┘ auto-delete >18d -``` +MIT — see [LICENSE](LICENSE) -- **Zero transcoding** — FFmpeg copies the video stream directly. CPU stays under 5%. -- **Crash-proof** — if a camera disconnects, it auto-reconnects after 5 seconds. -- **Atomic files** — recording in progress uses `.part.mp4`. Only renamed to `.mp4` when complete. No corrupted files. - ---- - -## Adding or Changing Cameras - -1. Open the web interface in your browser -2. Click the **Settings** tab -3. Click **🔍 Scan Network** to find your cameras -4. Give each camera a name and description -5. Click **💾 Save Configuration** -6. Restart: `sudo systemctl restart nextnvr` - -Or edit the config file directly: - -```bash -sudo nano /opt/nextnvr/config.yaml -sudo systemctl restart nextnvr -``` - ---- - -## Updating - -```bash -curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash -``` - -The script pulls the latest version and restarts the service automatically. - ---- - -## Troubleshooting - -| Problem | Check | -|---|---| -| Can't open the web page | Is NextNVR running? `sudo systemctl status nextnvr` | -| No cameras showing | Check `config.yaml` — are camera IPs and passwords correct? | -| Recordings not saving | Does `/mnt/recordings/` exist? Is the disk mounted? (`df -h`) | -| Disk full | Recordings older than 18 days are auto-deleted. Check `df -h /mnt/recordings` | - ---- - -Built with ❤️ in Mindelo, Portugal. 🇵🇹 +Built with ❤️ and AI in Mindelo, Portugal. 🇵🇹 diff --git a/api.go b/api.go index ed3010d..8c204a5 100644 --- a/api.go +++ b/api.go @@ -1,4 +1,7 @@ -// NextNVR v0.1.0 — API handlers +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // REST endpoints for cameras, configuration, ONVIF discovery, and status. package main diff --git a/cleaner.go b/cleaner.go index d65c264..00fdfd7 100644 --- a/cleaner.go +++ b/cleaner.go @@ -1,4 +1,7 @@ -// NextNVR v0.3.3 — Storage retention cleaner +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Purges rec_*.mp4 and snap_*.jpg files older than retention_days. // Skips latest.jpg (live wall) and rec_*.part.mp4 (in-progress recordings). package main diff --git a/config.go b/config.go index bacfb93..c1fca4c 100644 --- a/config.go +++ b/config.go @@ -1,4 +1,7 @@ -// NextNVR v0.1.0 — Configuration management +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Handles config.yaml parsing with sensible defaults package main diff --git a/go2rtc.go b/go2rtc.go index 9509b85..ac94c1f 100644 --- a/go2rtc.go +++ b/go2rtc.go @@ -1,4 +1,7 @@ -// NextNVR v0.1.0 — go2rtc child process management +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Launches and monitors go2rtc for WebRTC stream conversion. package main diff --git a/main.go b/main.go index 8b87a24..6acf9a2 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,7 @@ -// NextNVR v0.1.0 — Main entry point +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Lightweight NVR application for recording and monitoring IP cameras. package main diff --git a/onvif.go b/onvif.go index 974011c..6b476f4 100644 --- a/onvif.go +++ b/onvif.go @@ -1,4 +1,7 @@ -// NextNVR v0.3.0 — ONVIF device discovery (hybrid approach) +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // // Strategy: // 1. TCP-probe port 80 — if reachable, try ONVIF GetDeviceInformation. diff --git a/recorder.go b/recorder.go index 15df2e1..c8ad720 100644 --- a/recorder.go +++ b/recorder.go @@ -1,4 +1,7 @@ -// NextNVR v0.3.3 — FFmpeg stream recorder +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Records 5-minute segments with rec_ prefix and second-level timestamps. // Output: /mnt/recordings/{cam-name}/rec_{YYYY-MM-DD-HH-MM-SS}.mp4 package main diff --git a/server.go b/server.go index c3546ce..4095096 100644 --- a/server.go +++ b/server.go @@ -1,4 +1,7 @@ -// NextNVR v0.1.0 — HTTP server and routing +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Serves the embedded SPA and API endpoints. package main diff --git a/snapshot.go b/snapshot.go index 835529f..9f9c3bd 100644 --- a/snapshot.go +++ b/snapshot.go @@ -1,4 +1,7 @@ -// NextNVR v0.3.4 — Snapshot engine (go2rtc-based) +// NextNVR — MIT License +// Copyright (c) 2026 NextNVR Contributors +// SPDX-License-Identifier: MIT + // Fetches JPEG frames from go2rtc's already-decoded stream buffer. // go2rtc maintains persistent RTSP connections — frames are instant. // Writes latest.jpg every 1s (live wall) and snap_*.jpg every 60s (archive).