Decoder hevc hwConfig doesn't match our type: cuda

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

Hi everybody,

After several days of trying I cannot get the cuda hardware acceleration working, so I hope anybody can help me with this.

Currently I am having the error:
[decoder hevc hwConfig doesn't match our type: cuda != vaapi, pix_fmt vaapi_vld.]
[decoder hevc hwConfig doesn't match our type: cuda != vdpau, pix_fmt vdpau.]

My scenario is
  • ZoneMinder v1.34.23 running on Linux Debian
  • GeeForce RTX 3060 Ti
  • I have successfully compiled ffmpeg with cuda support
  • In ZoneMinder, on the source tab of the camera I have DecoderHWAccelName=cuda and DecoderHWAccelDevice empty

Code: Select all

$ ffmpeg -hwaccels
ffmpeg version N-111652-gbf9f6a5e55 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
Hardware acceleration methods:
cuda

Code: Select all

$ nvidia-smi
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti     On  | 00000000:09:00.0 Off |                  N/A |
|  0%   54C    P8              32W / 200W |    185MiB /  8192MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2425      G   /usr/lib/xorg/Xorg                          167MiB |
|    0   N/A  N/A      2946      G   /usr/bin/gnome-shell                         10MiB |
+---------------------------------------------------------------------------------------+

Code: Select all

$ sudo head -n100 zmc_m1.log
07/30/23 21:44:07.305211 zmc_m1[13644].DB1-zm_logger.cpp/247 [LogOpts: level=DB1 effective=DB1, screen=OFF, database=INF, logfile=DB9->/var/log/zm/zmc_m1.log, syslog=INF]
07/30/23 21:44:07.305560 zmc_m1[13644].DB1-zm_utils.cpp/269 [Detected a x86\x86-64 processor with AVX2]
07/30/23 21:44:07.305831 zmc_m1[13644].INF-zm_ffmpeg.cpp/82 [Enabling ffmpeg logs, as LOG_DEBUG+LOG_FFMPEG are enabled in options]
07/30/23 21:44:07.311912 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/190 [ffmpegcamera: width 1920 height 1080 linesize 7680 colours 4 imagesize 8294400]
07/30/23 21:44:07.311940 zmc_m1[13644].DB1-zm_monitor.cpp/382 [encoder params ]
07/30/23 21:44:07.311949 zmc_m1[13644].DB1-zm_monitor.cpp/424 [monitor purpose=1]
07/30/23 21:44:07.311955 zmc_m1[13644].DB1-zm_monitor.cpp/433 [mem.size(8) SharedData=600 TriggerData=560 VideoStoreData=4128 timestamps=1600 images=100x8294400 = 829440000 total=829446952]
07/30/23 21:44:07.311961 zmc_m1[13644].DB1-zm_storage.cpp/94 [No id passed to Storage constructor.  Using default path /var/cache/zoneminder/events instead]
07/30/23 21:44:07.311967 zmc_m1[13644].DB1-zm_monitor.cpp/442 [Storage path: /var/cache/zoneminder/events]
07/30/23 21:44:07.311991 zmc_m1[13644].DB1-zm_monitor.cpp/604 [Unable to map file /dev/shm/zm.mmap.1 (829446952 bytes) to locked memory, trying unlocked]
07/30/23 21:44:07.311999 zmc_m1[13644].DB1-zm_monitor.cpp/607 [Mapped file /dev/shm/zm.mmap.1 (829446952 bytes) to unlocked memory]
07/30/23 21:44:07.666434 zmc_m1[13644].DB1-zm_monitor.cpp/510 [Monitor rivarola-garden has function 5,
label format = '%N - %Y-%m-%d %H:%M:%S %z', label X = 0, label Y = 0, label size = 1,
image buffer count = 100, warmup count = 25, pre-event count = 100, post-event count = 100, alarm frame count = 1,
fps report interval = 100, ref blend percentage = 1, alarm ref blend percentage = 3, track motion = 0]
07/30/23 21:44:07.666997 zmc_m1[13644].DB1-zm_zone.cpp/884 [Got 1 zones for monitor rivarola-garden]
07/30/23 21:44:07.680444 zmc_m1[13644].DB1-zm_monitor.cpp/2400 [Loaded monitor 1(rivarola-garden), 1 zones]
07/30/23 21:44:07.680484 zmc_m1[13644].INF-zmc.cpp/223 [Starting Capture version 1.34.23]
07/30/23 21:44:07.689863 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/216 [Priming capture from rtsp://admin:XXXXXX@10.0.0.12:5001/H.264]
07/30/23 21:44:07.689891 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/379 [Calling avformat_open_input for rtsp://admin:XXXXXX@10.0.0.12:5001/H.264]
07/30/23 21:44:08.706251 zmc_m1[13644].DB1-zm_ffmpeg.cpp/335 [Dumping stream index i(0) index(0)]
07/30/23 21:44:08.706291 zmc_m1[13644].DB1-zm_ffmpeg.cpp/345 [    Stream #0:0]
07/30/23 21:44:08.706306 zmc_m1[13644].DB1-zm_ffmpeg.cpp/353 [frames:22, frame_size:0 stream timebase: 1/90000]
07/30/23 21:44:08.706320 zmc_m1[13644].DB1-zm_ffmpeg.cpp/359 [codec: hevc]
07/30/23 21:44:08.706333 zmc_m1[13644].DB1-zm_ffmpeg.cpp/288 [90k stream tb numerator]
07/30/23 21:44:08.706348 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/496 [vdpau]
07/30/23 21:44:08.706360 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/496 [vaapi]
07/30/23 21:44:08.706372 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/496 [qsv]
07/30/23 21:44:08.706384 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/496 [drm]
07/30/23 21:44:08.706395 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/496 [opencl]
07/30/23 21:44:08.706407 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/503 [Found hwdevice cuda]
07/30/23 21:44:08.706420 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/521 [decoder hevc hwConfig doesn't match our type: cuda != vaapi, pix_fmt vaapi_vld.]
07/30/23 21:44:08.706432 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/521 [decoder hevc hwConfig doesn't match our type: cuda != vdpau, pix_fmt vdpau.]
07/30/23 21:44:08.706445 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/511 [Decoder hevc does not support device type cuda.]
07/30/23 21:44:08.706457 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/548 [Failed to find suitable hw_pix_fmt.]
07/30/23 21:44:08.706580 zmc_m1[13644].DB1-zm_ffmpeg.cpp/310 [Dumping codec_context codec_type(0) codec_id(173 hevc) width(1920) height(1080)  timebase(1/90000) format(yuvj420p) gop_size 12 max_b_frames 0 me_cmp 0 me_range 0 qmin 2 qmax 31]
07/30/23 21:44:08.706609 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/575 [HWACCEL not in use]
07/30/23 21:44:08.706650 zmc_m1[13644].DB1-zm_ffmpeg.cpp/335 [Dumping stream index i(1) index(0)]
07/30/23 21:44:08.706663 zmc_m1[13644].DB1-zm_ffmpeg.cpp/345 [    Stream #0:1]
07/30/23 21:44:08.706675 zmc_m1[13644].DB1-zm_ffmpeg.cpp/353 [frames:14, frame_size:1024 stream timebase: 1/16000]
07/30/23 21:44:08.706687 zmc_m1[13644].DB1-zm_ffmpeg.cpp/359 [codec: aac]
07/30/23 21:44:08.707099 zmc_m1[13644].DB1-zm_ffmpeg.cpp/310 [Dumping codec_context codec_type(1) codec_id(86018 aac) width(0) height(0)  timebase(1/16000) format(none) gop_size 0 max_b_frames 0 me_cmp 0 me_range 0 qmin 0 qmax 0]
07/30/23 21:44:08.789002 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/290 [raw frame from decoder: format 12 yuvj420p 1920x1080 linesize:1920x960 pts: -9223372036854775808]
07/30/23 21:44:08.789033 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/1086 [ffmpegcamera: width 1920 height 1080 linesize 7680 colours 4 imagesize 8294400]
07/30/23 21:44:08.789062 zmc_m1[13644].INF-zm_ffmpeg.cpp/70 [deprecated pixel format used, make sure you did set range correctly]
07/30/23 21:44:08.801333 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/1111 [Setup conversion context for 1920x1080 yuvj420p to 1920x1080 rgba]
07/30/23 21:44:08.802400 zmc_m1[13644].INF-zm_monitor.cpp/2554 [rivarola-garden: images:1 - Capturing at 1.00 fps, capturing bandwidth 147940bytes/sec]
07/30/23 21:44:08.818330 zmc_m1[13644].DB1-zm_ffmpeg_camera.cpp/290 [raw frame from decoder: format 12 yuvj420p 1920x1080 linesize:1920x960 pts: 4062558474]
Using the rtsp_transport with FFMPEG works fine

Code: Select all

$ ffmpeg -rtsp_transport tcp -hwaccel cuda -hwaccel_output_format cuda -i rtsp://admin:XXXXXX@10.0.0.12:5001/H.265 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4
ffmpeg version N-111652-gbf9f6a5e55 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
Input #0, rtsp, from 'rtsp://admin:XXXXXX@10.0.0.12:5001/H.265':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 33429.101922, bitrate: N/A
  Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 25 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), cuda(pc, bt709, progressive), 1920x1080, q=2-31, 5000 kb/s, 25 fps, 12800 tbn
    Metadata:
      encoder         : Lavc60.22.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp
[out#0/mp4 @ 0x55c79aa61cc0] video:8662kB audio:55kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.101178%
frame=  349 fps= 32 q=20.0 Lsize=    8725kB time=00:00:13.80 bitrate=5179.6kbits/s speed=1.27x
Exiting normally, received signal 2.
Any ideas? It's driving me crazy seeing the CPU all the time at 100%

Thanks,
Ed
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by Magic919 »

Have a Google and see if it can work and what it achieves.
-
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

Nobody with ideas? :cry:

I have written a bash wrapper for the ffmpeg binary to look for the arguments zoneminder uses, and configured in Zoneminder options the PATH_FFMPEG="/usr/local/bin/ffmpeg_wrapper.sh" to point to that wrapper scritpt. However It seems that zoneminder does not use that option at all

Inside the script I have:

Code: Select all

#!/bin/bash
echo "ffmpeg -hwaccel cuda -hwaccel_output_format cuda $@" >> /tmp/ffmpeg.log
ffmpeg -hwaccel cuda -hwaccel_output_format cuda "$@"
After restarting zoneminder and the computer I do not see any logged activity in the file "/tmp/ffmpeg.log". Obvious if I manually run the ffmpeg_wrapper.sh I see the call and all arguments in the /tmp/ffmpeg.log file.

Is there anything I am missing with the cuda and ffmpeg feature here?
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by iconnor »

1.34 is ancient and not supported. You need to come up to at least 1.36.
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

Well, me again.. sad to say I have installed 1.36.26, installed cuda, compile ffmpeg with cuda support, played with new encoding options of zoneminder but still I haven't get the cuda working.

- I created a new file "/etc/zm/conf.d/03-ffmpeg.con" pointing to ZM_PATH_FFMPEG="/usr/local/bin/ffmpeg" but still that did not work. I tried using the wrapper I mentioned above without any signs of a call from zoneminder.
- I also broke the ffmpeg libraries of the operative system that supposly zoneminder uses by commenting the file "/etc/ld.so.conf" and running the ldconfig command. So after this ffmpeg binary stopped working, but zoneminder still works so it is not clear at this point which binaries or libraries are used and from where they are being taken (there is no log at all about this).

I do not know how many people uses cuda but this is sad, I love zoneminder but I feel that only the developers understand this. It would be nice to have a clean tutorial to know how to enable the cuda, I am even willing to write it but the truth is that things are so complicated that I am afraid it is something really far from me.

My intention is to enable cuda to encode the jpeg images that come from the camera, so I have configured
In general tab:
- Source Type=ffmpeg
- Function=mocord
in Source tab
DecoderHWAccelName=cuda
in the storage tab:
- Save JPEGs=Frames only
- Video Writer=Encode (which as I understand uses ffmpeg to generate jpeg images)

I have read https://wiki.zoneminder.com/Ffmpeg and as I understand the image saving process of frames to jpeg should use cuda and ffmpeg. Can somebody confirm this? Is there something I should read or change somewhere?

This is what I see in the logs

Code: Select all

08/05/23 16:43:41.776560 zmc_m1[4051].DB1-zm_ffmpeg.cpp/304 [codec: hevc video]
08/05/23 16:43:41.776567 zmc_m1[4051].DB1-zm_ffmpeg.cpp/232 [90k stream tb numerator]
08/05/23 16:43:41.776577 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/441 [vdpau]
08/05/23 16:43:41.776583 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/441 [vaapi]
08/05/23 16:43:41.776589 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/441 [qsv]
08/05/23 16:43:41.776595 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/441 [drm]
08/05/23 16:43:41.776601 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/441 [opencl]
08/05/23 16:43:41.776607 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/448 [Found hwdevice cuda]
08/05/23 16:43:41.776614 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/468 [Decoder hevc hwConfig doesn't match our type: cuda != vaapi, pix_fmt vaapi_vld.]
08/05/23 16:43:41.776634 zmc_m1[4051].DB1-zm_ffmpeg_camera.cpp/468 [Decoder hevc hwConfig doesn't match our type: cuda != vdpau, pix_fmt vdpau.]
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

/Update

I tried forcing the "LD_LIBRARY_PATH" inside zoneminder start script "/usr/bin/zmpkg.pl" as that env variable was mentioned here https://wiki.zoneminder.com/Ffmpeg, but that did not work :cry:

Code: Select all

$ sudo nano /usr/bin/zmpkg.pl
...
# Detaint our environment
$ENV{PATH}  = '/bin:/usr/bin:/usr/local/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
$ENV{LD_LIBRARY_PATH} = '/usr/local/lib';
...
I restarted zoneminder and I still can see in the logs: vaapi, qsv, drm, opencl. So my understaing so far is that those device hardware are being resolved from the zoneminder compilation libraries but not from runtime libraries, which should be referenced by the LD_LIBRARY_PATH variable that I am forcing above.

Code: Select all

08/05/23 23:00:16.419537 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/441 [vdpau]
08/05/23 23:00:16.419543 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/441 [vaapi]
08/05/23 23:00:16.419549 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/441 [qsv]
08/05/23 23:00:16.419555 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/441 [drm]
08/05/23 23:00:16.419561 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/441 [opencl]
08/05/23 23:00:16.419567 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/448 [Found hwdevice cuda]
08/05/23 23:00:16.419586 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/468 [Decoder hevc hwConfig doesn't match our type: cuda != vaapi, pix_fmt vaapi_vld.]
08/05/23 23:00:16.419594 zmc_m1[44817].DB1-zm_ffmpeg_camera.cpp/468 [Decoder hevc hwConfig doesn't match our type: cuda != vdpau, pix_fmt vdpau.]
Content directory with my ffmpeg compilation supporting cuda

Code: Select all

me@cameras:/usr/local/lib $ ls -la
total 23828
drwxr-xr-x  4 root root     4096 Aug  5 22:32 .
drwxr-xr-x 11 root root     4096 Aug  4 23:47 ..
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavcodec.so -> libavcodec.so.60.22.100
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavcodec.so.60 -> libavcodec.so.60.22.100
-rwxr-xr-x  1 root root 13608040 Aug  5 22:32 libavcodec.so.60.22.100
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavdevice.so -> libavdevice.so.60.2.101
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavdevice.so.60 -> libavdevice.so.60.2.101
-rwxr-xr-x  1 root root    60208 Aug  5 22:32 libavdevice.so.60.2.101
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavfilter.so -> libavfilter.so.9.10.100
lrwxrwxrwx  1 root root       23 Aug  5 22:32 libavfilter.so.9 -> libavfilter.so.9.10.100
-rwxr-xr-x  1 root root  6522000 Aug  5 22:32 libavfilter.so.9.10.100
lrwxrwxrwx  1 root root       24 Aug  5 22:32 libavformat.so -> libavformat.so.60.10.100
lrwxrwxrwx  1 root root       24 Aug  5 22:32 libavformat.so.60 -> libavformat.so.60.10.100
-rwxr-xr-x  1 root root  2545120 Aug  5 22:32 libavformat.so.60.10.100
lrwxrwxrwx  1 root root       22 Aug  5 22:32 libavutil.so -> libavutil.so.58.14.100
lrwxrwxrwx  1 root root       22 Aug  5 22:32 libavutil.so.58 -> libavutil.so.58.14.100
-rwxr-xr-x  1 root root   940776 Aug  5 22:32 libavutil.so.58.14.100
lrwxrwxrwx  1 root root       25 Aug  5 22:32 libswresample.so -> libswresample.so.4.11.100
lrwxrwxrwx  1 root root       25 Aug  5 22:32 libswresample.so.4 -> libswresample.so.4.11.100
-rwxr-xr-x  1 root root   125304 Aug  5 22:32 libswresample.so.4.11.100
lrwxrwxrwx  1 root root       21 Aug  5 22:32 libswscale.so -> libswscale.so.7.3.100
lrwxrwxrwx  1 root root       21 Aug  5 22:32 libswscale.so.7 -> libswscale.so.7.3.100
-rwxr-xr-x  1 root root   567704 Aug  5 22:32 libswscale.so.7.3.100
drwxr-xr-x  2 root root     4096 Aug  5 22:32 pkgconfig
drwxr-xr-x  3 root root     4096 Aug  4 22:43 python3.9
ffmpeg supported accelerations, which shows cuda, and versions match with above directory content

Code: Select all

me@cameras:/usr/local/lib $ ffmpeg -hwaccels
ffmpeg version N-111697-gdcd0c79f7e Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
Hardware acceleration methods:
cuda
me@cameras:/usr/local/lib $
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

/Update 2

Last try for today, I should forget about the DecoderHWAccelName I guess. Trying the encoding features do not either work, I might be doing something really wrong I guess

In storage tab I have:
- Save JPEGs: Frames only
- Video Writer: encode, h265/hevc, hevc_nvenc

In logs I have this error

Code: Select all

me@cameras:/var/log/zm $ sudo head -n300 zmc_m1.log | grep store
08/05/23 23:48:21.356567 zmc_m1[5779].DB1-zm_videostore.cpp/119 [Opening video storage stream /var/cache/zoneminder/events/1/2023-08-05/93/93-video.mp4 format: mp4]
08/05/23 23:48:21.356694 zmc_m1[5779].DB2-zm_videostore.cpp/208 [Codec wanted 173 hevc]
08/05/23 23:48:21.356703 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name hevc_vaapi != hevc_nvenc]
08/05/23 23:48:21.356837 zmc_m1[5779].DB1-zm_videostore.cpp/232 [Didn't find encoder for hevc_nvenc]
08/05/23 23:48:21.356848 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name libx265 != hevc_nvenc]
08/05/23 23:48:21.356854 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name h264_vaapi != hevc_nvenc]
08/05/23 23:48:21.356861 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name h264_nvenc != hevc_nvenc]
08/05/23 23:48:21.356867 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name h264_omx != hevc_nvenc]
08/05/23 23:48:21.356874 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name h264 != hevc_nvenc]
08/05/23 23:48:21.356880 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name libx264 != hevc_nvenc]
08/05/23 23:48:21.356886 zmc_m1[5779].DB1-zm_videostore.cpp/216 [Not the right codec name mjpeg != hevc_nvenc]
08/05/23 23:48:21.356893 zmc_m1[5779].ERR-zm_videostore.cpp/343 [Can't open video codec!]
08/05/23 23:48:21.356935 zmc_m1[5779].WAR-zm_event.cpp/703 [Failed to open videostore, turning on jpegs]
User avatar
burger
Posts: 434
Joined: Mon May 11, 2020 4:32 pm

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by burger »

Did you check this article:
https://wiki.zoneminder.com/GPU_passthrough_in_VMWare

It's about the only writeup regarding GPUs I can recall here. I've personally setup the RPI onboard GPUs, but never x86 nvidia ones.

Honestly, CPU w/passthrough works pretty well. If you must use a GPU, just keep in mind you are in less charted territory, and basically on your own. Setup logs to debug, look through source code, etc... It's been said a couple times, but GPUs are only partially supported, and the CPU gets used anyways, so it's essentially a WIP.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
CocodriloDundee
Posts: 9
Joined: Mon Jul 31, 2023 12:24 am

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by CocodriloDundee »

Hi everybody,
This week I reinstalled everything from zero updating all versions, I finally could get the cuda working (running zm in native host, no docker). This are the installed software and versions in order in case anyone needs it.

1) Debian-12.5.0-amd64 (Bookworm)
2) Zoneminder 1.36.33 installation guide for Debian 12 (Bookworm) (https://zoneminder.readthedocs.io/en/st ... 2-bookworm)
3) The zoneminder installation installed between dependencies the ffmpeg. At this point I have to say that after running "ffmpeg -hwaccels" I saw "cuda" in the "Hardware acceleration methods", which was new as in previous version this option was not available.

Code: Select all

$ ffmpeg -hwaccels
ffmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
...
...
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Hardware acceleration methods:
vdpau
cuda
vaapi
qsv
drm
opencl
vulkan

4) I tested the ffmpeg with the cuda option but did not work due to the missing library 'libcuda.so.1'. So a this point I proceeded installing the nvidia cuda toolkit 'cuda_12.5.0_555.42.02_linux.run'. (https://developer.nvidia.com/cuda-downloads)
5) I updated the file /etc/ld.so.conf with the cuda library path and then I did run "ldconfig" as root (This is step is mentioned by the cuda installer at the end)

Code: Select all

$ sudo su -
# echo "/usr/local/cuda-12.5/lib64" > /etc/ld.so.conf
# cat  /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/cuda-12.5/lib64
# ldconfig
# exit
$ exit
6) After the installation of the cuda toolkit I tested again the ffmpeg cuda option and it started working, so I did not needed to compile ffmpeg or anything like that.
7) I updated the file "/etc/zm/conf.d/03-ffmpeg.conf" with the value ZM_PATH_FFMPEG="/usr/local/bin/ffmpeg"
8 ) I updated the file "/etc/zm/conf.d/01-system-paths.conf" with the value ZM_PATH_FFMPEG="/usr/local/bin/ffmpeg"
9) In zoneminder "options/images" I enabled the option OPT_FFMPEG=yes
10) In zoneminder, for each configured monitor, under the option "source", I configured both attributes "DecoderHWAccelName" and "DecoderHWAccelDevice" to use cuda. I just entered the text "cuda" in the text box of each option.
11) I restarted the pc and I could see cuda was being used by the executable "/usr/bin/zmc".

Code: Select all

$ nvidia-smi
Sun Jun  9 21:40:40 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.02              Driver Version: 555.42.02      CUDA Version: 12.5     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti     Off |   00000000:01:00.0 Off |                  N/A |
| 30%   41C    P0             55W /  200W |     406MiB /   8192MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A    115586      C   /usr/bin/zmc                                  212MiB |
|    0   N/A  N/A    128327      C   /usr/bin/zmc                                  180MiB |
+-----------------------------------------------------------------------------------------+
I hope this can be util :P

Thank you all for the help,
Regards.
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Decoder hevc hwConfig doesn't match our type: cuda

Post by iconnor »

Well done.

Just want to point out that step 8 isn't needed as 03-ffmpeg.conf will override it. I only mention it because future zoneminder updates may complain about the change to the provided 01-system-paths.conf.

No big deal though.
Post Reply