Installation and startup¶
Requirements¶
- Python ≥ 3.12
- uv package manager
- ffmpeg on
PATH
Install¶
Run¶
Or, after installing the package:
On startup cang will:
- Open (or create) the SQLite database at
<output_dir>/cang.db. - Scan each configured camera root for existing clips and enqueue any that are not yet in the database. Transcoded files are written to
<output_dir>/<camera-name>/YYYY-MM-DD-HH.MM.SS-HH.MM.SS.mp4. - Start watching camera roots for new files.
- Serve the web UI on
http://<host>:<port>(default:http://0.0.0.0:8080).
Configuration¶
See config.md for a full reference. Minimum working example:
[server]
output_dir = "/var/lib/cang/clips"
[[camera]]
name = "front-door"
adapter = "dahua"
root = "/mnt/nvr/front-door"
Database location¶
The SQLite database is created at <server.output_dir>/cang.db. Ensure the process has
read/write access to that directory.
Running in a container¶
Cang is also available as an OCI container image. See the container guide for Docker Compose and systemd Quadlet setup instructions.
Troubleshooting¶
If a clip fails to transcode, check <server.output_dir>/ffmpeg.log. Cang appends the
full ffmpeg output for every transcode run, with a timestamp and source/destination paths
at the start of each entry.
Container fails to start: inotify instance limit reached¶
This error can occur on versions of cang prior to 0.3.5. It has been resolved by switching to a polling-based file watcher, which does not use inotify at all. Upgrade to the latest image to fix it: