Skip to content
项目

关于

Self-hosted camera recording and AI detection server in Rust for Windows, Linux and macOS

人工智能与机器学习

这些数字如何统计

69 星标1 复刻 +1 24小时

可以做什么

  • Live view: many cameras at once. Each tile plays fragmented-MP4 video in the browser (Media Source); a light mode sends JPEG frames instead for large grids and slow links. Corner labels (name, site, date, time) and AI detection chips on each tile. Layouts, groups, paging, full screen, a phone layout, and a Data saver mode that plays the sub stream.
  • Display mode: a full-screen page (/display) for a wall TV, an old tablet or a spare monitor that runs for weeks on its own: a grid of chosen cameras, and the camera with an alert goes big for a while (two share the screen). Clock, armed state, dimming at night, burn-in shift. It signs in with a code an admin approves, as a viewer that can only watch.
  • Streams that fit the device: apps get the best quality their device can decode: streams too big or in a codec the device can't play are converted on the graphics card (or in software when there is none).
  • Fill gaps from the camera's card: when a Reolink camera with a memory card drops off (Wi-Fi, a router restart, AmberSight restarting) and comes back, the missing part is copied from its card and shows on the timeline as recorded, marked as from the card. Per camera, off by default.

实测星标增长

24小时
+1
7天
+6
15天
+10
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

AmberSight

Self-hosted camera recording and AI detection, written in Rust.
Linux · macOS · Windows

ambersight.app · Live demo

Latest release PolyForm Noncommercial license Buy Me a Coffee

AmberSight is a self-hosted camera security and recording server written in Rust. It runs on Linux, macOS, and Windows. It ingests RTSP (and other ffmpeg-readable) camera streams, detects motion, records video segments, builds motion clips with pre/post roll, and serves a web dashboard plus a JSON API.

Step-by-step installation for Windows, macOS and Linux is in the install guide. The API for app developers is in the API guide. Stream addresses and known problems by camera brand are in the camera guide.

AmberSight live view: eight cameras with AI detections

More screenshots: Screenshots.

Screenshots

Timeline: all cameras in sync with alert markers
Timeline: every camera in sync, alerts by kind, mark and export a clip
Events: list beside the player
Events: filter chips, list beside the player, the AI's verdict
Camera settings in a side panel over the live view
Camera settings: a side panel over Live, with a live picture
Live view in the light theme
Light theme

Live view on a phone
On a phone

The cameras in these screenshots are the author's own outdoor cameras, with license plates and other identifying details blurred.

Install

Download the package for your system from the releases page, or build from source (next section). Every release has a signed SHA256SUMS list. Step-by-step instructions for every system are in the install guide.

