Viseron v3.0.0b1 - Self-hosted, local only NVR and AI Computer Vision software

ENVs I changed:
CUDA_PKG_VERSION = 11-1=11.1.1
CUDA_VERSION = 11.1.1
CUDNN_VERSION = 8.0.5.39
NVIDIA_REQUIRE_CUDA = cuda>=11.1 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441

Edit:
… and in LABELS:
com.nvidia.cudnn.version = 8.0.5.39

You might be in luck then! 3.5 is still supported in CUDA 11.
It takes a few hours to rebuild everything, i will let you know when its done and you can test it out

1 Like

Great! Thank you! :slight_smile:

The builds are now complete, can you pull the dev tag and test if it works for you?

Hi,

First of all, I would like to congratulate you for this awesome project.
I intented to integrate it into home assistant but i met some issues with MQTT integration

I use the Mosquitto Broker addon and my viseron config file looks like this

MQTT is optional

mqtt:
broker: core-mosquitto
port: 1883
username : user
password: pass

Viseron logs are the following

[2021-06-05 16:52:44] [lib.camera.front_door ] [DEBUG ] - Getting stream information for rtsp:/[email protected]:554//h264Preview_01_main,
[2021-06-05 16:52:44] [lib.camera.front_door ] [DEBUG ] - Initializing camera Front Door,
[2021-06-05 16:52:44] [lib.nvr.front_door ] [DEBUG ] - Initializing NVR thread,
[2021-06-05 16:52:44] [lib.mqtt ] [INFO ] - Initializing MQTT connection,
[2021-06-05 16:52:44] [root ] [INFO ] - Initializing NVR threads,
[2021-06-05 16:52:44] [lib.detector ] [DEBUG ] - Initializing object detector darknet,
[2021-06-05 16:52:44] [lib.detector ] [DEBUG ] - OpenCL activated,
[2021-06-05 16:52:44] [lib.detector ] [DEBUG ] - Object detector initialized

No errors seem to appear but the elements from my camera are not discovered by MQTT into home assistant

Any suggestion ?

Thanks for the kind words!

Have you changed the MQTT discovery prefix in Home Assistant?

