Skip to content

fix(recording): encode segmented video with real capture timestamps to fix white editor preview and cursor desync#1976

Open
ManthanNimodiya wants to merge 1 commit into
CapSoftware:mainfrom
ManthanNimodiya:fix/segmented-encoder-real-timestamps
Open

fix(recording): encode segmented video with real capture timestamps to fix white editor preview and cursor desync#1976
ManthanNimodiya wants to merge 1 commit into
CapSoftware:mainfrom
ManthanNimodiya:fix/segmented-encoder-real-timestamps

Conversation

@ManthanNimodiya

@ManthanNimodiya ManthanNimodiya commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes the 0.5.4 Windows regression: white editor preview, and exported videos with cursor position/timing way off (0.5.2 unaffected).

42b059978 changed the segmented encoder to stamp frames as frame_index / fps instead of their capture timestamps. Windows Graphics Capture only delivers frames when the screen changes, so the video's time axis compresses vs wall clock, desyncing the cursor track and leaving editor seeks pointing past the last PTS. Combined with the screen decoder's fallback distance being tightened from 90 frames to 4 in the same release, seeks find no frame and the preview renders white. macOS is unaffected (AVAssetWriter path).

Fix: restore real capture timestamps in queue_frame and the default screen fallback distance. The non-monotonic-timestamp corruption that motivated the frame-index change is already handled by normalize_input_pts in the encoder, the jittery_capture_timestamps_still_produce_decodable_segments test still passes (32/32 green).

Greptile Summary

This PR restores screen recordings to wall-clock video timing. The main changes are:

  • Segmented video frames now use their real capture timestamps.
  • The synthetic frame-index timestamp counter was removed.
  • Screen decoding now keeps the wider default fallback distance.
  • Camera decoding still keeps its tighter fallback distance.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The encoder path already normalizes non-monotonic input timestamps.
  • The screen decoder change restores the wider fallback behavior used for change-driven captures.

Important Files Changed

Filename Overview
crates/enc-ffmpeg/src/mux/segmented_stream.rs Queues segmented video frames with capture timestamps instead of synthetic frame-index timestamps.
crates/rendering/src/lib.rs Restores the screen decoder to the default fallback distance while preserving the camera-specific cap.

Reviews (1): Last reviewed commit: "fix(recording): encode segmented video w..." | Re-trigger Greptile

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

…o fix white editor preview and cursor desync
Comment on lines 342 to 343
.await
.map(|decoder| decoder.with_max_fallback_distance(SCREEN_MAX_FALLBACK_DISTANCE))
.map_err(|e| format!("Screen:{e}"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor maintainability thought: this relies on the decoder’s default fallback distance (currently 90). If that default ever changes again, this regression could come back; consider making the screen value explicit here.

Suggested change
.await
.map(|decoder| decoder.with_max_fallback_distance(SCREEN_MAX_FALLBACK_DISTANCE))
.map_err(|e| format!("Screen:{e}"))
.await
.map(|decoder| decoder.with_max_fallback_distance(90))
.map_err(|e| format!("Screen:{e}"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant