-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add optional idle heartbeat for Birdseye #20453
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
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for frigate-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heartbeat idea seems fine in general. This should definitely be a config option though, Frigate does not use env variables for config options like this.
I don't think ffmpeg changes make sense. The birdseye restream command is already configurable in go2rtc config if you want it to be, most users shouldn't be changing that though.
03c9691
to
3eb8cc8
Compare
Thanks for the quick feedback guys! I (force, ops) pushed the changes requested. |
…n idle) birdseye: add optional idle heartbeat and FFmpeg tuning envs (default off) This adds an optional configuration field `birdseye.idle_heartbeat_fps` to enable a lightweight idle heartbeat mechanism in Birdseye. When set to a value greater than 0, Birdseye periodically re-sends the last composed frame during idle periods (no motion or active updates). This helps downstream consumers such as go2rtc, Alexa, or Scrypted to attach faster and maintain a low-latency RTSP stream when the system is idle. Key details: - Config-based (`birdseye.idle_heartbeat_fps`), default `0` (disabled). - Uses existing Birdseye rendering pipeline; minimal performance impact. - Does not alter behavior when unset. Documentation: added tip section in docs/configuration/restream.md.
3eb8cc8
to
7789260
Compare
self.idle_fps = float(self.config.birdseye.idle_heartbeat_fps or 0.0) | ||
self.idle_fps = max(0.0, self.idle_fps) | ||
self._idle_interval: Optional[float] = (1.0 / self.idle_fps) if self.idle_fps > 0 else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant. We know it will be a valid float, with a default of 0.0
self.broadcaster.start() | ||
|
||
|
||
# Start heartbeat loop only if enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need a thread for this, we should be able to just add a last_update check, and if the last update was older than the idle_heartbeat it should manually update with the same frame that was already sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but from my understanding this code runs only when we receive an update.
the purpose is to overcome this limit with a timed thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's not the case. Birdseye will always get updates even if there is no motion or objects. It just won't send an update in the case that no cameras match the criteria to be displayed. That's the part that just needs a check to resend the blank image anyway
Co-authored-by: Nicolas Mowen <[email protected]>
Co-authored-by: Nicolas Mowen <[email protected]>
Actual need
I have several cameras connected to my frigate instance and I want them to visible in birdseye only when motion occurs (eg. Home alarm trigger and I want to display in my echo shows only the relevant video).
The problem is that when I restream the birdeye video to other system (eg. scrypted, or simply ffplay), the stream is extremely slow to attach (talking about 30/40 seconds). Not a problem for ffplay but for other more sensible devices like Alexa this ends up in an error.
Digging through the code seems that frigate is not pushing frames when in idle, thus resulting in a missing keyframe to start an RTSP feed.
Proposed change
birdseye: add idle_heartbeat_fps config option to periodically resend last frame
This adds an optional idle heartbeat mechanism to Birdseye. When enabled by setting the idle_heartbeat_fps config variable to a value > 0, Birdseye periodically re-sends the last composed frame when idle (no motion or no active frame updates). This helps downstream consumers such as go2rtc or smart display integrations to attach faster and maintain a low-latency stream during idle periods.
Documentation: added section in docs/configuration/restream.md.
Type of change
Checklist
en
locale.ruff format frigate
)