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

Logging with debug: jarekmor@ubuntu_cuda:~$ docker run --rm -v /home/jarekmor/viseron/recordings:/re - Pastebin.com

Motion detected, object recognised but as I am sending this post no mp4 nor jpg files saved on the disk this time.

How much RAM does your machine have?
Edit: whats the output of this command?
docker run -it --rm --runtime=nvidia --entrypoint "" roflcoopter/amd64-cuda-viseron:dev /etc/cuda/test_cuda_availability.out

The output:
test_cuda_availability.out: cuda_test.cu:22: int main(): Assertion `ha[i] == i + 1’ failed.

I have now 8GB RAM for the VM. But I have 64GB on the host.

Interesting, try to install nvidia-smi inside the container and check the output, this should do it:
docker run -it --rm --runtime=nvidia --entrypoint "" roflcoopter/amd64-cuda-viseron:dev apt-get update && apt-get install -y nvidia-smi && nvidia-smi

Does this also give an error?

I could not run the last command you provided (errors) but I connected to the container (amd64-cuda-viseron:dev) and execuded nvidia-smi.

Okay thanks i think i know what to do now to get the automatic detection of your GPU to work.

But if you start viseron with codec: h264_nvdec and add ffmpeg_loglevel: info to your camera config, does it give you any indication as to why the FFmpeg process exits?

With the codec argument the container is exiting.

****** Checking for hardware acceleration platforms ******
OpenCL is available!
VA-API cannot be used
CUDA cannot be used
*********************** Done *****************************
[cont-init.d] 40-set-env-vars: exited 0.
[cont-init.d] 50-check-if-rpi: executing...
********** Checking if we are running on an RPi **********
Not running on any supported RPi
*********************** Done *****************************
[cont-init.d] 50-check-if-rpi: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2021-06-09 16:06:11] [INFO    ] [viseron                 ] - -------------------------------------------
[2021-06-09 16:06:11] [INFO    ] [viseron                 ] - Initializing...
[2021-06-09 16:06:13] [INFO    ] [viseron                 ] - Initializing NVR threads
Exception in thread setup.raspicam:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/src/viseron/__init__.py", line 144, in run
    FFMPEGNVR(camera_config, self._detector)
  File "/src/viseron/nvr.py", line 125, in __init__
    self.camera = FFMPEGCamera(config, detector)
  File "/src/viseron/camera/__init__.py", line 34, in __init__
    self.initialize_camera(detector)
  File "/src/viseron/camera/__init__.py", line 59, in initialize_camera
    self.stream = Stream(
  File "/src/viseron/camera/stream.py", line 55, in __init__
    or not self.stream_config.audio_codec
AttributeError: 'CameraConfig' object has no attribute 'audio_codec'
[2021-06-09 16:06:13] [INFO    ] [viseron                 ] - Initialization complete
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

But without the codec argument the container works and I got these: jarekmor@ubuntu_cuda:~/viseron/config$ docker run --rm -v /home/jarekmor/viseron - Pastebin.com

Okay i see so when you run without codec ffmpeg doesnt exit?

Can you try again with codec: h264_nvdec and ffmpeg_loglevel: info and also remove width and height? The crash on audio_codec is a bug that i am working on but can be circumvented by not specifying width, height or fps

With codec: h264_nvdec I have info that the codec is unknown but with codec: h264_cuvid it works:
jarekmor@ubuntu_cuda:~/viseron/config$ docker run --rm -v /home/jarekmor/viseron - Pastebin.com

width and height are removed.

I would like also to thank you for your efforts and help.

Yes its should be codec: h264_cuvid, my bad!

Great, so that means that its really only the automatic detection that isnt working for you?

Yes, the automatic detection of my GPU isnt working but nvtop is indicating that the gpu is performing.
I also noticed that there is still long delay between motion/object detection and recording of movie clip.
As you can see in this attahced very long logfile that motion and detection works but I had to wait few minutes to see movie saved in the recording directory. There is no picture.

jarekmor@ubuntu_cuda:~/viseron/config$ docker run --rm -v /home/jarekmor/viser - Pastebin.com

Ill take a look at why its slow for you later.
In the meantime, can you test if this command errors out or just returns nothing?

docker run -it --rm --runtime=nvidia --entrypoint "" roflcoopter/amd64-cuda-viseron:nvcc-test /etc/cuda/test_cuda_availability.out

It returns nothing.

Wohoo! That means the automatic detection is working!

I need to polish up a few more things before i can release it fully

1 Like

@roflcoopter
As Viseron is written in Python, will it run in a Python virtual environment? The reason I ask is; I use the excellent HA Core plug-in, maintained by @troy, in a TrueNAS iocage jail and would like to do the same with Viseron.

Its is not something i have tested, but i cant see why it wouldnt.
However it is just a python script, its not a published package to pip so not sure how that works in a virtualenv

However there is a lot of setup going on when the container starts that sets various environment variables and some default folders are also created. You would have to do all this manually.
You would also need to install all dependencies manually, like OpenCV and FFmpeg

If you wanna give it a stab i would recommend looking through the Dockerfile to see whats being installed

The biggest challenge is that jails on TrueNAS CORE are using FreeBSD, not Linux.

Honestly @Tromperie, I think you’ll be better off switching to TrueNAS SCALE when it’s released (so you can just use containers). Or if your TrueNAS CORE host has enough overhead, install a Linux VM and run Docker from there.

Took a bit longer than expected but latest dev now has a new way of detecting CUDA.
I had to do some changes since you tested it last so i would appreciate if you could give it another go.

Thank you.

I started with the following config but I noticed errors after motion was detected:

cameras:
  - name: raspicam
    host: 192.168.1.14
    port: 8555
    stream_format: rtsp
    username: user
    password: password
    path: /unicast
    width: 1280
    height: 720
    fps: 10
    codec: h264_cuvid
    ffmpeg_loglevel: info
    logging:
      level: debug

Please find attached logfile.

But then I modified the config:

cameras:
  - name: raspicam
    host: 192.168.1.14
    port: 8555
    stream_format: rtsp
    username: user
    password: password
    path: /unicast
    width: 1280
    height: 720
    fps: 10
#  codec: h264_cuvid
#  ffmpeg_loglevel: info
    logging:
      level: debug

and no errors at the beginning.
After the first motion was detected the picture was saved in recordings folder immediately.
The mp4 file was recorded as there was no motion.

Unfortunately after the second motion the container stopped and there are errors regarding recording proces.

From NVTOP I can see that GPU% memory is about 50-70% utilized.

The log file from the last configuration.

Seems to be another issue related to OpenCL instead.
Could you please open an issue over at GitHub instead with the same information so we dont litter down this thread too much.