Configuration reference¶
Cang reads a single TOML file at startup. Pass the path via the CLI (see cang --help).
[server]¶
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
output_dir |
string (path) | yes | — | Root directory for all cang output (clips, database, log). |
scan_interval |
integer | no | 300 |
Seconds between periodic re-scans of all camera roots. Acts as a fallback for files that the inotify watcher missed (e.g. bulk directory copies). On NFS mounts, inotify is unavailable and silent — scan_interval is then the only pickup mechanism; lower the value (e.g. 30) for faster response. Set to 0 to disable. |
Output directory layout¶
Cang writes three things under output_dir:
<output_dir>/
<camera-name>/
YYYY-MM-DD-HH.MM.SS-HH.MM.SS.mp4 # transcoded clip; one file per incoming clip
cang.db # SQLite metadata database
ffmpeg.log # ffmpeg output for every transcode run (appended)
Each camera gets its own subdirectory named after the camera's name key. The MP4
filename encodes the clip's start and end time; motion and first-frame flags are stored
in the database rather than in the filename.
[[camera]]¶
One [[camera]] block per camera. At least one is expected.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | yes | — | Human-readable label used in logs and the web UI. |
adapter |
string | yes | — | Folder-layout adapter. Currently only "dahua" is supported. |
root |
string (path) | yes | — | Root directory that the adapter scans for incoming clips. For the dahua adapter this must point directly at the camera's serial directory (e.g. /mnt/nvr/ABC123456); date subdirectories are expected immediately inside. |
delete_after_transcode |
boolean | no | false |
If true, the original source files (.dav clip and snapshot .jpg files) are deleted from the camera root after a successful transcode. Useful when NVR storage is limited. |
[web]¶
All keys are optional. Omitting the section uses the defaults shown below.
| Key | Type | Default | Description |
|---|---|---|---|
host |
string | "0.0.0.0" |
Interface address for the HTTP server. |
port |
integer | 8080 |
TCP port for the HTTP server. |
username |
string | — | HTTP Basic Auth username. Must be set together with password. |
password |
string | — | HTTP Basic Auth password. Must be set together with username. |
If neither username nor password is set, the web UI is accessible without authentication.
Example¶
[server]
output_dir = "/var/lib/cang/clips"
scan_interval = 300 # periodic re-scan every 5 minutes (default)
# on NFS mounts inotify is unavailable — lower this (e.g. 30)
# for faster pickup when the camera root is on a network share
[web]
host = "0.0.0.0"
port = 8080
username = "admin"
password = "s3cr3t"
[[camera]]
name = "front-door"
adapter = "dahua"
root = "/mnt/nvr/ABC123456" # serial directory — date folders sit directly inside
delete_after_transcode = true # remove source .dav and snapshots after transcode
[[camera]]
name = "back-yard"
adapter = "dahua"
root = "/mnt/nvr/DEF789012"