Closed masonevans closed 3 years ago
Looks like its specifically struggling to repackage the feed in the flv container. I haven't seen this issue specifically, but I am thinking of replacing nginx for RTMP restreaming with another solution in the future that may resolve this issue.
I did a bit more testing. The issue is definitely something happening between ffmpeg & nginx/RTMP. I stood up a bare nginx/RTMP server and then ran the ffmpeg RTMP stream directly into it, and was able to reproduce the issue. It seems like it's definitely something in the ffmpeg/RTMP connection as I'm able to reproduce the issue running ffmpeg/nginx on my server with NixOS or my MacOS laptop.
Interestingly, it seems to have some relationship between the bitrate and the iframe rate. 6mbps bitrate works with an iframe every 10 frames but not every 20 frames. 8mbps works with an iframe every 5 frames but not every 10 frames (exact numbers don't seem to be consistent across cameras). I think the inconsistency I was seeing earlier was due to having VBR turned on and the occasional bitrate spike would cause the failure.
@blakeblackshear happy to close this issue if you want, given that it seems to be between ffmpeg & nginx/nginx-rtmp-module and not directly related to Frigate
@masonevans I have the exact same issue. However I think issue should stay open until its resolved? Even if its not related to the python code its still related on how frigate is released / packaged.
@blakeblackshear what do you think? I also tried the 0.9 rc and it has the same issue.
When running the same camera on a lower resolution everything works fine. (640480 instead of 38402106)
Interestingly, it seems to have some relationship between the bitrate and the iframe rate. 6mbps bitrate works with an iframe every 10 frames but not every 20 frames. 8mbps works with an iframe every 5 frames but not every 10 frames (exact numbers don't seem to be consistent across cameras). I think the inconsistency I was seeing earlier was due to having VBR turned on and the occasional bitrate spike would cause the failure.
I have set my camera's to a constant bitrate of 16384Kbps and it fails directly when RTMP turned on, I can view the RTMP stream in VLC however it will stop about 10 seconds in.
Describe the bug I have two cameras, a Hikvision and an Amcrest. Each camera has a main stream and a substream; the main stream is set to max res at 6/5 fps and the substreams are set to VGA res 6/5 fps (the Hikvision only does 6 fps, not 5).
When I put the RTMP role on the main stream, my logs end up with a bunch of error messages and the RTMP stream is very unstable. When I try to watch the RTMP stream in HA, it will freeze at times corresponding to the error messages in the logs. When I move the RTMP role to the substream I do not have any issues.
From what I can tell by running the generated ffmpeg command directly, the issue doesn't happen if I output to a file instead of an RTMP stream
Version of frigate 0.8.4-5043040
Config file Include your full config file wrapped in triple back ticks.
Frigate container logs
Frigate stats
FFprobe from your camera
Run the following command and paste output below
Screenshots If applicable, add screenshots to help explain your problem.
Computer Hardware
Camera Info:
Additional context
I ran the ffmpeg command directly in the docker container and am able to reproduce the error, although it doesn't happen as frequently as when Frigate is running (maybe because I didn't start a second stream like Frigate does with the detect stream?)
I then tried running the same command but sending the stream to disk instead of as an RTMP stream and it does not seem like the issue happens. In fact, I left the below running at the same time as Frigate and my ffmpeg process has run for 30 mins without exiting while Frigate was getting errors about once/minute.
htop
shows no stress on the CPU, all six cores are sitting at under 10%