Skip to main content

Run Camera.UI with Docker-Compose

Guangzhou, China

Setup

Docker-Compose

version: '3.8'

services:
camera.ui:
container_name: camera.ui
image: nexryai/camera.ui:latest
ports:
- "8081:8081"
- "1883:1883"
- "7272:7272"
volumes:
- ./data:/.camera.ui:rw
networks:
- services
restart: unless-stopped

networks:
services:
external: false
docker-compose pull
Pulling camera.ui ... done

docker-compose up
Creating network "camera-ui-docker_default" with the default driver
Creating camera.ui ... done
Attaching to camera.ui
camera.ui | [10/18/2022, 4:54:52 AM] [camera.ui] camera.ui v1.1.17 is listening on port 8081 (http)

Run Camera.UI with Docker-Compose

Adding a Camera

Run Camera.UI with Docker-Compose

"cameras": [
{
"name": "IN-9408 2k+ WQHD",
"motionTimeout": 15,
"recordOnMovement": null,
"prebuffering": null,
"videoConfig": {
"source": "-i rtsp://admin:instar@192.168.2.120:554/livestream/11",
"stillImageSource": "-i http://admin:instar@192.168.2.120/snap.cgi?chn=12",
"stimeout": 10,
"audio": null,
"debug": null,
"subSource": "-i rtsp://admin:instar@192.168.2.120:554/livestream/12",
"rtspTransport": "tcp",
"vcodec": "copy",
"acodec": "libfdk_aac"
}
]

Run Camera.UI with Docker-Compose

Alarmserver

HTTP

The HTTP alarmserver can be activated to trigger or reset a movement by a simple call of a link.

Run Camera.UI with Docker-Compose

If the HTTP server is activated, a movement can be triggered by e.g. the following link and our camera name IN-9408 2k+ WQHD:

http://localhost:7272/motion?IN-9408%202k+%20WQHD

And reset via

http://localhost:7272/motion/reset?IN-9408%202k+%20WQHD

Run Camera.UI with Docker-Compose

But there is an issue with cameras that append a value to their query key:

[camera.ui] WARNING IN-9408 2k+ WQHD=1: Camera 'IN-9408 2k+ WQHD=1' not found

Run Camera.UI with Docker-Compose

MQTT

Run Camera.UI with Docker-Compose

Missing configuration - I cannot add a MQTT broker login:

Run Camera.UI with Docker-Compose

The missing configuration can be added manually - since we mounted the configuration directory to ./data all the configuration files can now be found inside this folder next to our docker-compose.yml file. Alternatively, just edit the directly inside the container:

docker exec -ti camera.ui nano .camera.ui/config.json

Run Camera.UI with Docker-Compose

And while we are in here, we can also add the Camera MQTT alarmserver:

Run Camera.UI with Docker-Compose

After a restart the MQTT broker is now connected:

Run Camera.UI with Docker-Compose

And I can see that the software is now listening for the alarmserver topic of my camera:

camera.ui    | [10/18/2022, 6:48:47 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
camera.ui | [10/18/2022, 6:48:52 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"0"} - Type: string
camera.ui | [10/18/2022, 6:48:52 AM] [camera.ui] WARNING The incoming MQTT message ({"val":"0"}) for the topic (cameras/120/status/alarm/triggered) was not the same as set in config.json ({"val":"1"}). Skip...
camera.ui | [10/18/2022, 6:49:51 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
camera.ui | [10/18/2022, 6:49:52 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
camera.ui | [10/18/2022, 6:49:57 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"0"} - Type: string
camera.ui | [10/18/2022, 6:49:57 AM] [camera.ui] WARNING The incoming MQTT message ({"val":"0"}) for the topic (cameras/120/status/alarm/triggered) was not the same as set in config.json ({"val":"1"}). Skip...
camera.ui | [10/18/2022, 6:51:31 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
camera.ui | [10/18/2022, 6:51:32 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
camera.ui | [10/18/2022, 6:51:37 AM] [camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"0"} - Type: string
camera.ui | [10/18/2022, 6:51:37 AM] [camera.ui] WARNING The incoming MQTT message ({"val":"0"}) for the topic (cameras/120/status/alarm/triggered) was not the same as set in config.json ({"val":"1"}). Skip...
{
"logLevel": "info",
"port": 8081,
"atHomeSwitch": false,
"options": {
"videoProcessor": "/usr/lib/node_modules/camera.ui/node_modules/ffmpeg-for-homebridge/ffmpeg"
},
"ssl": {
"active": false
},
"http": {
"active": true,
"port": 7272,
"localhttp": false
},
"smtp": {
"active": false,
"port": 2727,
"space_replace": "+"
},
"ftp": {
"active": false,
"useFile": false,
"port": 5050
},
"mqtt": {
"active": true,
"tls": false,
"host": "192.168.2.120",
"port": 1883,
"username": "admin",
"password": "instar"
},
"cameras": [
{
"name": "IN-9408 2k+ WQHD",
"motionTimeout": 15,
"recordOnMovement": null,
"prebuffering": null,
"videoConfig": {
"source": "-i rtsp://admin:instar@192.168.2.120:554/livestream/11",
"stillImageSource": "-i http://admin:instar@192.168.2.120/snap.cgi?chn=12",
"stimeout": 10,
"audio": null,
"debug": null,
"subSource": "-i rtsp://admin:instar@192.168.2.120:554/livestream/12",
"rtspTransport": "tcp",
"vcodec": "copy",
"acodec": "libfdk_aac"
},
"mqtt": {
"motionTopic": "cameras/120/status/alarm/triggered",
"motionMessage": "{\"val\":\"1\"}",
"motionResetTopic": "cameras/120/status/alarm/triggered",
"motionResetMessage": "{\"val\":\"0\"}"
},
"smtp": {
"email": "IN-9408 2k+ WQHD"
},
"videoanalysis": {
"active": false
},
"prebufferLength": 4
}
]
}