Skip to content
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

Fix raspberry pi hwaccel #4955

Merged
merged 4 commits into from
Jan 8, 2023
Merged

Fix raspberry pi hwaccel #4955

merged 4 commits into from
Jan 8, 2023

Conversation

blakeblackshear
Copy link
Owner

No description provided.

@netlify
Copy link

netlify bot commented Jan 7, 2023

Deploy Preview for frigate-docs canceled.

Name Link
🔨 Latest commit 0327678
🔍 Latest deploy log https://app.netlify.com/sites/frigate-docs/deploys/63b9f32ccbdd5b00090591bc

@blakeblackshear blakeblackshear marked this pull request as ready for review January 7, 2023 20:37
@mattijsf
Copy link

mattijsf commented Jan 9, 2023

Any expectation when this will arrive in a beta?

@blakeblackshear
Copy link
Owner Author

Soonish

@NickM-27 NickM-27 deleted the fix_rpi branch January 9, 2023 12:11
@starman2k01
Copy link

Would love to beta a fix. Setup my whole property to be monitored with Coral and it's been dead in the water for a while now.

@NickM-27
Copy link
Collaborator

Would love to beta a fix. Setup my whole property to be monitored with Coral and it's been dead in the water for a while now.

It's already out in 0.12 beta...

@Gyosa3
Copy link

Gyosa3 commented Jan 25, 2023

Hi I'm a bit confused if this fix went through, here is my situation as of today:

I'm now using 0.12beta5 with new beta integration in HA on a Pi4. HW accel works with camera TpLink Tapo C200, both with new global settings:

ffmpeg:
  hwaccel_args: preset-rpi-64-h264

and with older settings in the camera itself:

cameras:
  my_cam:
    ffmpeg:
      hwaccel_args: -c:v h264_v4l2m2m

I do both "detect" and "live" on SD stream and "record" on HD stream and all is fine. It was not working before the beta release.

However this is not working with a TpLink Tapo C310, the picture is fast switching between the actual image and a green fuzzy screen, as was the case when the issue was open. Both cameras are on the same network, latest firmware, work fine with HA via the Tapo integration, work fine without HW accel, integrate well with Coral TPU, it's just the HW accel that cause problem.

So I'm wondering, are there known limitations to the fix? I tried to change the resolution on the C310, no result, and that's the only parameter I can play with. It's possible that the problem is caused by this model in particular, so I wanted to have feedback if this fix was know to have solved the problem in general, or if there are still reported issues like for me?

And also, would there be any workaround with the new restream capabilities? I did not try them yet.

thanks and congrats for the great work!

@NickM-27
Copy link
Collaborator

and with older settings in the camera itself:


cameras:

  my_cam:

    ffmpeg:

      hwaccel_args: -c:v h264_v4l2m2m

You shouldn't be setting this here it's the same as the above preset so no need, recommend removing it.

However this is not working with a TpLink Tapo C310, the picture is fast switching between the actual image and a green fuzzy screen, as was the case when the issue was open. Both cameras are on the same network, latest firmware, work fine with HA via the Tapo integration, work fine without HW accel, integrate well with Coral TPU, it's just the HW accel that cause problem.

If that's what was happening when the original issue was opened then it's unrelated to what was fixed. It's probably just a bug in the v4l2m2m decoder.

@Gyosa3
Copy link

Gyosa3 commented Jan 25, 2023

ok thanks, that's clear. The old setting was just for testing. I'm happy half of my cams now work on HW accel, thank you so much!! I'm a bit disappointed for the other half that still fails, but that's IT life...

@NickM-27
Copy link
Collaborator

ok thanks, that's clear. The old setting was just for testing. I'm happy half of my cams now work on HW accel, thank you so much!! I'm a bit disappointed for the other half that still fails, but that's IT life...

Should make an issue for those, maybe we can spot an error

@Gyosa3
Copy link

Gyosa3 commented Jan 26, 2023

Yes I think I'll open a specific issue for my case. Now that I have one camera out of 3 running with HW accel on my Pi, I see weird stats in Frigate:

Tapo C310 cameras which do not support HW accel run as 25% CPU in average.
Tapo C200 camera which supports HW accel is reported to run at 80-90% CPU, with or without Accel option enabled.

hwaccel stats

@NickM-27
Copy link
Collaborator

@Gyosa3 keep in mind that the RPi does not support GPU stats

@Gyosa3
Copy link

Gyosa3 commented Jan 26, 2023

Understood!
I also found out by trial and error that Tapo C200 camera has a lowres stream of 640x360 while the C310 has a 720p lowres. This was never documented in TpLink docs. They only mention the hires capability of 1080p for the C200. When 'detect' resolution is adjusted, thanks to a previous post you made, CPU lowers from 90% to... 10%. HW accel is somehow even marginal there. CPU was used even with 'detect' disabled. Now CPU is low even with detect enabled.

Thanks for all your tips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants