# run ‘getent group render’ both in container and host
container 108
host 103
# host: add line at /etc/subgid
root:103:1
# calculate mapping:
map 0..107 ct to 100000..100107 host
map 108 ct to 103 host
map 109.. ct to 100109..
# host: add to lxc config /etc/pve/lxc/101.conf
# proxmox 7 use cgroup2 – https://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0#CGroupV2
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 108
lxc.idmap: g 108 103 1
lxc.idmap: g 109 100109 65427
lxc.cgroup.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
# should be working, else force it on host :-pchmod 0666 /dev/dri/renderD128
# check at the container:$ ls -ln /dev/dri/renderD128
crw-rw—- 1 65534 108 226, 128 Dec 23 01:25 /dev/dri/renderD128$ sudo usermod -aG render zmuser
$ sudo usermod -aG render www-data
# DO NOT FORGET to restart after add user to group, its IMPORTANT!
$ cat /dev/dri/renderD128
$ sudo apt install vainfo i965-va-driver
# container: Try using ffmpeg to decode h264$ ffmpeg -v verbose -y -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i rtsp://<user>:<pass>@<ip>:554/stream2 result.mp4
# container: Try using ffmpeg to decode and encode h264$ ffmpeg -v verbose -y -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i rtsp://<user>:<pass>@<ip>:554/stream2 -c:v h264_vaapi -qp 25 result.mp4
# container: Check GPU Utilization at Host:$ sudo apt install intel-gpu-tools
$ sudo intel_gpu_top
For Zoneminder FFMPEG, crf option not available for h264_vaapi
So, set this option: recording -> encoder: h264_vaapi, optional encoder parameters: qp=25
https://yoursunny.com/t/2022/lxc-vaapi/
https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
https://itsembedded.com/sysadmin/proxmox_bind_unprivileged_lxc/
https://trac.ffmpeg.org/wiki/Hardware/QuickSync
https://trac.ffmpeg.org/wiki/Hardware/VAAPI
https://forums.zoneminder.com/viewtopic.php?t=30820
https://github.com/intel/intel-vaapi-driver/blob/master/README