System Package What it does
Windows 10/11, 64-bit ambersight-<version>-windows-x86_64-setup.exe Installs to C:\Program Files\AmberSight NVR, adds the "AmberSight" Windows service (starts at boot), a firewall rule for port 8090 and Start menu and desktop shortcuts. Settings and recordings go to C:\ProgramData\AmberSight.
Debian, Ubuntu, Linux Mint, Raspberry Pi OS (64-bit) ambersight_<version>_amd64.deb or _arm64.deb Add the package repository once (curl -fsSL https://huskerminion.github.io/ambersight-packages/setup.sh | sudo sh), then sudo apt update && sudo apt install ambersight; updates come with apt upgrade. Or install the file: sudo apt install ./ambersight_<version>_amd64.deb. Installs /usr/bin/ambersight, /etc/ambersight/config.toml, data in /var/lib/ambersight, a systemd service running as the user ambersight, an app menu entry, and ffmpeg.
Fedora ambersight-<version>-1.x86_64.rpm or .aarch64.rpm Add RPM Fusion first, then add the same repository (the setup script above) and sudo dnf install ambersight --allowerasing, or install the file with sudo dnf install ./ambersight-<version>-1.x86_64.rpm --allowerasing. Same layout as the .deb.
macOS and other Linux .tar.gz (Windows also has a .zip) Unpack, then run ./ambersight setup (see below).
Docker (and Unraid) ghcr.io/huskerminion/ambersight:latest (amd64 and arm64; :cuda for AI on an NVIDIA card, :openvino for AI on Intel graphics) See docs/docker.md for the run command, folders, networking and hardware decoding, or build the image from this repository. On Unraid, add the AmberSight template (unraid/README.md).

The packages need Debian 13, Ubuntu 25.04, Fedora 42 or newer (and 64-bit Raspberry Pi OS, trixie or newer). Intel Macs have no built-in AI; use an AI server or an external detector.

Once running, open http://localhost:8090. The first time, the Live page shows a Getting started checklist: add cameras (Settings > Cameras > Find cameras), get alerts on your phone, add a sign-in account, choose where recordings go (Settings > Recording), and optionally HTTPS and AI. Updating a package keeps your settings.

ambersight setup

From an unpacked .tar.gz or .zip, the program installs itself:

./ambersight setup               # for you only (macOS, Linux)
sudo ./ambersight setup --system # for the whole computer, starts at boot
./ambersight setup --uninstall   # removes it; settings and recordings stay

On Windows run ambersight.exe setup in an Administrator terminal. Setup copies the program, creates config.toml from the starter settings (an existing file is never overwritten), installs and starts the service, opens the firewall port on Windows (on Linux it prints the command if ufw or firewalld is on), adds a shortcut and opens the page. Other options: --here (keep the program and config where they are), --dry-run (only print the plan) and --no-browser. Use the same --system or --here with --uninstall.

System Program Settings and data
macOS ~/Applications/AmberSight ~/Library/Application Support/AmberSight
macOS --system /Applications/AmberSight /Library/Application Support/AmberSight
Linux ~/.local/share/ambersight ~/.config/ambersight, data in ~/.local/share/ambersight/data
Linux --system /opt/ambersight /etc/ambersight/config.toml, data in /var/lib/ambersight

ffmpeg

  • Windows and macOS: nothing to install. If none is found at start, AmberSight downloads one once (see Cross-platform notes).
  • Linux: ffmpeg and curl are required (curl sends alerts and AI server checks). The .deb and .rpm install both. Otherwise sudo apt install ffmpeg curl or sudo pacman -S ffmpeg curl. On Fedora the standard ffmpeg-free cannot decode H.265 cameras: use RPM Fusion's ffmpeg.

Background service commands

ambersight setup and the installers already do this. To install only the service, which starts at boot and restarts on failure:

ambersight service install --config /path/to/config.toml
ambersight service status
ambersight service stop | start
ambersight service uninstall

The config path is stored as an absolute path and the service runs with the config file's directory as its working directory, so a relative data_dir = "amberdata" keeps resolving next to the config. On Linux, ffmpeg must be on the service's PATH.

  • Linux (systemd): by default a per-user unit is written to ~/.config/systemd/user/ambersight.service (no root needed) and enabled with systemctl --user. To have it start at boot without logging in, run loginctl enable-linger $USER once. --system installs /etc/systemd/system/ambersight.service running as the current user; it needs root and prints the exact sudo command if you are not. The installer's PATH is copied into the unit. Logs: journalctl --user -u ambersight -f.
  • macOS (launchd): a LaunchAgent at ~/Library/LaunchAgents/com.ambersight.server.plist (or a LaunchDaemon in /Library/LaunchDaemons with --system, via sudo), loaded with launchctl bootstrap. service stop unloads it (launchd would otherwise restart it); service start loads it again. Logs are ambersight.out.log and ambersight.err.log in the config's directory.
  • Windows: registers the "AmberSight" service (display name "AmberSight NVR", automatic start, restart on failure) that runs ambersight.exe service-run --config <path>. Run service install and service uninstall from an Administrator terminal. Logs go to ambersight.log in the config's directory. The service runs as LocalSystem and sees the system-wide PATH; when it finds no ffmpeg there it downloads its own (see below).

Build from source

You need a recent stable Rust toolchain (rustup update stable). On Linux you also need ffmpeg and curl (apt install ffmpeg curl).

cargo build --release

The binary is target/release/ambersight. Quick start:

./ambersight init config.toml      # create a starter config
# edit config.toml: add your cameras
./ambersight run --config config.toml

Open http://localhost:8090. A new install has no camera: use Find cameras (Settings > Cameras) or add one by address. To try AmberSight without hardware, add a synthetic camera:

[[cameras]]
name = "Test Pattern"
url = "lavfi://mandelbrot=size=640x360:rate=10"

Before using it on a network

  • Add a user account (Settings > Users & security). With no accounts, anyone who can reach the port can watch every camera and change every setting.
  • Turn on HTTPS ([server] tls = true). AmberSight runs its own private certificate authority; install it once per device from the account menu ("Trust this server") or /tls/ca.crt.
  • Optional AI object detection: Settings > Detection & alerts > Objects (AI) downloads a model (Tiny, Small or Large) and turns it on; from the command line, ambersight ai-model --config config.toml downloads it and shows the two lines to add to the config.

Features

  • Live view: many cameras at once. Each tile plays fragmented-MP4 video in the browser (Media Source); a light mode sends JPEG frames instead for large grids and slow links. Corner labels (name, site, date, time) and AI detection chips on each tile. Layouts, groups, paging, full screen, a phone layout, and a Data saver mode that plays the sub stream.
  • Display mode: a full-screen page (/display) for a wall TV, an old tablet or a spare monitor that runs for weeks on its own: a grid of chosen cameras, and the camera with an alert goes big for a while (two share the screen). Clock, armed state, dimming at night, burn-in shift. It signs in with a code an admin approves, as a viewer that can only watch.
  • Streams that fit the device: apps get the best quality their device can decode: streams too big or in a codec the device can't play are converted on the graphics card (or in software when there is none).
  • Fill gaps from the camera's card: when a Reolink camera with a memory card drops off (Wi-Fi, a router restart, AmberSight restarting) and comes back, the missing part is copied from its card and shows on the timeline as recorded, marked as from the card. Per camera, off by default.
  • Battery Reolink cameras without a hub (Argus): add them with the brand "Reolink battery (Argus, no hub)" and the camera's UID. They sleep until motion: the camera's motion message (a local DNS entry for pushx.reolink.com) wakes them and starts recording, and AmberSight fetches the first seconds of each event from the camera's card. Events the camera recorded while AmberSight missed its message (push off, Wi-Fi trouble, AmberSight down) are imported from the card later, marked "from card", without a notification. See the install guide.
  • Reolink's own protocol for always-on Reolinks: a camera's "Connect with" setting can read it over Reolink's port 9000 instead of RTSP, or use Auto: port 9000, moving to RTSP when port 9000 keeps failing and back when it works again. See the camera guide.
  • Recording: continuous segments per camera, or a sub stream all the time with the main stream only around events. Motion clips with pre-roll and post-roll. By default recordings use what the disk can spare and keep 10% of it free, deleting the oldest first; or give each folder a fixed size. Several storage folders, an archive tier, and retention in days. Footage around events is deleted last. A camera can also save each event's clip (or only events AI confirmed) as an .mp4 to a second folder, such as a OneDrive or Google Drive folder, shortly after the event: off-site copies from the same stream.
  • Timeline: all cameras in sync, alert markers by kind, fast and reverse playback, and export of a time range. Bookmarks mark a moment with a note (one camera or all of this server's) and can keep the video around it from cleanup; a list searches them.
  • Events: a list beside the player, filters, false alarms, protect (kept from cleanup), and export. Events are stored in a SQLite database.
  • AI: built-in YOLOX object detection on CPU or GPU (DirectML on Windows, NVIDIA CUDA, Intel graphics with OpenVINO or AMD graphics with WebGPU on Linux, Core ML on Apple silicon Macs), with a Large model for the most accurate checks, an AI server option, or an external detector command. AI review explains why an event did or did not alert. AI remembers fixed spots it keeps mistaking for a person or a car (a bush, a bin, a parked car) and stops alerting for them. Parked vehicles are ignored, package detection, face recognition, smart search by description (CLIP), and a loud-sound trigger.
  • Zones: rectangle and polygon detect and ignore zones. AmberSight has no privacy masks of its own: use the camera's own privacy mask (Reolink, Dahua/Amcrest and Hikvision cameras have one), so the area never leaves the camera. An ignore zone keeps motion there from counting.
  • Text on the picture: your own text with the date and time, drawn over live view and playback (with the recording's own time), put into snapshots and event pictures, and a time subtitle track in downloads (not in an event clip sent from its saved file as it is); burning it into the recordings is an option.
  • Alerts: push, Telegram, ntfy, Pushover, email, webhooks, Home Assistant, MQTT with Home Assistant discovery, and action commands. System alerts for a camera offline, recordings not written or a drive nearly full.
    • Alerts can leave the event picture out (alert_picture = false, for every camera or one).
    • The webhook can send your own JSON body with placeholders (webhook_body), for chat services that want their own format.
  • Profiles and schedules: named sets of overrides picked by a weekly schedule, including sunrise and sunset.
  • Camera watchdog: restarts a camera that stops sending video, or power cycles it through a smart plug or PoE port.
  • PTZ and two-way talk through ONVIF (talk also over Reolink's port 9000).
  • Camera lights and siren (Reolink): turn a camera's spotlight on, sound or stop its siren, and switch its infrared and status lights, from Live, the camera's settings, MQTT and Home Assistant, or as an action of an alert. Admins choose who may use them; every use is in the audit log, and a siren is limited and always stopped when its time is up.
  • Time-lapse: each day of a camera in a short video.
  • Off-site backup: to a folder or S3, encrypted.
  • Find cameras: ONVIF discovery on this subnet and any other subnets you list, sign-in with your usual camera login (a Dahua-style camera that refuses ONVIF is added by its video stream instead), and an optional hourly check that tells you when a new camera appears.
  • Adding cameras by address: the camera form asks for the address, port, protocol, user name and password once, then the main and sub stream paths. A brand list fills the usual paths, Find via ONVIF asks the camera, and a pasted rtsp:// address is split for you. The camera guide lists paths and known problems by brand. Transport is Auto, TCP or UDP (Auto tries UDP when a camera only offers it).
  • Hardware decoding: motion detection decodes on an NVIDIA card (NVDEC), or on Linux an Intel or AMD one (Quick Sync or VAAPI), when it passes a test decode at start, and falls back to the processor; one setting picks the order (Settings > System > Hardware), and a way that fails is tried again later. Intel Quick Sync on Linux needs Intel's GPU runtime (libmfx-gen1.2 on Debian/Ubuntu, intel-vpl-gpu-rt on Fedora); without it Gen12+ Intel uses VAAPI, which fails on some cameras. Auto keeps video memory free on the NVIDIA card for the AI and other programs: past the limit (1.5 GB by default) cameras use Intel or the processor and move back when there is room. Cameras with burned-in text use the sub stream for motion and re-encode recordings on the card's encoder. Status says when a large camera has no sub stream and offers to find one.
  • Camera report: a text file with what a camera sends and its recent errors, without user names or passwords, to attach to a bug report (Settings > Cameras > the camera > Network > Camera report).
  • Linked servers: several sites in one interface.
  • Apple Home (HomeKit): the cameras you pick show in the Home app with live video (H.264, encoded on the graphics card when there is one, Opus sound), a motion sensor and snapshots; each camera on its own or behind one bridge. Off by default. Tested with an iPhone and a HomePod mini hub (one camera per accessory, Linux server); reports from other setups are welcome in GitHub Discussions.
  • Users and per-camera access. Three roles: viewers watch; operators also arm and disarm, move PTZ cameras, talk, record clips, keep and mark events and tune their cameras' detection and alerts (each right can be turned off); admins do everything. Viewers and operators can be limited to some cameras. Two-step codes (authenticator app, with recovery codes) and per-device tokens for apps and RTSP. HTTPS with a private certificate authority.
  • Updates: signed self-update. AmberSight checks for new releases every 12 hours (it asks api.github.com and sends only AmberSight/<version>; [update] check = false stops it); an admin installs one with a click (or ambersight update). It says first what an update does (a minute without recording, slow playback for a few minutes after, a database copy saved before a database change) and waits for a confirm; a small notice shows while a fresh start is still checking its recordings.
  • Interface: keyboard shortcuts, Ctrl+K command palette, and health and performance charts (CPU, AI, network, disk).
  • Languages: English, German, Spanish, French, Italian, Portuguese (Brazil), Dutch, Polish, Swedish, Russian and Chinese (Simplified). The admin sets the server's default and everyone can pick their own, with a 12-hour or 24-hour clock; a language is downloaded the first time it is needed and checked against the release (or installed from the release file). The translations are machine-made and reviewed; text the server writes (notifications, status) is in English.
  • Command line: ambersight --help lists the commands (init, run, setup, service, cameras, events, snapshot, ai-model, discover, ptz, backup, and more).

Configuration

Most settings are in the web page under Settings. Its sections are Cameras, Recording, Detection & alerts, Smart features, Schedules & presence, Users & security, Connections and System. They are saved to config.toml. See config.example.toml for every option. Camera URLs:

  • rtsp://... - RTSP cameras (forced over TCP)
  • http://... / file paths - anything ffmpeg can read
  • lavfi://... - synthetic test source (e.g. lavfi://testsrc=size=640x360:rate=10)

Data layout

Inside data_dir (default amberdata; /var/lib/ambersight for the packages):

ambersight.db                   # SQLite: events and the recordings index
cameras/<slug>/segments/*.mp4   # continuous segments
clips/<id>.mp4                  # motion clips
thumbs/                         # event pictures
models/                         # downloaded AI models
timelapse/<slug>/               # time-lapse videos
backups/                        # config.toml and database backups
tools/                          # ffmpeg downloaded by AmberSight (Windows, macOS)

A storage folder set in the config holds its own cameras/ tree.

The database stores each recording as its folder's name plus a path inside that folder, so a moved folder (another drive, another computer, Windows to Linux) only needs its new path set in Settings > Recording > Drives & folders. Recordings whose files are gone (a folder emptied, a drive reformatted) are noticed at start and can be removed from the database there, or with ambersight storage prune-missing (a dry run unless --apply; it backs the database up first and never deletes files). See "Moving recordings or moving to a new computer" in docs/install.md.

API

The web page uses a JSON API that you can use too: status, cameras, events, clips, snapshots, live streams and settings. Sign in with HTTP Basic auth or a session. See docs/api-guide.md for the endpoints, authentication and examples. For example, GET /api/status returns server status and GET /api/snapshot/{id} the latest JPEG from a camera.

Home Assistant

MQTT. In config.toml, under the alerts section, set:

mqtt_url = "mqtt://user:pass@broker:1883"   # or "mqtts://user:pass@broker:8883" for TLS
# mqtt_ca_file = "/etc/ambersight/broker-ca.pem"   # mqtts:// with your own certificate authority
mqtt_prefix = "ambersight"   # optional, default "ambersight"
mqtt_discovery = true        # publish Home Assistant discovery messages
# mqtt_camera_switch = true  # let Home Assistant switch cameras off (anyone who can publish to the broker can stop recording)

With discovery on, Home Assistant creates these entities (all retained, with availability from <prefix>/status):

  • Per camera (one device each): Motion, Person, Vehicle, Animal (from what the camera itself reports), Online, Snapshot, a "Switched on" switch (only with mqtt_camera_switch = true; off: no recording, detection or alerts; live view keeps working) and a "Record clip" button. Battery (on-demand) cameras also get an Asleep sensor and a Wake button.
  • AmberSight server device: Shield switch, Profile select ("Auto" plus your profiles), an Active profile sensor, and a Problem sensor (on while a camera is offline, recordings are not being written or a drive is nearly full; the list is in its attributes).

Command topics (<cam> is the camera name in lower case with _ for spaces):

Topic Payload
<prefix>/shield/set ON / OFF
<prefix>/<cam>/trigger clip length in seconds (default 20)
<prefix>/<cam>/wake anything; wakes a battery camera
<prefix>/profile/set a profile name, or Auto to follow the schedule
<prefix>/<cam>/enabled/set ON / OFF; off: no recording, detection or alerts for that camera (kept across restarts). Only with mqtt_camera_switch = true

State topics: <prefix>/<cam>/{motion,person,vehicle,animal,online,asleep,enabled} (ON/OFF), <prefix>/shield/state, <prefix>/profile/state, <prefix>/profile/active, <prefix>/problems (ON/OFF) and <prefix>/problems/list (JSON {"problems": [...]}).

Live video. Add the Generic Camera integration per camera, with the camera's numeric id from /api/cameras (8090 is the default port):

  • Still image URL: http://user:pass@HOST:8090/api/snapshot/ID
  • Stream source: http://user:pass@HOST:8090/api/live/ID/stream (fragmented MP4; add ?q=sub for the sub stream). This works for cameras on the built-in reader (RTSP and HTTP-FLV URLs, the default); cameras re-encoded through ffmpeg (burned-in text, ingest = "ffmpeg") have no live stream; use the MJPEG address for those.

HTTP Basic auth is accepted on these endpoints, so the credentials go in the URL. Use an account that can see the camera. Snapshot and stream requests wake a sleeping battery camera.

Cross-platform notes

ffmpeg

AmberSight looks for ffmpeg in this order: next to the AmberSight program, then <data_dir>/tools (its own downloaded copy), then the system PATH. The status page (Settings > System > Status & updates, Server card) shows which version is in use.

  • macOS and Windows: if no working ffmpeg is found when the server starts, AmberSight downloads ffmpeg 8.1.2 once (about 27-33 MB on a Mac, 105 MB on Windows), checks it against a fixed checksum, and keeps just the ffmpeg program in <data_dir>/tools. If that download fails, the message says how to install it by hand (brew install ffmpeg / winget install ffmpeg, or put the ffmpeg program next to AmberSight).
    • Mac builds: Martin Riedl's build server (Apple silicon and Intel; signed with the builder's Developer ID).
    • Windows build: gyan.dev "essentials", from its versioned GitHub releases.
    • License: these ffmpeg builds are GPL v3 (FFmpeg itself is LGPL/GPL). They are not part of AmberSight; your computer downloads them from their builders.
  • Linux: install it with your package manager (sudo apt install ffmpeg, sudo pacman -S ffmpeg); the system build knows your graphics drivers for hardware decoding. On Fedora the standard ffmpeg-free cannot decode H.265 cameras: add RPM Fusion (https://rpmfusion.org/Configuration) first, then sudo dnf install ffmpeg --allowerasing. AmberSight says so clearly if ffmpeg is missing.
  • An ffmpeg you install yourself (brew install ffmpeg, winget install ffmpeg, choco install ffmpeg) is used as well; nothing is downloaded then.

The code uses portable crates; the only platform-specific code is the service installer (see "Background service commands"). Build with cargo build --release on each target.

License

AmberSight is source-available, not open source. It is licensed under the PolyForm Noncommercial License 1.0.0 (see LICENSE).

In plain words (the license text is what counts):

  • You may use AmberSight for any noncommercial purpose: at home, for a hobby, for study, at a school, charity, public research or government organization.
  • You may change it and share your changes, for noncommercial purposes, as long as you pass on the license and its Required Notice line.
  • You may not sell it, charge for installing or running it, bundle it in a product or service you sell, or use it in a business. Businesses that want to use it can ask the copyright holder for a separate license.

Contributions are welcome; see CONTRIBUTING.md for the terms.

Third-party code keeps its own license (all notices are collected in THIRD-PARTY-NOTICES.txt, which every package includes): the vendored RTSP library in vendor/retina (MIT or Apache-2.0), the Rust crates AmberSight builds on (their licenses are listed in Cargo.lock / on crates.io), the AI models AmberSight downloads (each with its own license, named where it is set up), and ffmpeg (see above).

探索相关项目

加载中…