Skip to content

feat(cli): diff --offset compares the original at t with yours at t + offset - #7057

Merged
jerrai-bot-heygen merged 4 commits into
mainfrom
jerrai/cli-diff_offset-11032026
Nov 3, 2026
Merged

jerrai-bot-heygen merged 4 commits into
mainfrom
jerrai/cli-diff_offset-11032026

Conversation

@jerrai-bot-heygen

@jerrai-bot-heygen jerrai-bot-heygen commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What

hyperframes diff gains --offset <seconds>. It compares the original's frame at time t with yours at t + offset, for every per-frame measure.

Why

A rebuild often starts a little later or earlier than the original (a lead-in, a trimmed head). Today every frame is compared at the same time on both sides, so a render that is right but half a second late scores as wrong everywhere and its cuts read as missing plus extra. With --offset the two line up and the scores measure the picture again.

Related work

None.

How

The flag contract:

  • --offset <s> is a finite number of seconds and may be negative. The default is 0. Positive means yours runs behind the original; negative means it runs ahead.
  • For a render, yours is resampled at the original's rate starting at the offset (fps=…:start_time=<offset>), then its timestamps are rebased to zero even when no frames are trimmed. For a project folder, the capture times are shifted by the offset.
  • Shifted: SSIM for the whole frame and each cell, the frames.tsv rows, cuts (yours' cuts are compared, and reported, on the original's clock, which is yours' time minus the offset), missing content, drawn elements, the worst-moment pictures and their labels, the motion and look of regenerated segments, and the --sbs video.
  • The window keeps to where both sides have frames. window reports the clipped window, and warnings says how many frames were left out and which stretch of each side was compared. A project's length is only known after capture, so for a project only the start is clipped.
  • sound keeps its own offset measurement, unchanged.
  • duration stays a whole-video comparison. When the offset is not 0 it is reported as not measured (pass: null, with a note), because shifted lengths do not compare.
  • The person gates of regenerated segments (framing, carried text, lip sync) read both videos on one clock. With an offset they are not measured, and a warning says so; motion and look are still measured.
  • frames.tsv adds no columns. t stays the original's time, and the docs say that yours' time is t + offset.
  • The result JSON gains offset in seconds, echoing the input, when the flag is given.
  • An offset that is not a number, or one that leaves no overlap, gives ok: false with error and fix.
  • With no --offset (or --offset 0), the same filters, frame times and output are produced as before.

Test plan

  • Unit tests added: packages/cli/src/measure/diff-offset.test.ts and CLI cases in packages/cli/src/commands/diff.exit.test.ts
    • Frame-time mapping: yours' filter chain and project capture times for positive, negative and zero offsets.
    • Window clipping: the overlap for either sign, a longer render, a project with no known end, and no overlap at all; each kind of pick (all, range, at) clipped to it.
    • Synthetic renders: one half a second late (offset 0.5, end clipped, passes; fails with no offset) and one half a second early (offset -0.5, start clipped, passes). Both check window, the warning, frames.tsv rows and that duration is not measured.
    • Untrimmed late render: a full 3 s original delayed by 0.5 s compares all 90 frames with SSIM above 0.99, no warnings and a passing verdict. This test fails on 4336869 (SSIM 0.7691) and passes with the timestamp fix.
    • Cut matching after the offset: a cut half a second late matches at offset 0.5, and is missing plus extra without it.
    • Overlap refusal: offsets of 5 and -5 s, and an --at time pushed past yours' end.
    • Offset 0: frames.tsv and ssim.log are byte-identical to a run with no offset, and the result is identical apart from the echoed offset.
    • CLI: a non-number or overflowing --offset prints ok: false with error and fix; non-finite offsets are rejected for both video files and project folders before reading media.
    • With the offset ignored in diffVideos, the four synthetic-render cases fail.
  • The existing diff tests (diff.test.ts, diff-segments.test.ts, diff-people.test.ts, diff.exit.test.ts) pass unchanged.
  • oxlint, oxfmt and tsc --noEmit are clean on the changed files, and fallow audit reports no issues.
  • Documentation updated: docs/packages/cli.mdx.
  • Not exercised by a test: the --sbs video with an offset, and a project folder with an offset (only its capture times are unit-tested).

— Jerrai

… offset

Every per-frame measure (SSIM per frame and per cell, frames.tsv, cuts,
missing content) reads yours offset seconds later, and a project folder is
captured at the shifted times. The window keeps to where both sides have
frames and says so in warnings; an offset with no overlap, or one that is
not a number, is refused with a fix. Sound keeps its own offset reading,
duration is reported as not measured, and the result echoes offset.
@mintlify

mintlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 3, 2026, 1:52 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@agammann agammann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

parseOffset() accepts exponent notation but returns Number(value) without checking the result. --offset 1e309 passes the regex and becomes Infinity (while the literal Infinity is rejected), so captureTimes() and the video-clip calculations can receive non-finite timestamps. Could the parser reject results where !Number.isFinite(offset) and add an overflow regression?

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 1 nit · head 4336869

The headline case fails. A complete late render (yours = the original + 0.5 s at the head, nothing trimmed) scores as wrong with --offset 0.5. ↓ inline

  • nit: +1 to @agammann's 1e309 → Infinity point. In video mode it ends in the no-overlap refusal (I checked), but a project folder with +1e309 would capture at Infinity s.
Scope

Read the whole diff. Ran diff-offset, diff.exit, diff and diff-segments locally: 41/41 pass. Mutation check: dropping start_time fails all 4 synthetic offset cases. --sbs with offset 0.5 lines up (half-vs-half SSIM 0.993). CI is green.

— Claude (Genesis)

Comment thread packages/cli/src/measure/diff.ts Resolved
Keep offset streams on a zero-based clock even when every frame is selected. Cover an untrimmed delayed render and reject non-finite offsets before file or project processing.

— Jerrai

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · 2 resolved, 0 open, 1 new · 4336869 → 96c1b00

Both fixes check out locally. The new full-length test fails on 4336869 (0.7691) and passes now. A late render with an extra 1 s tail also passes (90/90, SSIM 0.995). The one blocker is Comments, which went red at this head. ↓ inline

— Claude (Genesis)

Comment thread packages/cli/src/measure/diff.ts Resolved

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE · 0 blocker · 0 important · 0 nits · 1 resolved, 0 open, 0 new · 96c1b00 → 7542b7d

The only change is the deleted comment line. Comments, CI and Windows render verification are all green at this head.

— Claude (Genesis)

@jerrai-bot-heygen

Copy link
Copy Markdown
Contributor Author

Lane sign-off (cutroom-dev:dsh) at head 7542b7d.

  • Genesis approved this exact head.
  • Genesis APPROVE at 7542b7d; dsh diff --offset

@jerrai-bot-heygen
jerrai-bot-heygen added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 3f42dc1 Nov 3, 2026
71 checks passed
@jerrai-bot-heygen
jerrai-bot-heygen deleted the jerrai/cli-diff_offset-11032026 branch November 3, 2026 11:06
@WaterrrForever WaterrrForever mentioned this pull request Nov 3, 2026
1 task done
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