-
Notifications
You must be signed in to change notification settings - Fork 4
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
[RSDK-8903] - Implement simple keyframe force interval #18
Conversation
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.
Glad the fix could be done declaratively as a flag!
go.mod
Outdated
@@ -14,6 +14,7 @@ require ( | |||
go.viam.com/rdk v0.40.0 | |||
go.viam.com/test v1.1.1-0.20220913152726-5da9916c08a2 | |||
go.viam.com/utils v0.1.98 | |||
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc |
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.
why this change?
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.
Forgot to run go mod tidy from last PR.
But thanks for pointing this out, for some reason I was using the external package instead of math/rand.
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.
Removed that dep from example script.
@@ -9,6 +9,7 @@ package main | |||
|
|||
import ( | |||
"context" | |||
"math/rand" |
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.
Small fix for a tidy mod.
Description
There was an issue where the segmenter would flake out after some time. This was due to a keyframe not being correctly inserted into the beginning of the segment as expected. It turns out, the
gop_size
encoder settings are more of a recommendation than an absolutely firm keyframe interval. Dependenging on scene changes, a keyframe could be inserted earlier than expected throwing off the synchronization between the encoder and segmenter.FFmpeg codec options actually include a
force_key_frames
expression handler, so we do not even have to hand roll the key frame forces in our image loop! Basically a one line opt call to fix this : )Test
viamrtsp
camera of size 960x480 and 20FPS2024-10-03_17-48-40.mp4
ffprobe -v error -select_streams v:0 -show_frames -print_format json 2024-10-03_17-48-40.mp4 > frames_info.json
frames_info.json
Update here after overnight test: ✅