Repository navigation
Stop dropping frames when camera jitter straddles the frame grid - #10
Merged
Merged
Conversation
The output frame grid's phase is set by when Record is pressed, not by the camera. When the camera's frames land near the midpoint between output frames, normal jitter rounds consecutive frames onto one slot and the second is dropped, silently losing about a third of the take's frames. Such a frame now takes the next slot when that is at most three quarters of a frame early; a camera faster than the output rate still has its extra frames dropped. Fixes omacom#9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The jitter test now records 320x240 frames, NVENC's minimum, paced at the camera's own intervals so the encoder queue sees real-time input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
I merged master into this branch and pushed it. Since #32, recordings go through NVENC, so the jitter test now uses 320×240 frames, NVENC's minimum. It also feeds them at the camera's own 28/36 ms intervals instead of every 5 ms, so the encoder sees real-time input. It still catches the bug: without the fix, 41 of 60 frames survive. |
[Medium impact] The PR appears safe to merge. SummaryKeeps jittery camera frames without advancing the repeated final frame past its intended slot.
Reviews (2) · Last reviewed commit: "Keep the repeated tail frame from moving..." · Reviewed by Greptile |
Only camera frames may take the next slot after a collision. finish() repeats the last frame to fill the take's final slot, and moving that repeat forward added a frame after the audio ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9.
Writer::videoAtrounds each frame to the nearest output slot and drops a frame whose slot is taken. The slot grid's phase comes from when Record is pressed. When the camera's frames land near the midpoint between slots, normal jitter (the MX Brio runs 36, 36, 28 ms) rounds consecutive frames onto one slot. About a third of the take's frames are then silently dropped.A frame that collides with the previous slot now takes the next one, if that slot is at most ¾ of a frame early (~18 ms at 30 fps at most). A camera genuinely faster than the output rate still has its extra frames dropped.
Verification
jitteryCameraKeepsEveryFramefeeds 60 frames at this phase and jitter: 41 frames are kept before the fix, 60 after../bin/test: all pass (19 backend + 3 UI), including the A/V sync test.🤖 Generated with Claude Code