Moonfire NVR: Free and Open-Source – Install and Run a Powerful CCTV System in Minutes with Docker (Setup Guide)
Moonfire NVR, originally developed by Scott Lamb, is an open-source network video recorder designed to capture H.264-over-RTSP streams from IP cameras efficiently. It saves video frames to disk while storing metadata in a SQLite3 database, keeping CPU usage low by skipping video decoding or re-encoding.
A Raspberry Pi 2 can handle six 1080p/30fps streams with less than 10% CPU load.
The web interface offers basic functionality, such as a filterable video list and trimming tools, with an experimental live view. However, it lacks motion detection, HTTPS support, and an intuitive web-based configuration UI.
Moonfire NVR is still in early development (pre-1.0), so expect evolving formats and configurations.
It is important to note that Moonfire NVR app lacks native HTTPS/ TLS support, requiring a proxy server for secure connections.
Features
- RTSP support: Captures H.264-over-RTSP streams from IP cameras, ensuring compatibility with a wide range of devices.
- Stores video frames on spinning disks for efficient storage.
- Saves metadata in a SQLite3 database on flash storage for fast access.
- Generates
.mp4
files for any selected time range in real-time without delays. - Skips video decoding, analysis, and re-encoding to minimize resource consumption.
- Runs six 1080p/30fps streams on a Raspberry Pi 2 using less than 10% CPU.
- Provides a filterable list of video segments and trimming tools for easy management.
- Offers an experimental live view UI.
- Runs on minimal hardware like Raspberry Pi, making it a cost-effective solution.
- Future updates aim to include video analytics and advanced functionalities.
- Pre-1.0 version with evolving storage and configuration formats.
- Console-based configuration UI, with web-based setup planned for the future.
Install Moonfire NVR with Docker
In the following is the docker-compose.yml file.
version: 3
services:
moonfire-nvr:
# The `vX.Y.Z` images will work on any architecture (x86-64, arm, or
# aarch64); just pick the correct version.
image: ghcr.io/scottlamb/moonfire-nvr:v0.7.11
command: run
volumes:
# Pass through `/var/lib/moonfire-nvr` from the host.
- "/var/lib/moonfire-nvr:/var/lib/moonfire-nvr"
# Pass through `/etc/moonfire-nvr.toml` from the host.
# Be sure to create `/etc/moonfire-nvr.toml` first (see below).
# Docker will "helpfully" create a directory by this name otherwise.
- "/etc/moonfire-nvr.toml:/etc/moonfire-nvr.toml:ro"
# Pass through `/var/tmp` from the host.
# SQLite expects to be able to create temporary files in this dir, which
# is not created in Moonfire's minimal Docker image.
# See: <https://www.sqlite.org/tempfiles.html>
- "/var/tmp:/var/tmp"
# Add additional mount lines here for each sample file directory
# outside of /var/lib/moonfire-nvr, e.g.:
# - "/media/nvr:/media/nvr"
# The Docker image doesn't include the time zone database; you must mount
# it from the host for Moonfire to support local time.
- "/usr/share/zoneinfo:/usr/share/zoneinfo:ro"
# Edit this to match your `moonfire-nvr` user.
# Note that Docker will not honor names from the host here, even if
# `/etc/passwd` is passed through.
# - Be sure to run the `useradd` command below first.
# - Then run `echo $(id -u moonfire-nvr):$(id -g moonfire-nvr)` to see
# what should be filled in here.
user: UID:GID
# Uncomment this if Moonfire fails with `clock_gettime failed` (likely on
# older 32-bit hosts). <https://github.com/moby/moby/issues/40734>
# security_opt:
# - seccomp:unconfined
environment:
# Edit zone below to taste. The `:` is functional.
TZ: ":America/Los_Angeles"
RUST_BACKTRACE: 1
# docker's default log driver won't rotate logs properly, and will throw
# away logs when you destroy and recreate the container. Using journald
# solves these problems.
# <https://docs.docker.com/config/containers/logging/configure/>
logging:
driver: journald
options:
tag: moonfire-nvr
restart: unless-stopped
ports:
- "8080:8080/tcp"
License
GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007