Skip to content

Conversation

@JonnyBurger
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 6, 2026 10:49
@vercel
Copy link
Contributor

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
bugs Ready Ready Preview, Comment Jan 6, 2026 6:09pm
remotion Ready Ready Preview, Comment Jan 6, 2026 6:09pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where video frames were being rendered out of order in the <Video> component during rendering. The root cause is that keyframe packet timestamps can be higher than the timestamps of packets that follow them (e.g., keyframe at 0.08s, next packet at 0.04s).

Key Changes:

  • Updated timestamp handling to use Math.min() when determining start timestamps to account for out-of-order packet timestamps
  • Added safeguards to cache eviction loops with maximum attempt limits and warning messages when limits are exceeded
  • Renamed and reduced the safe window constant from SAFE_BACK_WINDOW_IN_SECONDS (1 second) to SAFE_WINDOW_OF_MONOTOCY (0.2 seconds)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/media/src/caches.ts Renamed and reduced the safe window constant from 1 to 0.2 seconds
packages/media/src/video-extraction/keyframe-manager.ts Updated to use Math.min() for start timestamps, added max attempts for cache eviction, and added requestedTimestamp parameter
packages/media/src/video-extraction/keyframe-bank.ts Removed timestamp adjustment logic and changed to return first available frame instead of null
packages/media/src/video-extraction/get-frames-since-keyframe.ts Added requestedTimestamp parameter and applied rounding to timestamps for sample iterator
packages/media/src/audio-extraction/audio-manager.ts Added max attempts safeguard to cache eviction loop with warning message
packages/media/src/audio-extraction/audio-iterator.ts Updated to use renamed constant

@JonnyBurger JonnyBurger merged commit 11c19ab into main Jan 7, 2026
14 of 15 checks passed
@JonnyBurger JonnyBurger deleted the fix-duplicate-frames branch January 7, 2026 07:38
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.

2 participants