-
Notifications
You must be signed in to change notification settings - Fork 540
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
Update FFmpeg presets for Rockchip boards #1203
base: master
Are you sure you want to change the base?
Conversation
@AlexxIT I know you are not able to test these changes. Is there some way we can still implement them? |
I'm busy for the next two weeks |
Hello all,
Even with this I didnt note any inprovement on decoding or encoding on hw for go2rtc...but frigate is using rkrga without problems.
Is there any way to force Go2RTC to use HW for decoding and encoding ? How can I debug it? Another comment: Best regards, |
Hey @bugui2007, do you have a section like:
You are just defining some presets. Do you use them when defining your streams? Do you see any video from go2rtc? If you do this correctly, you force go2rtc to use hw accel. It won't fallback to software. Either it works and uses hardware or it will crash. You can use
Btw. you can use the exec command to start ffmpeg with custom commands. You don't need to mess with the presets:
|
Hello Marca711,
Then I switched back to the standar rtsp command like
And audio is working now. Do you have some recommendations to inprove the exec:ffmpeg command in order to get h265 to h264 transcoding on the fly as well can use audio? Bugui |
Hey @bugui2007 Try to remove the You can use |
Thanks for your work on this @MarcA711. Currently I only use go2rtc to rotate a camera stream 90 degrees. It was previous working on the latest frigate -rk dev container using:
But that wasnt actually using hardware acceleration from what I gather was the point of your PR? I had previously thought it was (any good way to test?) But anyway, the rotated stream ends up with a diagonal line and green stripe on the bottom artifacts like below and I was hoping maybe that would be fixed by using the custom ffmpeg cmdline: I finally got it working using an amalgam of your suggested commands and those at https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Filter, resulting in:
But the result has the same artifacts in the stream unfortunately. Can you confirm that this should enable hardware acceleration the stream tranposition? Also, I would prefer to keep the rotated stream h265 like the source stream is but I cannot get frigate to connect to it as a camera unless i convert to h264 - maybe that's a limitation of 'preset-rtsp-restream'? Let me know if I am doing something wrong and thanks again for you and everyone elses work on improving rockchip support |
AFAIK, there is no version of frigate that supports hw acceleration using
You can use
There were multiple issues with artifacts in hw accelerated streams. This was mostly due to odd weird resolution. You apperently have 1536x2048, can you try if it works for a standard resolution like 1920x1080? Maybe save a clip from your camera, use software ffmpeg to crop it to 1920x1080 and try if the artifacts still appear.
yes, the command that you provided uses hw acceleration. Two things to consider:
Frigate should be able to process the h265 stream. Did you select the correct hardware acceleration preset (hwaccel_args: preset-rk-h264 or preset-rk-h265)? Are you sure frigate fails to connect to the h265 stream? Because most web browsers don't support h265 since it is not free. If frigate shows no error but your web browser shows some error saying that it cannot play the video, your web browser might not be able to play h265. |
@derzahla @MarcA711 This artifact has been fixed recently. Updating
Also, hardware decoding is not used. It is |
@nyanmisaka Thank you for this info. @derzahla I try to build a new FFmpeg Rockchip binary with the fix. I will write here, when I am done. |
@derzahla I uploaded a new version that should contain the fix. You can download it here: https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/tag/6.1-6 |
Thanks for the detailed response @MarcA711 and @nyanmisaka for the good news about the fix! Unfortunately my opi5+ died(or maybe just the SSD) and I am failed over to an x86 frigate VM with coral passed through for now. I havent has a chance to dig into the orangepi yet but I was having stability issues(OS lockups and occasional storage errors where my root fs would set itself RO) running the latest frigate on the rk3588 ubuntu build so that is why I was considering moving away from it until it 'stabilized' but now I suspect maybe it was just due to my hardware. @nyanmisaka So youre saying my config and frigate version was at least using HW transpose? But Marc's preset changes should allow HW decode now?
Yes. I use the open source thingino firmware primarily and though the hardware supports rotation the streamer that it uses isnt working. I have an open bug report
are you sure rotating is even possible without decode/re-encoding? I was trying to find a definitive source on that, but since my cam is outputing h265 and frigate wont connect to the rotated go2rtc stream unless I convert it to h264 I am still unsure.
I have preset-rk-h265 set but I am also confused about how that works because i connect frigate directly to multiple cams, some outputting h265 and some only capable of h264. That all works. Its only on the doorbell cam that I need to rotate the stream so that is the only one i am using go2rtc for. My observations were not based on any web browser though but the frigate error log itself which would complain about 'garbage data' or something if i tried to keep just rotate the stream and not also convert to h264. |
I got my opi5+ back online running frigate. I also setup go2rtc streams for all my camera streams, not just the one I need rotated, since that is supposed to be best practice and offer better quality with hass integration. Unfortunately(running the latest dev frigate -rk containers and using the full "-exec" ffmpeg options on go2rtc as posted above I am at 100% cpu and nothing works. When I go back to the simple config I hover around 6% CPU and streams "mostly" work (h264 outputting cameras work fine, h265 outputting cameras can be spotty and timeout frequently). I did try copying the latest ffmpeg binaries you linked to, to the frigate container and "stop/starting it" but I had the same issue with 100% cpu usage. I know none of this is particularly helpful, but I am guessing my config has multiple problems due to my own misunderstandings and the bleeding-edge status of frigate-rk. I am particularly unclear on where or if I should even be setting hwaccel_args presets since the docs seem to suggest setting preset-rk-h264 or preset-rk-h265 at a global level, yet I have cameras that output both. I will post my current config below in case you have the time to do a once-over and notice anything that warrants fixing. curious, do you have more up-to-date containers for rockchip fixes than the standard frigate -rk dev builds? config:
Also, here is the config I was trying with the hard-coded ffmpeg options in go2rtc section and the new build off ffmpeg you provided. Let me know if there is a better way for me to help you test things.
|
see #979
./ffmpeg ...
. No need to install any libraries or dependencies. You need to run linux with up to date kernel drivers though. I recommend ubuntu-rockchip if your board is supported.:force_original_aspect_ratio=0
to the scale command to allow rescaling. No other preset does this afaik, but I know that some frigate users want to change their aspect ratio