Could you post your full config wrapped in triple backticks? (```)

Thanks for having replied

  1. Why is it necessary to change the MQTT discovery prefix ? Does Viseron use a specific prefix for MQTT ?

  2. What I do not understand is why I cannot see in Mosquitto Broker logs the IP address of Viseron (172.17.0.3)

  3. The IP address of the MQTT broker is the same as my server (all containers are on the same sever) ?

  4. I have tried to follow the MQTT discovery tutorial, but it unfortunately did not work for me (the test is stuck)

Viseron config.yaml

# See the README for the full list of configuration options.
cameras:
  - name: Front Door
    mqtt_name: viseron_front_door
    host: !secret camera_ip
    port: 554
    username: !secret username
    password: !secret password
    path: //h264Preview_01_main
    fps: 30
    width: 2560
    height: 1920
    stream_format: rtsp
    publish_image: true
    motion_detection:
      interval: 1
      trigger_detector: false
#      timeout: true
#      max_timeout: 30
#      width: 300
#      height: 300
#      area: 0.1
#      frames: 3
    object_detection:
      interval: 1
      labels:
        - label: person
          confidence: 0.8
        - label: cat
          confidence: 0.6

recorder:
  lookback: 60
  timeout: 120
  retain: 365
  folder: /recordings
  thumbnail:
    save_to_disk: true
    send_to_mqtt: true

# MQTT is optional
mqtt:
  broker: 192.168.10.2
  port: 1883
  username: XXX
  password: XXX

logging:
  level: debug

Viseron logs:

[2021-06-06 14:43:16] [root                    ] [INFO    ] - -------------------------------------------,
[2021-06-06 14:43:16] [root                    ] [INFO    ] - Initializing...,
[2021-06-06 14:43:16] [root                    ] [DEBUG   ] - Starting cleanup scheduler,
[2021-06-06 14:43:16] [root                    ] [DEBUG   ] - Running initial cleanup,
[2021-06-06 14:43:16] [lib.cleanup             ] [DEBUG   ] - Running cleanup,
[2021-06-06 14:43:16] [lib.cleanup             ] [DEBUG   ] - Items in /recordings/2021-06-04: 1,
[2021-06-06 14:43:16] [lib.cleanup             ] [DEBUG   ] - Items in /recordings/2021-06-05: 1,
[2021-06-06 14:43:16] [lib.cleanup             ] [DEBUG   ] - Items in /recordings/2021-05-31: 1,
[2021-06-06 14:43:16] [lib.cleanup             ] [DEBUG   ] - Items in /recordings/2021-06-06: 1,
[2021-06-06 14:43:16] [lib.mqtt                ] [INFO    ] - Initializing MQTT connection,
[2021-06-06 14:43:16] [lib.detector            ] [DEBUG   ] - Initializing object detector darknet,
[2021-06-06 14:43:16] [lib.detector            ] [DEBUG   ] - OpenCL activated,
[2021-06-06 14:43:16] [lib.detector            ] [DEBUG   ] - Object detector initialized,
[2021-06-06 14:43:16] [root                    ] [INFO    ] - Initializing NVR threads,
[2021-06-06 14:43:16] [lib.nvr.front_door      ] [DEBUG   ] - Initializing NVR thread,
[2021-06-06 14:43:16] [lib.camera.front_door   ] [DEBUG   ] - Initializing camera Front Door,
[2021-06-06 14:43:16] [lib.camera.front_door   ] [DEBUG   ] - Getting stream information for rtsp://xxxx:[email protected]:554//h264Preview_01_main,

MQTT broker logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.,
[s6-init] ensuring user provided files have correct perms...exited 0.,
[fix-attrs.d] applying ownership & permissions fixes...,
[fix-attrs.d] done.,
[cont-init.d] executing container initialization scripts...,
[cont-init.d] mosquitto.sh: executing... ,
[13:12:56] INFO: SSL is not enabled,
[cont-init.d] mosquitto.sh: exited 0.,
[cont-init.d] nginx.sh: executing... ,
[cont-init.d] nginx.sh: exited 0.,
[cont-init.d] done.,
[services.d] starting services,
[services.d] done.,
[13:12:57] INFO: Starting NGINX for authentication handling...,
[13:12:57] INFO: Starting mosquitto MQTT broker...,
1622977977: mosquitto version 1.6.12 starting,
1622977977: |-- *** auth-plug: startup,
[13:12:57] INFO: Successfully send discovery information to Home Assistant.,
[13:12:57] INFO: Successfully send service information to the Supervisor.,
1622977977: Config loaded from /etc/mosquitto/mosquitto.conf.,
1622977977: Loading plugin: /usr/share/mosquitto/auth-plug.so,
1622977977:  ├── Username/password checking enabled.,
1622977977:  ├── TLS-PSK checking enabled.,
1622977977:  └── Extended authentication not enabled.,
1622977977: Opening ipv4 listen socket on port 1883.,
1622977977: Opening ipv6 listen socket on port 1883.,
1622977977: Opening websockets listen socket on port 1884.,
1622977977: Warning: Mosquitto should not be run as root/administrator.,
1622977977: mosquitto version 1.6.12 running,
1622977977: New connection from 127.0.0.1 on port 1883.,
1622977977: Socket error on client <unknown>, disconnecting.,
1622977983: New connection from 172.30.33.2 on port 1883.,
1622977983: New client connected from 172.30.33.2 as mosq-KhN02P1FYxJ093adpz (p2, c1, k60, u'addons').,
1622977983: Client mosq-KhN02P1FYxJ093adpz disconnected.,
1622977984: New connection from 172.30.33.2 on port 1883.,
1622977984: New client connected from 172.30.33.2 as mosq-3vb54eT5JHbOAbMU9J (p2, c1, k60, u'addons').,
1622977984: Client mosq-3vb54eT5JHbOAbMU9J disconnected.,
1622977984: New connection from 172.30.33.2 on port 1883.,
1622977984: New bridge connected from 172.30.33.2 as zwave (p2, c1, k60, u'addons').,
1622977990: New connection from 172.30.32.1 on port 1883.,
{"result": "ok", "data": {}}1622977990: New client connected from 172.30.32.1 as 4kFVBcF1f9c2xzPbl6UESR (p2, c1, k60, u'Matthieu').,
1622978016: New connection from 172.30.33.3 on port 1883.,
1622978016: New client connected from 172.30.33.3 as mqttjs_9829a5e9 (p2, c1, k60, u'addons').,
1622979778: Saving in-memory database to /data/mosquitto.db.,
1622981579: Saving in-memory database to /data/mosquitto.db.,
1622983299: New connection from 172.30.33.1 on port 1883.,
1622983299: New client connected from 172.30.33.1 as mosq-cRVebsMRVAl91oTcja (p2, c1, k60).,
1622983299: Client mosq-cRVebsMRVAl91oTcja disconnected.,
1622983363: New connection from 172.30.32.1 on port 1883.,
1622983363: New client connected from 172.30.32.1 as mosq-pdG4WLHei7q3cxsamc (p2, c1, k60).,

Il really suspect a problem of connexion between viseron and MQTT.
Indeed, when I put MQTT elements into config.yaml, detection do not work anymore (even if logs seem to be ok and no connexion errors with MQTT are mentionned)

Unfortunately it does not work.
Please find attached logs.

I apologize for the inconveniences, but I have found my problem

Actually, to solve it I had to :

  • precise the codec of my camera (I knew now why it was stuck of getting substream) with codec: h264. Btw, in the past, the system automatically recognize the codec, but now it does not … strange thing
  • to open the port 1883 in my firewall, even if the containers (viseron and homeassistant) were on the same server

Hope it will help someone else

Anyway, thank you for your help :slight_smile:

could you post your config?

Great you solved it!

Regarding the codec not being detected, what docker image are you pulling? Can you show your docker run command?

cameras:
  - name: raspicam
    host: 192.168.1.14
    port: 8555
    rtsp_transport: tcp
    username: user
    password: password
    path: /unicast
    width: 1280
    height: 720
    fps: 10

Does it work if you manually specify the codec? Use h264_cuvid for h264 or hevc_cuvid for h265.

cameras:
  - name: raspicam
    host: 192.168.1.14
    port: 8555
    rtsp_transport: tcp
    username: user
    password: password
    path: /unicast
    width: 1280
    height: 720
    fps: 10
    codec: h264_cuvid

Also looking at the logs it seems you hit a bug when running without MQTT, ill fix that tomorrow morning

The image is

roflcoopter/viseron-vaapi:latest from 2021-05-21
sha256:d61e41077b4c853c636a4cd3d8685a7b071717deab47a493dc96513ea27003aa

The running command is

docker run --name=viseron --hostname=b8dd4c3d9777 --mac-address=02:42:ac:11:00:0 3 --env=PATH=/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=DEBIAN_FRONTEND=noninteractive --env=opencv=master --env=VISERON_CUDA_SUPPORTED=false --env=VISERON_VAAPI_SUPPORTED=true --env=VISERON_OPENCL_SUPPORTED=true --env=VISERON_RASPBERRYPI3=false --volume=/nvr:/recordings:rw --volume=/nvr/config:/config:rw --volume=/etc/localtime:/etc/localtime:ro --volume=/recordi                                                                              ngs --workdir=/src/viseron --restart=always --device /dev/dri:/dev/dri --log-driver=journald --detach=true roflcoopter/viseron-vaapi:latest viseron.py

Besides, fyi, h264_cuvid is not recognized (that is why I have put h264)


[2021-06-06 22:24:26] [lib.camera.front_door   ] [ERROR   ] - Error starting decoder command! Unknown decoder 'h264_cuvid'

I tried both codecs and the container is terminating itself. I also specified these codec names for hwaccel_args argument and I can see only errors. In both cases I can see OpenCL and CUDA cannot be used messages.

I just realized you are pulling the incorrect image. If you want to use your GPU you need to pull roflcoopter/amd64-cuda-viseron:dev
Sorry for being unclear!

I suspect it might show that CUDA is not supported anyway but that should only be an issue with the automatic detection

You should change the image you are using, roflcoopter/viseron-vaapi:latest is old and wont be updated any longer.

Use roflcoopter/viseron:latest in the future!

No problem. I tried roflcoopter/amd64-cuda-viseron:dev yesterday (before viseron:dev) and there was info that CUDA could not be used. So I did not check mem status in NVTOP and switched immediately to viseron:dev. I will try it again and also with codec argument in the config. I will check nvtop as well. Thank you.

Edited:

Please find attached link to logs information: jarekmor@ubuntu_cuda:~$ docker run --rm -v /home/jarekmor/viseron/recordings:/re - Pastebin.com

There is indication in the nvtop that Nvidia is performing - 25% (GPU Mem%) - when movement is detected but still “CUDA can not be used” message.
I run it on basic config - no additional arguments. With additional arguments (codec, hwaccel_args) it does not work or prints errors.

There is also few minutes delay from movement detection to files recording time.
Also, as the first movie is recorded then after 1-2 minutes later the pictures with recognised objects are saved.
You can also find in the logs at the end that that Viseron is “Restarting frame pipe”.
After that error there is no recording at all.

1 Like

Can you add debug logging to your config?

logging:
  level: debug