-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Support]: unable to add the ffmpeg hardware acceleration for my Raspberry Pi4 #2030
Comments
Have you tried disabling protection mode on the addon? |
Hi. Thanks for the lightening response, and the fantastic add on of course! Yes I have disabled the protection. |
Try changing the log level for the one camera where you have hwaccel: mqtt:
host: 192.168.0.130
port: 1883
topic_prefix: frigate
client_id: frigate
user: <USERNAME>
password: <PASSWORD>
stats_interval: 60
detectors:
coral:
type: edgetpu
device: usb
detect:
width: 640
height: 360
fps: 5
enabled: True
max_disappeared: 25
record:
enabled: True
retain_days: 0
events:
retain:
default: 10
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 10
# Optional: birdseye configuration
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: 31
# 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
cameras:
## Living Room Low Camera
Living_Room_Low:
ffmpeg:
global_args: -hide_banner -loglevel info
hwaccel_args:
- -c:v
- h264_v4l2m2m
inputs:
- path: rtsp://rtsp:<PASSWORD>@192.168.0.206:554/av_stream/ch1
roles:
- detect
- path: rtsp://rtsp:<PASSWORD>@192.168.0.206:554/av_stream/ch0
roles:
- record
objects:
track:
- person
- dog
filters:
person:
threshold: 0.75
min_score: 0.70
dog:
threshold: 0.75
min_score: 0.70
motion:
mask:
- 0,75,209,61,209,0,0,0
- 380,74,482,74,487,24,382,21
## Living Room High Camera
Living_Room_High:
ffmpeg:
inputs:
- path: rtsp://rtsp:<PASSWORD>@192.168.0.205:554/av_stream/ch1
roles:
- detect
- path: rtsp://rtsp:<PASSWORD>@192.168.0.205:554/av_stream/ch0
roles:
- record
objects:
track:
- person
- dog
filters:
person:
threshold: 0.75
min_score: 0.70
dog:
threshold: 0.75
min_score: 0.70
motion:
mask:
- 0,18,155,18,155,0,0,0
## Patio camera
Patio:
ffmpeg:
inputs:
- path: rtsp://rtsp:<PASSWORD>@192.168.0.203:554/av_stream/ch1
roles:
- detect
- path: rtsp://rtsp:<PASSWORD>@192.168.0.203:554/av_stream/ch0
roles:
- record
objects:
track:
- person
- dog
filters:
person:
threshold: 0.75
min_score: 0.70
dog:
threshold: 0.75
min_score: 0.70
motion:
mask:
- 0,108,640,108,640,0,0,0
## Kitchen Camera
Kitchen:
ffmpeg:
inputs:
- path: rtsp://rtsp:<PASSWORD>@192.168.0.204:554/av_stream/ch1
roles:
- detect
- path: rtsp://rtsp:<PASSWORD>@192.168.0.204:554/av_stream/ch0
roles:
- record
objects:
track:
- person
- dog
filters:
person:
threshold: 0.75
min_score: 0.70
dog:
threshold: 0.65
min_score: 0.60
motion:
mask:
- 0,18,155,18,155,0,0,0
zones:
Cam_Zone_Back_Door:
coordinates: 365,243,452,257,471,165,388,154
## Bedroom Camera
Bedroom:
ffmpeg:
inputs:
- path: rtsp://rtsp:<PASSWORD>@192.168.0.207:554/av_stream/ch1
roles:
- detect
- path: rtsp://rtsp:<PASSWORD>@192.168.0.207:554/av_stream/ch0
roles:
- record
objects:
track:
- person
- dog
filters:
person:
threshold: 0.75
min_score: 0.70
dog:
threshold: 0.75
min_score: 0.70
motion:
mask:
- 0,18,155,18,155,0,0,0
|
I noticed that viewing the single camera 'live' shows a white page, debug shows the green square and the fps number changes. I've added log level info, here's what I get: [s6-init] making user provided files available at /var/run/s6/etc...exited 0. |
Strange. Ffmpeg runs, but no frames ever make it through to Frigate. I don't know why that's happening. |
I really don't have a clue what's going on to be honest. I'm happy to do any extra diagnostics suggested. |
Similar situation here Seems to me there a bug was introduced in the latest version |
I think it was failing on the previous version also. I've only recently started using HA and Frigate, this was my first update to Frigate since install. While I was in the config file changing other things (clips, recordings, etc) I tried hardware accel again. |
I had a similar issue on one of my cameras. The hardware accel wouldn't work unless I modified the frame height and width to be consistent with the detect frame size...BUT crucially not the stream framesize, but the size reported as 'Buffer'. I used onvif manager to show this as VLC etc would not.... In my case the buffer was 640x368 when stream was reporting 640x360. I guessed it he hardware encoder is a little more picky....although I have no idea what buffer size is... |
I'm going to try and look at this tonight. I initially used VLC to check the streams so I'll give them onvif manager a go 👍🏻 |
I tried all combinations, it took hours :-( I was drinking alcohol :-) |
@neildotwilliams I see your hardware accel settings are only included under/for one camera, whereas in my configuration they're globally set (ie section before the cameras). Tried that ? |
Hi @jonandel yep, tried that. I removed all other cameras and set it as a global option with just one camera. All of my cameras are the same. |
I couldn't get onvif manager to work with rtsp streams. I looked at VLC again and it did add 8 to the width on both streams in the buffer dimensions. Tried those as options in frigate.yml but didn't work :-( |
I'm having exactly the same problem. Been running Frigate for ages with exactly the same setup without any problems. I recently upgraded Home Assistant and Frigate. Now I can't run with Hardware Acceleration anymore otherwise I get green screen and ffmpeg errors. |
@healeydave did you change the log level and check your logs to make sure you see the same as I suggested above? Also, nobody has posted the specific version of HassOS, etc either. |
Apologies. I'm on the latest version of production: Operating System |
@blakeblackshear Will add the following now to my setup and report back 👍 FYI: I'm running: |
Sorry to hijack your case Neil, but I think we're having the same issue and reporting in one place save's us having to flip between cases and discussions to reach our unified goal :) Ok, I removed all my camera's from my config apart from one and added the loglevel to it. This is what I got from a startup:
|
Oh, and I just noticed that's without HW acceleration because I forgot to uncomment the lines :) |
Frigate startup with hwaccel enabled and green screen:
|
@healeydave I'm just glad I'm not alone 👍🏻 |
@neildotwilliams It looks like we are both running up-to-date Home Assistant versions, maybe this is the common denominator. Perhaps they put a new build of FFMPEG in it that is causing the problem?? |
So this message means that ffmpeg doesnt see the hardware needed for video acceleration:
Are both of you using the "Full Access" version of the addon with protection mode disabled? |
I have Protection Mode disabled but according to the add-on store I have the Frigate NVR installed, not the Full Access version. What is the Full Access version? |
Can you try the full access one? I was expecting the switch to be gone for the non-Full Access version. |
Hey, anybody who is running 0.11.0-3de1948 with Raspberry Pi OS Lite (64Bit)? HW: Raspi 4 4GB getting following errors: frigate | [2022-05-02 15:18:20] watchdog.Front_SB INFO : No frames received from Front_SB in 20 seconds. Exiting ffmpeg... |
Do you have a powered USB hub. It fixed mine!
…On Mon, 2 May 2022 at 09:28, emuell36 ***@***.***> wrote:
Hey,
anybody who is running 0.11.0-3de1948 with Raspberry Pi OS Lite (64Bit)?
I am still getting a green screen as soon as I switch on the hwaccel.
HW: Raspi 4 4GB
OS: Raspberry Pi OS Lite (64Bit)
Frigate: 0.11.0-3de1948
Installation:Docker-Compose
getting following errors:
frigate | [2022-05-02 15:18:20] watchdog.Front_SB INFO : No frames
received from Front_SB in 20 seconds. Exiting ffmpeg...
frigate | [2022-05-02 15:18:20] watchdog.Front_SB INFO : Waiting for
ffmpeg to exit gracefully...
frigate | [2022-05-02 15:18:26] frigate.video ERROR : Front_SB: Unable to
read frames from ffmpeg process.
frigate | [2022-05-02 15:18:26] frigate.video ERROR : Front_SB: Unable to
read frames from ffmpeg process.
frigate | [2022-05-02 15:18:26] frigate.video ERROR : Front_SB: ffmpeg
process is not running. exiting capture thread...
frigate | [2022-05-02 15:18:36] watchdog.Front_SB ERROR : Ffmpeg process
crashed unexpectedly for Front_SB.
frigate | [2022-05-02 15:18:36] watchdog.Front_SB ERROR : The following
ffmpeg logs include the last 100 lines prior to exit.
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : [segment @
0x5587124f10] Timestamps are unset in a packet for stream 0. This is
deprecated and will stop working in the future. Fix your code to set the
timestamps properly
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : [flv @
0x5587156810] Timestamps are unset in a packet for stream 0. This is
deprecated and will stop working in the future. Fix your code to set the
timestamps properly
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR :
[h264_v4l2m2m @ 0x5587461a70] === poll unexpected TIMEOUT: events=0x43, cap
buffers=20
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : Last
message repeated 1 times
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : Finishing
stream 2:0 without any data written to it.
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : [flv @
0x5587156810] Failed to update header with correct duration.
frigate | [2022-05-02 15:18:36] ffmpeg.Front_SB.detect ERROR : [flv @
0x5587156810] Failed to update header with correct filesize.
—
Reply to this email directly, view it on GitHub
<#2030 (comment)>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/ALNOXUQZBJ7KMK4I6PAOTZLVH7RANANCNFSM5GDYNB6Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Just to update this issue with a little info. I decided to upgrade my current working install (docker & Ubuntu 20.04 on a Rpi 8 GB) to 22.04 release. After the upgrade I get the same hw acceleration problems as with the Raspian install, will try to reinstall 20.04 later to check if that makes it work again (it should) Will keep you posted EDIT: Ubuntu 20.04 works perfectly ok with same config and images EDIT2: Sorry, didn't notice the thread was closed |
I'm having similar issues with a transcoded mjpg camera on a pi4 32 Bit, running the latest RPI OS bullseye. Anyone have luck with this configuration? hwaccel args kill the ffmpeg process. Comment them out and things are OK.
|
@jshep321 check: https://docs.frigate.video/configuration/hardware_acceleration and https://docs.frigate.video/configuration/camera_specific - if u still have issues create a new help submit with all infos requested! In gereral: I'm facing also firmware issues with the current Kernel and graphics driver, so what I've found out that there is a voltage problem (which can result in errors) - so if your system is a bit slow or error'ish - may some over_voltage helps (https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking-options). Nevertheless expects minor errors from the raspberry pi kernel/vc4, but its mainly working well for small solutions! my current config, which runs good (better):
what I've not tried yet is to powersupply the TPU with an powered usb-hub. |
@elgorro -
What is exectly what you should do - my whole set up became instable when I connected the TPU the first time, after I connected it via an powerd Hub everything was back to normal - I think there are many otheres told that story befor! The HwAccel Support is currently really bad - currently I found a config running on Pi 4 32Bit and 64Bit but doesn't give any performance improvements according to htop. Have good one! |
@elgorro - You were able to get the RPi4b to do hw accelerated h.264 decode to work with the modifications you listed above in your config.txt and adding it to your frigate.yml? I am still struggling to make the hw decode work... |
No - not like this and it's only "running" (: I'm on Arch 64 Bit with "linux-rpi"-Kernel where u have a /boot/config.txt - not sure what are your issues and feel free to submit an new issue ;) |
I tried to use the /boot/config,txt changes you mentioned on this thread, combined with a bunch of frigate.yml changes... But I have failed to make the hw video decode work, so CPU utilization is very high... I did open a new issue... It is issue #3677 Just looking for other ideas... |
Can I confirm if this is fixed in 0.11.1 and have someone confirm my ffmpeg config? I ask because I'm running on a raspi4 with the latest OS as of maybe a week ago. I've tried the standard frigate addon 0.11.1, the frigate full access 0.11.1, and the frigate full access beta 0.11.1 and they are all getting the errors that are described in this thread as soon as I enable hardware accel. note that for the full access versions I've tried with protected mode both on and off. Below are the ffmpeg arguments I'm using (using the global args in frigate.yaml):
|
See #3780 |
Thank you! I’d read through this thread several times, and it seemed like towards the end people were saying the new update has worked for them. This clarifies things. |
I have a rpi4 8GB and have not been able to get hardware acceleration working. I've been trying to reduce the CPU usage overall. The ffmpeg process dies no matter what config I specify. the result is green screen. I wonder if the reason is what I just read in the rpi4 docs here under license key and codec section? |
The reason is most likely #3780 |
Do you have a Coral attached and configured also with a separate power
supply for it?
…On Tue, Nov 8, 2022 at 1:10 PM skstussy ***@***.***> wrote:
I have a rpi4 8GB and have not been able to get hardware acceleration
working. I've been trying to reduce the CPU usage overall. The ffmpeg
process dies no matter what config I specify. the result is green screen. I
wonder if the reason is what I just read in the rpi4 docs here under license
key and codec section
<https://www.raspberrypi.com/documentation/computers/config_txt.html#licence-key-and-codec-options>
?
—
Reply to this email directly, view it on GitHub
<#2030 (comment)>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/ALNOXURSAIOVCKJOMOYT5N3WHKQQ3ANCNFSM5GDYNB6Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I didn't have a coral in the beginning and was having the same problem with CPU detectors. I assume the problem is related to what is being discussed in #3780 but I don't know how to go about downgrading kernel because I'm using the Home Assistant OS. those people that seems to have got it working I think are using containers which I assume gives them more flexibility. So I guess I just have to wait until it gets addressed.. |
I’m running six cameras on a pi with cpu between 20% and 45% with rare spikes higher. I could not get hw accel running either, but here are the things I did to reduce cpu utilization significantly:
Make sure your detect with height matches the camera resolution
Reduce camera resolution
Reduce detect fps (I’m at 2)
Motion mask anywhere that has motion your don’t want to analyze
Motion mask timestamps or they will cause constant analysis (this was a big one for me)
I think I did a few more things to lower cpu usage but am struggling to remember them. I’ll post again if I remember any.
…Sent from my iPhone
On Nov 10, 2022, at 12:55 AM, skstussy ***@***.***> wrote:
I didn't have a coral in the beginning and was having the same problem with CPU detectors.
I did buy a coral couple weeks ago to offload some of the load on the CPU, but it hasn't reduced CPU usage as much as I'd liked. So now I'm back trying to get the hardware accel enabled. Power is supplied by 5V 5A adaptor to rpi4 and usb coral connected (no separate power source).
I assume the problem is related to what is being discussed in #3780 but I don't know how to go about downgrading kernel because I'm using the Home Assistant OS. those people that seems to have got it working I think are using containers which I assume gives them more flexibility. So I guess I just have to wait until it gets addressed..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
To be clear, this is in recommended against as it can cause glitches in tracking when large motion masks are included |
Thank you all for the replies, I'm humbled by the support provided. I'll give some of these suggestions another try, some I have already attempted without success like setting resolution. Masks was something I was planning to try because I had read about that before. I hadn't thought about reducing fps yet. Will give that ago as well -currently set to 5. Thank you! with any luck I can limp along until kernel is addressed. |
btw did anyone read this section of the rpi docs? license key and codec section It's still bothering me and would be great if someone can explicitly tell me it's unrelated? |
It's talking about |
Sigh of relief, thank goodness. Now I can rest easy thank you. |
Thank you, I hadn't been aware of this. In my case, I was masking areas that I don't want detection to happen at all and don't expect detected objects to move into. For example: I masked a garden area where I don't expect someone coming up my driveway to walk into my garden. Similarly, I masked a bush whose movement was triggering motion because I don't expect an object to climb into the bush. Are these safe/appropriate ways to mask? |
Yes that makes sense, as someone who was standing in your bushes would cause more motion outside the bushes anyway. I was mostly referring to the scenario I see here relatively often which is like "I don't care if someone is in my street so I put a motion mask across the entire street" which causes problems |
Hey for all the people with google coral on raspberry pi i hope this helps some people |
Describe the problem you are having
I hope I'm not missing something obvious, I have been looking at this for a while before reaching out ;-)
I seem unable to add the ffmpeg hardware acceleration for my Raspberry Pi4 using the following lines:
ffmpeg:
hwaccel_args:
- -c:v
- h264_v4l2m2m
I have tried to add globally and under a specific single camera. All I get is a pure green image. Without adding these lines everything works great, although obviously the CPU usage is quite hit.
In these logs describing the issue, I have only added the acceleration for the camera Living_Room_Low
I have modified the /boot/config.txt file to 512 - gpu_mem=512
Confirmed this by going to the homeassistant container console:
bash-5.1# /opt/vc/bin/vcgencmd get_mem gpu
gpu=512M
Version
DEBUG 0.9.1-800F33E
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
Operating system
HassOS
Install method
HassOS Addon
Coral version
USB
Network connection
Wired
Camera make and model
Sonoff WiFi IP Camera 1080P
Any other information that may be helpful
No response
The text was updated successfully, but these errors were encountered: