sclaflin / Plate-Minder

Monitor a video source for license plates and record them. Zero cloud dependencies.
MIT License
155 stars 22 forks source link

Hardware Acceleration - Intel Quicksync Error #10

Open moonilightshaker opened 2 years ago

moonilightshaker commented 2 years ago

Hi, thanks in advance for this helpful project. Especially the Home Assistant integration is useful. Plate-Minder works without the Hardware Acceleration parameters. As soon as I use the suggested parameters, I get the following error messages:

Error: Dahua1_east source failed: Device creation failed: -542398533. [h264_qsv @ 0x5566de18f040] No device available for decoder: device type qsv needed for codec h264_qsv. Device setup failed for decoder on input stream #0:0 : Generic error in an external library at RTSPMJPEGReadable. (file:///app/lib/PlateMinder.js:56:20) at RTSPMJPEGReadable.emit (node:events:390:28) at ChildProcess. (file:///app/lib/MJPEGReadable.js:81:10) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) Error: Dahua1_east source failed: Device setup failed for decoder on input stream #0:0 : Generic error in an external library at RTSPMJPEGReadable. (file:///app/lib/PlateMinder.js:56:20) at RTSPMJPEGReadable.emit (node:events:390:28) at ChildProcess. (file:///app/lib/MJPEGReadable.js:81:10) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) Error: Dahua1_east source failed: Device setup failed for decoder on input stream #0:0 : Generic error in an external library at RTSPMJPEGReadable. (file:///app/lib/PlateMinder.js:56:20) at RTSPMJPEGReadable.emit (node:events:390:28) at ChildProcess. (file:///app/lib/MJPEGReadable.js:81:10) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

Parameters: preInputArgs:

OS: Debian 11 Device testet: Intel NUC NUC5CPYH and Intel NUC NUC10i7FNH

sclaflin commented 2 years ago

You're welcome!

Regarding your issue, it looks like your computer doesn't have support for QuickSync:

[h264_qsv @ 0x5566de18f040] No device available for decoder: device type qsv needed for codec h264_qsv.

moonilightshaker commented 2 years ago

Hi, i have on this PCs, Frigate in a Docker Container installed. The Settings for the are from this Site: https://docs.frigate.video/configuration/hardware_acceleration This is working. I have conformed this with intel-gpu-top: https://wiki.debian.org/HardwareVideoAcceleration Intel_old

According to Intel, both supports Quicksync: https://www.intel.de/content/www/de/de/products/sku/196448/intel-core-i710710u-processor-12m-cache-up-to-4-70-ghz/specifications.html https://ark.intel.com/content/www/de/de/ark/products/91832/intel-celeron-processor-n3060-2m-cache-up-to-2-48-ghz.html https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding

I have setuped with this paramters on the NUC5CPYH. This is working. preInputArgs:

sclaflin commented 2 years ago

Fantastic! I'll see about adding this to the documentation.

moonilightshaker commented 2 years ago

The settings in your documentation work for the NUC NUC10i7FNH. Reinstalled the OS and now it works also.

KidA001 commented 1 year ago

@sclaflin @moonilightshaker I have a Intel Core i5-6500T 2.5 GHz processor with integrated graphics card. It specifies that it supports quicksync. I have access to renderD128 on this machine but the pre input/output logs generate a similar error for me. Any suggestions on figuring out what parameters might work for my setup?

Error I'm getting:

Error: Driveway source failed: Device creation failed: -542398533.
[h264_qsv @ 0x55777835c280] No device available for decoder: device type qsv needed for codec h264_qsv.
Device setup failed for decoder on input stream #0:2 : Generic error in an external library
KidA001 commented 1 year ago

I was able to get this running with the below config. Unclear to me if it's working or not, so if there are any suggestions to validate that it's using hardware acceleration please let me know.

I had two issues. I'm using Proxmox to create an LXC that runs docker. I needed that LXC to be Privileged, and in addition to that I had to add the following to the /etc/pve/lxc/<lxc id>.conf file:

lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file

Then I set my args to the following:

preInputArgs:
  - -hwaccel
  - qsv
  - -qsv_device
  - /dev/dri/renderD128
preOutputArgs:
  - -c:v
  - mjpeg

This seems to be working without errors but I'm not sure how to actually validate whether or not it's taking advantage of hardware acceleration.

Note: If I add the args

- -c:v
- h264_qsv

h264_qsv fails with "Error initializing an internal MFX session: unsupported (-3)". I'm not sure if those args are needed or not. Any input appreciated