frigate
frigate copied to clipboard
[HW Accel Support]: Crash with using present hwaccel_args: preset-intel-qsv-h264
Describe the problem you are having
Moved from 0.11 and was using
hwaccel_args: -c:v h264_qsv
now using
hwaccel_args: preset-intel-qsv-h264
Unclear how to debug this as the debug page no longer shows the ffmpeg command that is being run so I can manually run it to see the error.
I have one cameras using hwaccel_args: preset-intel-vaapi which seems to work and one camera using no hwaccel and that also works ( the first two below).
If I disable hardware hwaccel in the global settings everything works fine
Version
0.12.0-53D39A1
Frigate config file
database:
path: /db/frigate.db
mqtt:
host: XXX
user: mqtt
password: XXX
ffmpeg:
# hwaccel_args: -c:v h264_qsv
hwaccel_args: preset-intel-qsv-h264
detectors:
coral:
type: edgetpu
device: usb
timestamp_style:
# Optional: Position of the timestamp (default: shown below)
# "tl" (top left), "tr" (top right), "bl" (bottom left), "br" (bottom right)
position: "tl"
# Optional: Format specifier conform to the Python package "datetime" (default: shown below)
# Additional Examples:
# german: "%d.%m.%Y %H:%M:%S"
format: "%m/%d/%Y %H:%M:%S"
# Optional: Color of font
color:
# All Required when color is specified (default: shown below)
red: 255
green: 255
blue: 255
# Optional: Line thickness of font (default: shown below)
thickness: 1
# Optional: Effect of lettering (default: shown below)
# None (No effect),
# "solid" (solid background in inverse color of font)
# "shadow" (shadow for font)
effect: solid
birdseye:
# Optional: Enable birdseye view (default: shown below)
enabled: True
# Optional: Width of the output resolution (default: shown below)
width: 1280
# Optional: Height of the output resolution (default: shown below)
height: 720
# Optional: Encoding quality of the mpeg1 feed (default: shown below)
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
quality: 8
# Optional: Mode of the view. Available options are: objects, motion, and continuous
# objects - cameras are included if they have had a tracked object within the last 30 seconds
# motion - cameras are included if motion was detected in the last 30 seconds
# continuous - all cameras are included always
mode: objects
objects:
track:
- person
- dog
- cat
- car
- bear
record:
enabled: True
events:
retain:
default: 10
pre_capture: 5
post_capture: 5
cameras:
attic1: # <------ Name the camera
ffmpeg:
hwaccel_args: preset-intel-vaapi
# hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
inputs:
- path: rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 # <----- Update for your camera
roles:
- detect
- record
record:
enabled: True
retain:
days: 30
mode: motion
objects:
track:
- person
- cat
- bird
motion:
threshold: 5
attic2: # <------ Name the camera
ffmpeg:
hwaccel_args: []
# hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
inputs:
- path: rtsp://XXX:554/cam1/mpeg4 # <----- Update for your camera
roles:
- detect
- record
record:
enabled: True
retain:
days: 30
mode: motion
objects:
track:
- person
- cat
- bird
motion:
threshold: 5
catgenie1: # <------ Name the camera
ffmpeg:
# hwaccel_args: []
# hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
inputs:
- path: rtsp://XXX:554/live/0/h264.sdp # <----- Update for your camera
roles:
- detect
- record
objects:
track:
- person
- cat
motion:
threshold: 5
catgenie2: # <------ Name the camera
ffmpeg:
# hwaccel_args: []
# hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
inputs:
- path: rtsp://XXX:554/live/0/h264.sdp # <----- Update for your camera
roles:
- detect
- record
objects:
track:
- person
- cat
motion:
threshold: 5
driveway1: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 # <----- Update for your camera
roles:
- detect
detect:
enabled: True
record:
enabled: True
driveway2: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 # <----- Update for your camera
roles:
- detect
detect:
enabled: True
record:
enabled: True
--TRUNCATED AS MORE CAMERAS ALL CONFIGURED THE SAME---
docker-compose file or Docker CLI command
version: "3"
services:
frigate:
# image: blakeblackshear/frigate:stable
# image: crzynik/frigate:testing-driver
image: blakeblackshear/frigate:0.12.0-beta1
shm_size: "1024mb"
container_name: frigate
privileged: true
devices:
- /dev/dri:/dev/dri
volumes:
- /disk1/docker/frigate/config:/config
- /disk1/docker/frigate/db:/db
# - /disk1/docker/frigate/media:/media/frigate
- frigate-media:/media/frigate
- /etc/localtime:/etc/localtime:ro
- /dev/bus/usb:/dev/bus/usb
Relevant log output
023-01-05 10:38:36.733070865 [2023-01-05 10:38:36] ffmpeg.frontyard2.detect ERROR : [AVHWDeviceContext @ 0x557928b93280] Error setting child device handle: -17
2023-01-05 10:38:36.733074625 [2023-01-05 10:38:36] frigate.video ERROR : driveway1: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.733076363 [2023-01-05 10:38:36] frigate.video ERROR : driveway1: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.736829250 [2023-01-05 10:38:36] watchdog.garage ERROR : Ffmpeg process crashed unexpectedly for garage.
2023-01-05 10:38:36.737094975 [2023-01-05 10:38:36] watchdog.garage ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2023-01-05 10:38:36.737099123 [2023-01-05 10:38:36] ffmpeg.garage.detect ERROR : [AVHWDeviceContext @ 0x561ebb8a3280] Error setting child device handle: -17
2023-01-05 10:38:36.737963398 [2023-01-05 10:38:36] watchdog.ch-garage ERROR : Ffmpeg process crashed unexpectedly for ch-garage.
2023-01-05 10:38:36.738239223 [2023-01-05 10:38:36] watchdog.ch-garage ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2023-01-05 10:38:36.738242430 [2023-01-05 10:38:36] ffmpeg.ch-garage.detect ERROR : [AVHWDeviceContext @ 0x560cc43b4280] Error setting child device handle: -17
2023-01-05 10:38:36.756873209 [2023-01-05 10:38:36] frigate.video ERROR : backyardandpool1: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.756954064 [2023-01-05 10:38:36] frigate.video ERROR : backyardandpool1: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.766415164 [2023-01-05 10:38:36] frigate.video ERROR : garage: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.766493212 [2023-01-05 10:38:36] frigate.video ERROR : garage: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.771099462 [2023-01-05 10:38:36] frigate.video ERROR : catgenie1: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.771210512 [2023-01-05 10:38:36] frigate.video ERROR : catgenie1: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.784321477 [2023-01-05 10:38:36] frigate.video ERROR : carriagehouseback: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.784402270 [2023-01-05 10:38:36] frigate.video ERROR : carriagehouseback: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.796788396 [2023-01-05 10:38:36] frigate.video ERROR : sideyard: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.796862139 [2023-01-05 10:38:36] frigate.video ERROR : sideyard: ffmpeg process is not running. exiting capture thread...
2023-01-05 10:38:36.811204251 [2023-01-05 10:38:36] frigate.video ERROR : carriagehousefront: Unable to read frames from ffmpeg process.
2023-01-05 10:38:36.811293031 [2023-01-05 10:38:36] frigate.video ERROR : carriagehousefront: ffmpeg process is not running. exiting capture thread...
FFprobe output from your camera
From Driveway1
[ { "return_code": 0, "stderr": {}, "stdout": { "programs": [], "streams": [ { "avg_frame_rate": "10/1", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "display_aspect_ratio": "16:9", "height": 2160, "width": 3840 }, { "avg_frame_rate": "0/0", "bit_rate": "64000", "codec_long_name": "PCM A-law / G.711 A-law" } ] } } ]
Operating system
Other Linux
Install method
Docker Compose
Network connection
Wired
Camera make and model
Amcrest IP8M mostly
Any other information that may be helpful
No response
Setting hwaccel_args: []
won't work unfortunately since it's empty and frigate will just select the global preset that that point.
Also you can still go to /api/config
to see the config and the ffmpeg command that is being run, which would be helpful.
ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -hwaccel_output_format qsv -c:v h264_qsv -user_agent FFmpeg Frigate/0.12.0-53d39a1 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway1-%Y%m%d%H%M%S.mp4 -vf vpp_qsv=framerate=5:scale_mode=1:w=1280:h=720:detail=50:denoise=100:deinterlace=2:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo pipe:
The error is
[AVHWDeviceContext @ 0x55ee18a953c0] Error setting child device handle: -17 Segmentation fault (core dumped)
If you stop using the preset does it work?
That also seems different than the log that was posted in the other issue, are you not seeing that anymore?
originally I was not using the preset- I was still using the original HWACCEL command. That caused a different error.
Now i'm using the present and getting the error I described above
ffmpeg: hwaccel_args: preset-intel-qsv-h264
if I comment out both the above lines and restart everything works perfectly (but high CPU)
Can you try these commands manually and let me know what the output is?
ffmpeg -hide_banner -loglevel warning -c:v h264_qsv -user_agent FFmpeg Frigate/0.12.0-53d39a1 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway1-%Y%m%d%H%M%S.mp4 -pix_fmt yuv420p -f rawvideo pipe:
ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -hwaccel_output_format qsv -c:v h264_qsv -user_agent FFmpeg Frigate/0.12.0-53d39a1 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway1-%Y%m%d%H%M%S.mp4 -vf vpp_qsv=framerate=5:scale_mode=1:w=1280:h=720:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo pipe:
(NOTE: I put my camera details back into the command)
ffmpeg -hide_banner -loglevel warning -c:v h264_qsv -user_agent FFmpeg Frigate/0.12.0-53d39a1 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway1-%Y%m%d%H%M%S.mp4 -pix_fmt yuv420p -f rawvideo pipe:
gives
[NULL @ 0x564f1aa74b80] Unable to find a suitable output format for 'Frigate/0.12.0-53d39a1' Frigate/0.12.0-53d39a1: Invalid argument
Second command
ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -hwaccel_output_format qsv -c:v h264_qsv -user_agent FFmpeg Frigate/0.12.0-53d39a1 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://XXX:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway1-%Y%m%d%H%M%S.mp4 -vf vpp_qsv=framerate=5:scale_mode=1:w=1280:h=720:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo pipe:
Gives
[AVHWDeviceContext @ 0x5556e401b3c0] Error setting child device handle: -17 Segmentation fault (core dumped)
Can you remove the -user_agent frigate... part and try both again?
Thanks for the help
The first command now works - i see data in the piped output
The second command gives this error
[AVHWDeviceContext @ 0x562f20447200] Error setting child device handle: -17 Segmentation fault (core dumped)
Thanks, can you try using vaapi globally in the frigate config and see if any cameras have problems?
using this globally yields no errors
hwaccel_args: preset-intel-vaapi
all cameras work
In that case I'd recommend sticking with vaapi, it seems there's some issue with the qsv implementation for your iGPU
Or you can wait until the next beta comes out and not use a preset at all and use qsv.
I'm going to field more usages to see how common this is, but I'm unable to reproduce it and haven't had any other reports of issues.
Thanks - it was working fine with qsv when i used the driver test docker image
image: crzynik/frigate:testing-driver
Right, it seems to be an issue with the video filters and outputting the video format as qsv instead of yuv420p directly, segfault implies it crashed.
You will likely find better performance with vaapi and these filters, there's no real benefit to one or the other.
If this is common issue then may make sense to provide an option to disable the qsv output format or maybe just disable it entirely, but that remains to be seen.
Should be fixed with beta2 as you can continue to use vaapi or you can set the hwaccel args manually to -c:v h264_qsv
and it will work. Please create a new issue if something else comes up.
Not sure if you're still looking in to this, but I have the same issue. I can only get vaapi working with my 12th gen N95 CPU. I was able to get QSV working with 0.11 previously with a modified docker build. I also noticed that VAAPI with 0.12 takes up more CPU usage compared to QSV on 0.11.
my custom docker build for 0.11:
FROM blakeblackshear/frigate:stable
RUN rm -f /etc/apt/sources.list.d/coral-edgetpu.list && apt update && apt install -y gnupg
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list && \
wget -O- https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN echo "deb https://repo.jellyfin.org/debian bullseye main" > /etc/apt/sources.list.d/jellyfin.list && \
wget -O- https://repo.jellyfin.org/jellyfin_team.gpg.key | apt-key add -
RUN echo 'deb http://deb.debian.org/debian testing main non-free' >> /etc/apt/sources.list
RUN apt update
RUN apt install -y -t testing intel-media-va-driver-non-free intel-opencl-icd intel-opencl-icd libmfx1 libmfx-tools libmfx-gen-dev libmfx-gen1.2 i965-va-driver
RUN apt -y install libedgetpu1-max jellyfin-ffmpeg5
RUN rm -rf /usr/lib/btbn-ffmpeg
ENV PATH="$PATH:/usr/lib/jellyfin-ffmpeg"
If VAAPI works, just use that. No need to try and get QSV to work.