Repository navigation
fix(recording): flush Studio video to disk every 2 s of capture time - #2646
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
richiemcilroy
marked this pull request as ready for review
October 16, 2026 15:29
Member
Author
|
@greptileai review |
read_fragment_prefix returned the fragments verified before any later error. A drive error then recovered a shorter video instead of leaving the source retryable. Only a malformed or truncated tail ends the prefix now; other I/O errors reach the caller.
Member
Author
|
@greptileai review |
…ryable Studio fragment discovery skipped any .m4s.tmp whose prefix read failed, so a transient storage error let staged finalization publish a shorter recording. Only a malformed or empty tail is skipped now; any other read error keeps the fragment listed, and staged finalization refuses to publish while a pending fragment remains.
Member
Author
|
@greptileai review |
This branch was successfully deployed
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.
A Studio recording of a mostly static screen could lose more than 10 seconds of video when Cap crashed, even though segments target 2 seconds.
Cause
flowchart LR A[ScreenCaptureKit delivers 3 fps on a static screen] --> B[keyframe every 60 frames = 20 s] B --> C[DASH cuts segments only at keyframes] C --> D[the whole 20 s segment sits in the writer's memory] D --> E[crash: nothing of it is on disk]Fix
Studio's fragmented writers now flush a complete fragment (
moof+mdat) every 2 s of capture time inside the current segment:timed_fragments: true). Every Instant writer passesfalseand keeps its options, because Instant segments are uploaded live.sidx.read_fragment_prefix(crates/enc-ffmpeg/src/mux/fragment_prefix.rs) reads the duration from the fragments' owntfhd/tfdt/trunagainstinit.mp4. It checks that every run lies inside itsmdatand that each fragment starts where the previous one ended.read_fragment_metadatafalls back to it only when thesidxread fails..m4s.tmp, recovery copies the verified complete prefix to the final segment name, from the segment's keyframe through the last whole fragment. The copy is synced, then published with an exclusive rename (renamex_np/renameat2/MoveFileW), falling back to a create-new copy. The original.tmpbytes are never modified. A storage error leaves the source retryable instead of marking it corrupt.Measured
Identical encoded packets replayed through the production writer, 60 s at each delivered frame rate:
Recorder killed during a static-screen Studio recording (Engine verify crash suite, macOS, Windows and Linux):


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue was found.Summary
Studio writers flush complete video fragments every two seconds of capture time without forcing more keyframes. Recovery preserves the original temporary files and copies their complete fragments into staged files.
Reviews (8) · Last reviewed commit: "fix: keep an unreadable pending fragment..." · Reviewed by Greptile