[HW Accel Support]: Nuc 12th gen i5
See original GitHub issueDescribe the problem you are having
I can’t get HW Accel working at all on my new nuc. I was using an 8th gen i5 nuc and had frigate working well with hwaccel using these settings. Using ubuntu and I’m not very experianced with docker or linux, I just bumble my way through most of the time… but this has me stumped.
Without any hwaccel, frigate works fine… but I have 10 cameras, and would much rather hwaccel work reducing CPU usage.
I’ll post all my attempted hwaccel arguments here with errors… I have 4k h265 stream for record stream and a sub stream for detect h264… not sure if it makes a difference, but when I tried using tyhe h264 for recording and detecting, I did get slightly different errors one time.
#1
Note: This was working on my 8th gen, but not 12th.
hwaccel_args:
- -hwaccel
- vaapi
- -hwaccel_device
- /dev/dri/renderD128
- -hwaccel_output_format
- yuv420p
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55ffb9bee940] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55ffb9bee940] libva: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55ffb9bee940] Failed to initialise VAAPI connection: -1 (unknown libva error).
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : Device creation failed: -5.
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : [h264 @ 0x55ffb9bed7c0] No device available for decoder: device type vaapi needed for codec h264.
frigate | [2022-10-21 12:37:57] ffmpeg.01_front.detect ERROR : Device setup failed for decoder on input stream #0:0 : Input/output error
#2
hwaccel_args: -c:v h264_qsv
Errors with h265 record + h264 detect streams
frigate | [2022-10-21 12:44:46] frigate.video ERROR : 01_front: Unable to read frames from ffmpeg process.
frigate | [2022-10-21 12:44:46] frigate.video ERROR : 01_front: ffmpeg process is not running. exiting capture thread...
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] no frame!
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] missing picture in access unit with size 7294
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] no frame!
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] Picture timing SEI payload too large
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] non-existing SPS 14 referenced in buffering period
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] SEI type 19 overread by 8 bits
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] non-existing SPS 0 referenced in buffering period
frigate | [2022-10-21 12:44:46] ffmpeg.01_front.record ERROR : [h264 @ 0x563c316a13c0] SEI type 19 overread by 8 bits
Errors with both record + detect h264 streams
frigate | [2022-10-21 12:46:32] frigate.video ERROR : 01_front: ffmpeg process is not running. exiting capture thread...
frigate | [2022-10-21 12:46:42] watchdog.01_front ERROR : Ffmpeg process crashed unexpectedly for 01_front.
frigate | [2022-10-21 12:46:42] watchdog.01_front ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x5561ce164bc0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x5561ce164bc0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x5561ce13f800] Failed to create a VAAPI device.
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x5561ce13f800] Error initializing an MFX session
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x5561ce13f800] Error decoding header
frigate | [2022-10-21 12:46:42] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Input/output error
#3
Similar errors when I tried both of these
hwaccel_args:
- -hwaccel
- qsv
- -qsv_device
- /dev/dri/renderD128
- -hwaccel_output_format
- qsv
- -c:v
- h264_qsv
- -gpu_copy
- "on"
hwaccel_args: -hwaccel qsv -qsv_device - /dev/dri/renderD128
Errors with both record + detect h264 streams, and the h265 record + h264 detect
frigate | [2022-10-21 12:48:29] watchdog.01_front ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55a6e23346c0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55a6e23346c0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.detect ERROR : Device creation failed: -5.
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.detect ERROR : Failed to set value '/dev/dri/renderD128' for option 'qsv_device': Input/output error
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.detect ERROR : Error parsing global options: Input/output error
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.record ERROR : [AVHWDeviceContext @ 0x556d35f7b880] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.record ERROR : [AVHWDeviceContext @ 0x556d35f7b880] Failed to initialise VAAPI connection: 1 (operation failed).
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.record ERROR : Device creation failed: -5.
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.record ERROR : Failed to set value '/dev/dri/renderD128' for option 'qsv_device': Input/output error
frigate | [2022-10-21 12:48:29] ffmpeg.01_front.record ERROR : Error parsing global options: Input/output error
Version
0.11.1-2EADA21
Frigate config file
mqtt:
host: 192.168.0.10
user: *USER*
password: *PASSWORD*
detectors:
coral:
type: edgetpu
device: usb
ffmpeg:
global_args: -hide_banner -loglevel warning
# hwaccel_args: -hwaccel qsv -qsv_device /dev/dri/renderD128
hwaccel_args: -c:v h264_qsv
# hwaccel_args:
# - -hwaccel
# - vaapi
# - -hwaccel_device
# - /dev/dri/renderD128
# - -hwaccel_output_format
# - yuv420p
# hwaccel_args:
# - -hwaccel
# - qsv
# - -qsv_device
# - /dev/dri/renderD128
# - -hwaccel_output_format
# - qsv
# - -c:v
# - h264_qsv
# - -gpu_copy
# - "on"
# doesn't work with rtmp streams
input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -use_wallclock_as_timestamps 1 -rtsp_transport tcp -timeout 5000000
# input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -use_wallclock_as_timestamps 1
output_args:
detect: -f rawvideo -pix_fmt yuv420p
record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
detect:
width: 640
height: 360
fps: 5
max_disappeared: 25
objects:
# Optional: list of objects to track from labelmap.txt (default: shown below)
track:
- person
- dog
record:
enabled: true
events:
pre_capture: 5
post_capture: 10
objects:
- person
- dog
- car
retain:
default: 5
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 5
rtmp:
enabled: False
live:
height: 360
cameras:
01_front:
ffmpeg:
inputs:
# - path: rtsp://user:password@192.168.0.21:554//h265Preview_01_main
- path: rtsp://user:password@192.168.0.21:554//h264Preview_01_sub
roles:
- record
- path: rtsp://user:password@192.168.0.21:554//h264Preview_01_sub
roles:
- detect
objects:
track:
- person
- car
- dog
detect:
stationary:
interval: 0
threshold: 50
docker-compose file or Docker CLI command
version: '3.9'
services:
frigate:
container_name: frigate
privileged: true # this may not be necessary for all setups
restart: unless-stopped
image: blakeblackshear/frigate:stable
shm_size: "4g"
devices:
- /dev/bus/usb:/dev/bus/usb
- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config/frigate.yml:/config/config.yml:ro
- /media/exhdd/frigate/:/media/frigate
- type: tmpfs # Optional: 8GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 8000000000
ports:
- "5000:5000"
- "1935:1935" # RTMP feeds
# environment:
# - LIBVA_DRIVER_NAME_JELLYFIN=iHD
Relevant log output
frigate | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
frigate | [s6-init] ensuring user provided files have correct perms...exited 0.
frigate | [fix-attrs.d] applying ownership & permissions fixes...
frigate | [fix-attrs.d] done.
frigate | [cont-init.d] executing container initialization scripts...
frigate | [cont-init.d] done.
frigate | [services.d] starting services
frigate | [services.d] done.
frigate | [2022-10-21 13:29:19] frigate.app INFO : Starting Frigate (0.11.1-2eada21)
frigate | Starting migrations
frigate | [2022-10-21 13:29:19] peewee_migrate INFO : Starting migrations
frigate | There is nothing to migrate
frigate | [2022-10-21 13:29:19] peewee_migrate INFO : There is nothing to migrate
frigate | [2022-10-21 13:29:19] detector.coral INFO : Starting detection process: 240
frigate | [2022-10-21 13:29:19] frigate.app INFO : Output process started: 242
frigate | [2022-10-21 13:29:19] ws4py INFO : Using epoll
frigate | [2022-10-21 13:29:19] frigate.app INFO : Camera processor started for 01_front: 247
frigate | [2022-10-21 13:29:19] frigate.app INFO : Capture process started for 01_front: 250
frigate | [2022-10-21 13:29:20] ws4py INFO : Using epoll
frigate | [2022-10-21 13:29:19] frigate.edgetpu INFO : Attempting to load TPU as usb
frigate | [2022-10-21 13:29:23] frigate.edgetpu INFO : TPU found
frigate | [2022-10-21 13:29:39] watchdog.01_front INFO : No frames received from 01_front in 20 seconds. Exiting ffmpeg...
frigate | [2022-10-21 13:29:39] watchdog.01_front INFO : Waiting for ffmpeg to exit gracefully...
frigate | [2022-10-21 13:29:40] frigate.video ERROR : 01_front: Unable to read frames from ffmpeg process.
frigate | [2022-10-21 13:29:40] frigate.video ERROR : 01_front: ffmpeg process is not running. exiting capture thread...
frigate | [2022-10-21 13:29:50] watchdog.01_front ERROR : Ffmpeg process crashed unexpectedly for 01_front.
frigate | [2022-10-21 13:29:50] watchdog.01_front ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55a2b510e2c0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [AVHWDeviceContext @ 0x55a2b510e2c0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Failed to create a VAAPI device.
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error initializing an MFX session
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error decoding header
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Input/output error
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Function not implemented
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Function not implemented
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Function not implemented
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Function not implemented
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] video_get_buffer: image parameters invalid
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : [h264_qsv @ 0x55a2b508bb40] get_buffer() failed
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Error while decoding stream #0:0: Invalid argument
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Finishing stream 0:0 without any data written to it.
frigate | [2022-10-21 13:29:50] ffmpeg.01_front.detect ERROR : Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
frigate | [2022-10-21 13:30:10] watchdog.01_front INFO : No frames received from 01_front in 20 seconds. Exiting ffmpeg...
frigate | [2022-10-21 13:30:10] watchdog.01_front INFO : Waiting for ffmpeg to exit gracefully...
frigate | [2022-10-21 13:30:10] frigate.video ERROR : 01_front: Unable to read frames from ffmpeg process.
frigate | [2022-10-21 13:30:10] frigate.video ERROR : 01_front: ffmpeg process is not running. exiting capture thread...
^CGracefully stopping... (press Ctrl+C again to force)
FFprobe output from your camera
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsp://user:password@192.168.0.21:554//h264Preview_01_sub':
Metadata:
title : Session streamed by "preview"
comment : h264Preview_01_sub
Duration: N/A, start: 0.000438, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x360, 24.92 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsp://user:password@192.168.0.21:554//h265Preview_01_main':
Metadata:
title : Session streamed by "preview"
comment : h265Preview_01_main
Duration: N/A, start: 0.000250, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Operating system
Debian
Install method
Docker Compose
Network connection
Wired
Camera make and model
reolink 822a + 820a
Any other information that may be helpful
Sorry, I know there are a lot of threads about hwaccel, and I think I’ve gone through them all to try and work it out, but I’m not making any progress after hours of tinkering.
Issue Analytics
- State:
- Created a year ago
- Comments:13
Top Related StackOverflow Question
We’re aware of the issue and have been looking into trying a newer driver. There’s a large discussion about it at https://github.com/blakeblackshear/frigate/issues/3941
Found a soltion look at this: https://github.com/blakeblackshear/frigate/discussions/4263