Skip to content

Hold the face crop still through head and body sways - #439

Merged
dillonstreator merged 1 commit into
mainfrom
claude/fix-crop-sway-deadzone
Dec 2, 2026
Merged

dillonstreator merged 1 commit into
mainfrom
claude/fix-crop-sway-deadzone

Conversation

@dillonstreator

Copy link
Copy Markdown
Member

Problem

The face crop panned left and right every time the person swayed their head or body (reported on Stavvy's World #203 and Kill Tony #794, and seen in many clips). tripodTrack had a dead zone of 0.025 of the source width (about 8% of a 9:16 window). Between pans it also crept back to the face centre, so every nod and rock moved the crop.

Fix: a lookahead dead zone (tripodTrack, layout.ts)

  • Window size. The crop window is what the frame shows (cropView):

    • 0.316 of a 16:9 source for the face or subject crop;
    • a face-sized pane for split and stack, each planned for its own width;
    • 0.42 of a 4:3 source, and all of a vertical one.
  • Holding still. The camera holds while the whole face box stays inside the window less a 10% margin on each side. A tight close-up still gets 12% of the window to wander. There is no creep back to the centre.

  • Moving. When the face (3-sample average) is about to leave that zone, the camera reads the next 2 s and chooses one position that keeps the face inside for as long as one position can. That position is the median of where the face is over that time. It gets there in one smoothstep move:

    • 0.8–1.6 s long, at 0.25 source widths a second on average;
    • started half its length before the face would cross the margin.

    The result is one move out and one move back per excursion, not a series of corrections.

  • Cuts. Scene cuts and missed cuts (trackBreaks) still cut. Each stretch is planned on its own, and a move that would run past a cut stops at it.

  • Unchanged. Target choice is untouched: Follow the talker shot by shot, over any number of faces, without jitter #436's per-shot talker following, its 1.5 s switch delay and its 0.6 s ease between people (talkerTrack), and Keep printed faces out of auto layout and stop per-shot layout churn #438's printed-face filter and layout hysteresis. This change only affects the path the crop takes on one person.

The new constants are TRIPOD, documented in docs/LAYOUTS.md under "The crop's path".

Evals (framing suite, run offline from committed face samples)

Track cases now score:

  • movesPerMin: separate moves a minute;
  • panPerMin: window widths slid a minute;
  • inView / inMargin: the share of frames whose face box lies inside the 9:16 window, and inside it less the 10% margin.

These come from cropMotion. Per-shot subject labels pick the person when others share the shot (the Kill Tony panel), so a case scores the crop path rather than target choice.

New cases from the report:

  • track-sway-podcast-closeup: Stavvy's World Release #203, clip 2c83b6ab;
  • track-sway-standup-mic: Kill Tony #794, clip ac188505; the comic rocks at the mic, with the band and panel in the shot.
case moves/min window widths/min face in window in margin
track-sway-podcast-closeup 27.36 → 0 1.275 → 0 1 → 1 1 → 1
track-sway-standup-mic 4.42 (moving the whole time) → 3.32 13.824 → 0.089 1 → 1 1 → 0.968
track-closeup-settle 32 → 4 2.257 → 0.665 1 → 1 0.984 → 0.951
track-4x3-interview 18.03 → 0 0.419 → 0 1 → 1 1 → 1
track-recentre-after-card 13.77 → 0 0.392 → 0 1 → 1 1 → 1

"Before" is main's tripodTrack with the new metrics.

  • Splits: they no longer drift. Drift is down from up to 0.055 to 0 on all three split cases, and worstSpeakerOffset went from 0.045 to 0.002.
  • Suite summary: passRate 0.92 → 0.93, with no regressions (the two known shots failures are unchanged). The baseline is updated.
  • Trade-off: the margin share drops a little where the crop no longer chases (0.968 and 0.951). The face stays inside the window in every frame.
  • Changed expectations: track-4x3-interview and track-closeup-settle used to require the crop to settle within 30 px of the face centre. That is exactly the creep this removes, so they now ask for the face to stay inside the window and its margin, plus a moves-per-minute cap. Both notes say so. track-recentre-after-card keeps its centring and recentre checks.
  • speakers suite: run with LR-ASD, all 9 cases pass. The follow cases are still on the talker 1.00 (comic-across-cuts) and 0.98 (three-at-the-desk) of the time.

Verified on a local instance

  • Builds: the "before" renders ran on the Keep printed faces out of auto layout and stop per-shot layout churn #438 build. The "after" renders ran on this branch, built as image reelsaw:clipfarm-sway at 3f78b059. The clips were rendered with the instance's normal settings.
  • Metric: these numbers come from each clip's stored crop track (layout_segments[].track, sampled at 1 s). They count "moving" 1 s steps, which includes snaps at cuts.
clip layout moving 1 s steps window widths/min
2c83b6ab Stavvy's World #203 face 26 → 5 (4 are shot cuts) 1.10 → 0.34
ac188505 Kill Tony #794 (Follow speaker) face 51 → 3 10.95 → 0.08
e6e141f7 This Past Weekend face 43 → 17 3.14 → 1.89
87b9cf18 Kill Tony #793 mixed 37 → 8 3.41 → 1.32
a54a071f Sam Morril podcast face 32 → 24 13.37 → 13.11

a54a071f cuts every 1–2 s between two cameras (x 0.51 / 0.71). Its remaining steps are snaps at those cuts; within shots the crop now holds (for example 22–24 s and 34–39 s).

Frame strips at 2 fps (top: before, bottom: after) show that the background no longer slides while the person sways inside the frame.

Also

  • Unit tests in apps/server/test/tripod.test.ts cover:
    • window sizes;
    • a sway inside the margin does not move the crop;
    • an excursion is one move out and one back, started before the face reaches the margin, with no creep while there;
    • a slow drift is followed in a few moves;
    • points stay in time order when a move runs into a cut.
  • docs/LAYOUTS.md and docs/EVALS.md are updated, and there is a changeset.
  • The non-null assertion ratchet is lowered to 1978 (the old tripod code's assertions are gone).

The tripod camera followed the face within 0.025 of the width and crept back to
centre between pans, so every sway panned the crop. It now holds while the face
box stays inside the 9:16 window less a 10% margin, and when the face would
leave it, reads the next 2 s and makes one eased move that covers the
excursion. The window is sized per layout (cropView), so split and stack panes
plan for their own width.

Framing eval: track cases score moves and window widths a minute and whether
the face stays inside the window and its margin (cropMotion); two new cases
from the report (Stavvy's World #203, Kill Tony #794).

Signed-off-by: dillonstreator <dillonstreator@gmail.com>
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
reelsaw-website Ready Ready Preview Dec 2, 2026 8:55pm UTC

Request Review

@dillonstreator
dillonstreator merged commit c476387 into main Dec 2, 2026
17 checks passed
@dillonstreator dillonstreator mentioned this pull request Dec 2, 2026
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