frigate
frigate copied to clipboard
[HW Accel Support]: Cant get Hardware excelration to work
Describe the problem you are having
Im running frigate in docker but I cant get the hwaccel_args: preset-vaapi to work. When I add this to my config files my cameras will not show. I get error in the log that says : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Im using Dell Inc. OptiPlex 9020M Mesa Intel® HD Graphics 4600 (HSW GT2) Debian bookworm with docker
Version
0.12.1-367d724
Frigate config file
mqtt:
host: 192.168.0.183
port: 1883 # <---- same mqtt broker that home assistant uses
user: dakotasoukup
password:
ffmpeg:
hwaccel_args: preset-vaapi
detectors:
ov:
type: openvino
device: AUTO
model:
path: /openvino-model/ssdlite_mobilenet_v2.xml
record:
enabled: True
retain:
days: 7
mode: motion
events:
retain:
default: 30
mode: motion
snapshots:
enabled: True
retain:
default: 30
model:
width: 300
height: 300
input_tensor: nhwc
input_pixel_format: bgr
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
birdseye:
enabled: True
mode: continuous
cameras:
Backyard: # <--- this will be changed to your actual camera later
enabled: True
ffmpeg:
inputs:
- path: rtsp://admin:[email protected]/media/video1
roles:
- detect
front: # <--- this will be changed to your actual camera later
enabled: True
ffmpeg:
inputs:
- path: rtsp://Admin:[email protected]/stream0?username=admin&password=E10ADC3949BA59ABBE56E057F20F883E
roles:
- detect
front2: # <--- this will be changed to your actual camera later
enabled: True
ffmpeg:
inputs:
- path: rtsp://admin:[email protected]:554
roles:
- detect
driveway: # <--- this will be changed to your actual camera later
enabled: True
ffmpeg:
inputs:
- path: rtsp://admin:[email protected]/media/video1
roles:
- detect
garage: # <--- this will be changed to your actual camera later
enabled: True
ffmpeg:
inputs:
- path: rtsp://admin:[email protected]/media/video1
roles:
- detect
go2rtc:
streams:
front2:
- rtsp://admin:[email protected]:554
front:
- rtsp://Admin:[email protected]/stream0?username=admin&password=E10ADC3949BA59ABBE56E057F20F883E
Backyard:
- rtsp://admin:[email protected]/media/video1
driveway:
- rtsp://admin:[email protected]/media/video1
garage:
- rtsp://admin:[email protected]/media/video1
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: ghcr.io/blakeblackshear/frigate:stable
shm_size: "100mb" # update for your cameras based on calculation above
devices:
- /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
- /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
- /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
- /config/config.yml:/config/config.yml:ro
- /media/dakota/storage/media:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "5000:5000"
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "password"
Relevant log output
2024-02-08 23:24:08.743351712 [2024-02-08 23:24:08] frigate.video ERROR : front: Unable to read frames from ffmpeg process.
2024-02-08 23:24:08.744067333 [2024-02-08 23:24:08] frigate.video ERROR : front: ffmpeg process is not running. exiting capture thread...
2024-02-08 23:24:12.415198244 172.18.0.1 - - [08/Feb/2024:23:24:12 +0000] "GET /api/stats HTTP/1.1" 200 3188 "-" "HomeAssistant/2024.1.0 aiohttp/3.9.1 Python/3.11" "-"
2024-02-08 23:24:16.938563698 [2024-02-08 23:24:16] watchdog.Backyard ERROR : Ffmpeg process crashed unexpectedly for Backyard.
2024-02-08 23:24:16.939224573 [2024-02-08 23:24:16] watchdog.Backyard ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-02-08 23:24:16.939958263 [2024-02-08 23:24:16] ffmpeg.Backyard.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
2024-02-08 23:24:16.940412378 [2024-02-08 23:24:16] ffmpeg.Backyard.detect ERROR : Error parsing options for output file vaapi.
2024-02-08 23:24:16.940885316 [2024-02-08 23:24:16] ffmpeg.Backyard.detect ERROR : Error opening output files: Invalid argument
2024-02-08 23:24:16.999517735 [2024-02-08 23:24:16] watchdog.garage ERROR : Ffmpeg process crashed unexpectedly for garage.
2024-02-08 23:24:17.000574785 [2024-02-08 23:24:16] watchdog.garage ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-02-08 23:24:17.000699599 [2024-02-08 23:24:16] ffmpeg.garage.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
2024-02-08 23:24:17.001139355 [2024-02-08 23:24:16] ffmpeg.garage.detect ERROR : Error parsing options for output file vaapi.
2024-02-08 23:24:17.001486458 [2024-02-08 23:24:16] ffmpeg.garage.detect ERROR : Error opening output files: Invalid argument
2024-02-08 23:24:17.001743649 [2024-02-08 23:24:16] watchdog.front ERROR : Ffmpeg process crashed unexpectedly for front.
2024-02-08 23:24:17.002037989 [2024-02-08 23:24:16] watchdog.front ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-02-08 23:24:17.002247736 [2024-02-08 23:24:16] ffmpeg.front.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
2024-02-08 23:24:17.002555634 [2024-02-08 23:24:16] ffmpeg.front.detect ERROR : Error parsing options for output file vaapi.
2024-02-08 23:24:17.002873815 [2024-02-08 23:24:16] ffmpeg.front.detect ERROR : Error opening output files: Invalid argument
2024-02-08 23:24:17.011273500 [2024-02-08 23:24:16] watchdog.driveway ERROR : Ffmpeg process crashed unexpectedly for driveway.
2024-02-08 23:24:17.012566160 [2024-02-08 23:24:16] watchdog.driveway ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-02-08 23:24:17.012578869 [2024-02-08 23:24:16] ffmpeg.driveway.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
2024-02-08 23:24:17.012899258 [2024-02-08 23:24:16] ffmpeg.driveway.detect ERROR : Error parsing options for output file vaapi.
2024-02-08 23:24:17.013212238 [2024-02-08 23:24:16] ffmpeg.driveway.detect ERROR : Error opening output files: Invalid argument
2024-02-08 23:24:17.025148581 [2024-02-08 23:24:17] watchdog.front2 ERROR : Ffmpeg process crashed unexpectedly for front2.
2024-02-08 23:24:17.026912540 [2024-02-08 23:24:17] watchdog.front2 ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-02-08 23:24:17.026920564 [2024-02-08 23:24:17] ffmpeg.front2.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
2024-02-08 23:24:17.026923726 [2024-02-08 23:24:17] ffmpeg.front2.detect ERROR : Error parsing options for output file vaapi.
2024-02-08 23:24:17.026926157 [2024-02-08 23:24:17] ffmpeg.front2.detect ERROR : Error opening output files: Invalid argument
2024-02-08 23:24:17.974619140 [2024-02-08 23:24:17] frigate.video ERROR : front2: Unable to read frames from ffmpeg process.
2024-02-08 23:24:17.975453828 [2024-02-08 23:24:17] frigate.video ERROR : front2: ffmpeg process is not running. exiting capture thread...
2024-02-08 23:24:18.320499688 [2024-02-08 23:24:18] frigate.video ERROR : Backyard: Unable to read frames from ffmpeg process.
2024-02-08 23:24:18.321228746 [2024-02-08 23:24:18] frigate.video ERROR : Backyard: ffmpeg process is not running. exiting capture thread...
2024-02-08 23:24:18.340354632 [2024-02-08 23:24:18] frigate.video ERROR : garage: Unable to read frames from ffmpeg process.
2024-02-08 23:24:18.340742441 [2024-02-08 23:24:18] frigate.video ERROR : garage: ffmpeg process is not running. exiting capture thread...
2024-02-08 23:24:18.393685777 [2024-02-08 23:24:18] frigate.video ERROR : driveway: Unable to read frames from ffmpeg process.
2024-02-08 23:24:18.395244706 [2024-02-08 23:24:18] frigate.video ERROR : driveway: ffmpeg process is not running. exiting capture thread...
2024-02-08 23:24:18.797436242 [2024-02-08 23:24:18] frigate.video ERROR : front: Unable to read frames from ffmpeg process.
2024-02-08 23:24:18.797444531 [2024-02-08 23:24:18] frigate.video ERROR : front: ffmpeg process is not running. exiting capture thread...
FFprobe output from your camera
ffprobe rtsp://admin:[email protected]/media/video1
ffprobe version 5.1.4-0+deb12u1 Copyright (c) 2007-2023 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
configuration: --prefix=/usr --extra-version=0+deb12u1 --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-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --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 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
[rtsp @ 0x55fc7e1b9700] max delay reached. need to consume packet
[rtsp @ 0x55fc7e1b9700] RTP: missed 1 packets
[rtsp @ 0x55fc7e1b9700] max delay reached. need to consume packet
[rtsp @ 0x55fc7e1b9700] RTP: missed 1 packets
[rtsp @ 0x55fc7e1b9700] max delay reached. need to consume packet
[rtsp @ 0x55fc7e1b9700] RTP: missed 1 packets
[rtsp @ 0x55fc7e1b9700] max delay reached. need to consume packet
[rtsp @ 0x55fc7e1b9700] RTP: missed 1 packets
[rtsp @ 0x55fc7e1b9700] max delay reached. need to consume packet
[rtsp @ 0x55fc7e1b9700] RTP: missed 1 packets
[h264 @ 0x55fc7e1be400] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x55fc7e1be400] error while decoding MB 0 61, bytestream 176658
[h264 @ 0x55fc7e1be400] concealing 5557 DC, 5557 AC, 5557 MV errors in I frame
Input #0, rtsp, from 'rtsp://admin:[email protected]/media/video1':
Metadata:
title : VCP IPC Realtime stream
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 2592x1520, 20 fps, 20 tbr, 90k tbn
Stream #0:1: Data: none
Unsupported codec with id 0 for input stream 1
Operating system
Debian
Install method
Docker Compose
Network connection
Wired
Camera make and model
unknown
Any other information that may be helpful
No response
you need to set the LIBVA_DRIVE_NAME to i965 so that it uses the correct driver for your platform
Im a noob. How do I do that?
add LIBVA_DRIVER_NAME: i965 to the environment section of your docker compose file
Like this?
Yes
Okay I did that. Im still getting the error. Any other ideas?
Let the logs run longer then post
2024-02-08 23:56:37.003173738 [2024-02-08 23:56:36] watchdog.Backyard ERROR : Ffmpeg process crashed unexpectedly for Backyard. 2024-02-08 23:56:37.003412981 [2024-02-08 23:56:36] watchdog.front ERROR : The following ffmpeg logs include the last 100 lines prior to exit. 2024-02-08 23:56:37.003656206 [2024-02-08 23:56:36] watchdog.Backyard ERROR : The following ffmpeg logs include the last 100 lines prior to exit. 2024-02-08 23:56:37.003865238 [2024-02-08 23:56:36] ffmpeg.Backyard.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. 2024-02-08 23:56:37.004035445 [2024-02-08 23:56:36] ffmpeg.front.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. 2024-02-08 23:56:37.004204476 [2024-02-08 23:56:36] ffmpeg.Backyard.detect ERROR : Error parsing options for output file vaapi. 2024-02-08 23:56:37.004371120 [2024-02-08 23:56:36] ffmpeg.front.detect ERROR : Error parsing options for output file vaapi. 2024-02-08 23:56:37.004536098 [2024-02-08 23:56:36] ffmpeg.Backyard.detect ERROR : Error opening output files: Invalid argument 2024-02-08 23:56:37.004720659 [2024-02-08 23:56:36] ffmpeg.front.detect ERROR : Error opening output files: Invalid argument 2024-02-08 23:56:37.024616348 [2024-02-08 23:56:37] watchdog.garage ERROR : Ffmpeg process crashed unexpectedly for garage. 2024-02-08 23:56:37.024751329 [2024-02-08 23:56:37] watchdog.garage ERROR : The following ffmpeg logs include the last 100 lines prior to exit. 2024-02-08 23:56:37.024893974 [2024-02-08 23:56:37] ffmpeg.garage.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. 2024-02-08 23:56:37.025078855 [2024-02-08 23:56:37] ffmpeg.garage.detect ERROR : Error parsing options for output file vaapi. 2024-02-08 23:56:37.025179720 [2024-02-08 23:56:37] watchdog.driveway ERROR : Ffmpeg process crashed unexpectedly for driveway. 2024-02-08 23:56:37.025322325 [2024-02-08 23:56:37] watchdog.front2 ERROR : Ffmpeg process crashed unexpectedly for front2. 2024-02-08 23:56:37.025442469 [2024-02-08 23:56:37] watchdog.driveway ERROR : The following ffmpeg logs include the last 100 lines prior to exit. 2024-02-08 23:56:37.025557661 [2024-02-08 23:56:37] watchdog.front2 ERROR : The following ffmpeg logs include the last 100 lines prior to exit. 2024-02-08 23:56:37.025708522 [2024-02-08 23:56:37] ffmpeg.driveway.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. 2024-02-08 23:56:37.025817985 [2024-02-08 23:56:37] ffmpeg.front2.detect ERROR : Option hwaccel (use HW accelerated decoding) cannot be applied to output url vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. 2024-02-08 23:56:37.025918356 [2024-02-08 23:56:37] ffmpeg.driveway.detect ERROR : Error parsing options for output file vaapi. 2024-02-08 23:56:37.026021759 [2024-02-08 23:56:37] ffmpeg.front2.detect ERROR : Error parsing options for output file vaapi. 2024-02-08 23:56:37.026113766 [2024-02-08 23:56:37] ffmpeg.driveway.detect ERROR : Error opening output files: Invalid argument 2024-02-08 23:56:37.026211597 [2024-02-08 23:56:37] ffmpeg.front2.detect ERROR : Error opening output files: Invalid argument 2024-02-08 23:56:37.032236869 172.18.0.1 - - [08/Feb/2024:23:56:37 +0000] "GET /api/config HTTP/1.1" 200 15464 "http://localhost:5000/logs" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" "-" 2024-02-08 23:56:37.033614412 [2024-02-08 23:56:37] ffmpeg.garage.detect ERROR : Error opening output files: Invalid argument 2024-02-08 23:56:37.160016783 172.18.0.1 - - [08/Feb/2024:23:56:37 +0000] "GET /api/logs/frigate HTTP/1.1" 200 20194 "http://localhost:5000/logs" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" "-" 2024-02-08 23:56:37.259913841 172.18.0.1 - - [08/Feb/2024:23:56:37 +0000] "GET /api/logs/go2rtc HTTP/1.1" 200 260 "http://localhost:5000/logs" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" "-" 2024-02-08 23:56:37.367566219 172.18.0.1 - - [08/Feb/2024:23:56:37 +0000] "GET /api/logs/nginx HTTP/1.1" 200 1593 "http://localhost:5000/logs" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" "-" 2024-02-08 23:56:37.989397993 [2024-02-08 23:56:37] frigate.video ERROR : front2: Unable to read frames from ffmpeg process. 2024-02-08 23:56:37.989562184 [2024-02-08 23:56:37] frigate.video ERROR : front2: ffmpeg process is not running. exiting capture thread... 2024-02-08 23:56:38.361559689 [2024-02-08 23:56:38] frigate.video ERROR : garage: Unable to read frames from ffmpeg process. 2024-02-08 23:56:38.361778622 [2024-02-08 23:56:38] frigate.video ERROR : garage: ffmpeg process is not running. exiting capture thread... 2024-02-08 23:56:38.379352512 [2024-02-08 23:56:38] frigate.video ERROR : Backyard: Unable to read frames from ffmpeg process. 2024-02-08 23:56:38.379519182 [2024-02-08 23:56:38] frigate.video ERROR : Backyard: ffmpeg process is not running. exiting capture thread... 2024-02-08 23:56:38.393192938 [2024-02-08 23:56:38] frigate.video ERROR : driveway: Unable to read frames from ffmpeg process. 2024-02-08 23:56:38.393390326 [2024-02-08 23:56:38] frigate.video ERROR : driveway: ffmpeg process is not running. exiting capture thread... 2024-02-08 23:56:38.710560569 [2024-02-08 23:56:38] frigate.video ERROR : front: Unable to read frames from ffmpeg process. 2024-02-08 23:56:38.711054978 [2024-02-08 23:56:38] frigate.video ERROR : front: ffmpeg process is not running. exiting capture thread...
Check the vainfo button on the system page and paste output here
Process Error:
error: XDG_RUNTIME_DIR is invalid or not set in the environment. error: can't connect to X server! error: failed to initialize display
Looks like the host doesn't have gpu drivers installed
what is the best way to download them? or check to see if they are installed in linux.
@NickM-27
I also have problems with OpenVINO - I was trying the below
detectors:
CoralPCIe:
type: edgetpu
device: pci:0
ov:
type: openvino
device: CPU
model:
path: /openvino-model/ssdlite_mobilenet_v2.xml
model:
width: 320
height: 320
input_tensor: nhwc
input_pixel_format: bgr
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
I get the following error which keeps restarting Frigate
2024-03-03 22:38:45.089748952 Traceback (most recent call last):
2024-03-03 22:38:45.089750583 File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-03-03 22:38:45.089751748 self.run()
2024-03-03 22:38:45.089753132 File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-03-03 22:38:45.089754358 self._target(*self._args, **self._kwargs)
2024-03-03 22:38:45.089770894 File "/opt/frigate/frigate/object_detection.py", line 125, in run_detector
2024-03-03 22:38:45.089772609 detections = object_detector.detect_raw(input_frame)
2024-03-03 22:38:45.089774456 File "/opt/frigate/frigate/object_detection.py", line 75, in detect_raw
2024-03-03 22:38:45.089775776 return self.detect_api.detect_raw(tensor_input=tensor_input)
2024-03-03 22:38:45.089777122 File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 84, in detect_raw
2024-03-03 22:38:45.089812131 infer_request.infer([tensor_input])
2024-03-03 22:38:45.089813565 File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 152, in infer
2024-03-03 22:38:45.089815411 return super().infer(normalize_inputs(self, dict(enumerate(inputs))))
2024-03-03 22:38:45.089816843 RuntimeError: The input blob size is not equal to the network input size: got 307200 expecting 270000
Any ideas what I am doing wrong?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.