-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Consider use of live_flv
ffmpeg flag with cameras that have timestamp issues
#1467
Comments
I have two RLC-520 cameras. The following options are what works for me. Using that posted above @charlesmunger caused only a green image to display
|
@skulumani |
Hello @charlesmunger Here are the ffmpeg commands I checked a couple of clips from this morning and still seem to have the stuttering so perhaps it's not working as well on my system. I should check it by minimizing CPU usage as well. However this set of options at least shows the video. Also my cameras are connected via RTMP as shown below.
|
Your mileage may vary, but I find the raw http stream that the Reolink Web interfaces use seems to have a lower overhead and is more reliable than RTMP & RTSP, perhaps because it doesn't have to wrap the video data in RTMP packets:
It appears that what comes over the wire is the raw .FLV data. This is what I have been using with Frigate on top of the Reolink NVR for the last few months, but I'm looking forward to trying the |
@skulumani by any chance have your cameras been on for more than 49.7 days? That produces an integer overflow in the FLV timestamp that ffmpeg seems to handle poorly. |
@charlesmunger
Most likely. That's a good find. Let me try a restart. I also think I
recall an ability to set an auto reboot as well
…On Sat, Aug 14, 2021, 16:59 Charles Munger ***@***.***> wrote:
@skulumani <https://github.com/skulumani> by any chance have your cameras
been on for more than 49.7 days? That produces an integer overflow in the
FLV timestamp that ffmpeg seems to handle poorly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1467 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIFUZVXAALTAY3KFUQZUH3T43KMNANCNFSM5BVJ37VQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
You can schedule a daily/weekly restart on the camera through its web interface in System / Maintenance. Thanks for the above, some more things to try! Although my RLC-520A cameras on firmware 1.0.274 have been much more stable. (Note this Firmware is likely still in testing and just for the 520A, so won't help the OP but many help others who find this thread.) |
@MarkGodwin Can you share the yaml configuration you're using and the generated ffmpeg URL (redacted of your password)? Also, can you confirm if you were originally encountering the stuttering clips issue? |
@charlesmunger Tried a restart of my cameras and have them set to autoreboot each week now. Using the original ffmpeg commands listed below:
And still see green image for the camera feed. The following works for my cameras but I still experience a slight stutter.
It is noticeably reduced by using the |
As an update for others with similar experiences I've switch to a Coral device. As explained in the documentation, this allows for much faster response rates (8ms vs. over 150ms in my case of 2 x 2560x1920 cameras). Previously I would have to do detection on 640x480 stream but now can handle larger resolutions which allows for detection of much smaller objects. CPU usage is reduced and the clips are stuttering at a much less noticeable level. At this resolution one has to do some experimenting to find a FPS that allows for ease of detection (5 FPS ) vs. having smooth clips (higher FPS desired). However in the case of the RLC-520 there is only a single stream at high resolution so at around 15 FPS seems like the maximum FPS that my setup can handle. So a combination of the Coral and the |
Note that the fps in your config does not have to match your camera. You can use a 15fps camera stream and specify 5fps in the config. If you are using the same stream for both clips/recordings/detect, ffmpeg will limit the detect to 5fps, but will still direct copy the 15fps stream for clips/recordings. |
Hi @blakeblackshear. I just tried this on my setup. Cameras set at 30FPS and Frigate config set to 5FPS. A clip is recorded at about 1/6 speed as a result. Are there any special ffmpeg commands required? |
Post your ffmpeg cmd from the debug page |
Thanks for taking a look
|
I'm not sure why that would be happening. The clips are assembled from the segments that are using the copy codec, so nothing should be changing. Maybe remove the wallclock as timestamps parameter in your input args. |
@skulumani I use a slightly different path for my RLC-520A camera main stream (channel=1) so maybe try that too? Here is my Frigate config for one camera FYI, which mostly (#1567) works well!
|
It sounds like nobody in this thread who tried
|
@charlesmunger I use both right now with no issues (see below).
|
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. |
I have investigated further and found the issue - for me, at least, the roles:
- detect
input_args:
- -fflags
- nobuffer
- -flags
- low_delay
- -strict
- experimental
- -rw_timeout
- '5000000'
- -f
- live_flv and roles:
- record
input_args: &record_reolink_args
- -strict
- experimental
- -rw_timeout
- '5000000'
- -f
- live_flv So try this configuration, and you might see lower delay on your detect stream, and a simpler setup for your record stream. |
Thanks! I will try that. What does |
I'm the owner of some Reolink RLC-410 cameras, and I used the config linked in the docs to get a stream that decodes successfully. However, I had an issue where clips would have delayed frames followed by sped up sections. I suspect that this is caused by an interaction of the following options:
-use_wallclock_as_timestamps
in frigate, a CPU (rather than tpu) detector, andin my VM configuration. When an object is detected, the CPU detector puts the CPU under heavy load. This in turn delays processing of frames from the RTMP input, which means that the real time clock drifts from the actual correct inter-frame timing. When played back, the clip appears to freeze and speed up intermittently depending on the load when it was recorded. While this is certainly exacerbated by the VM, it's possible for it to happen on any system that's under load or bandwidth constrained.
I researched and tested out the
live_flv
option for ffmpeg. It appears to be designed for exactly this use case - timestamp discontinuities in livestreamed FLV. I specified this configuration:Which then evaluates to this:
This completely fixed my issues with clips - they're rock solid now, perfectly smooth motion. I've been running this configuration for a few months. I also tried introducing artificial CPU load and starving the ffmpeg process of resources, and it handled those just fine. I'd suggest updating the documentation to use it for reolink cameras, or even changing it to the default frigate behavior for rtmp streams if some users test it on other cameras and it works well.
The text was updated successfully, but these errors were encountered: