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]
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.
Thanks,
Ed