Motion tracking

Follow a point or a region through a video clip, then make a mask follow it or pin a title, sticker or another clip to it, from the Inspector or from an agent with fablecut_track.

Motion tracking follows something in a video clip frame by frame: a corner, a logo, a face, a sign. The result is a track stored on the clip, and masks and other clips follow it by having it written into their keys. Rendering never reads a track, so a followed mask or title renders and exports exactly like a hand-keyed one, and you can edit its keys afterwards.

"tracks": [
  { "name": "Logo", "kind": "point", "w": 0.08, "h": 0.14,
    "samples": [[0, 0.31, 0.42, 1, 0, 1], [0.0333, 0.312, 0.421, 1, 0, 0.98]] }
]
keydoes
namehow masks, clips and agents refer to it (default Track n, or the mask's name)
kindpoint (position) or box (position, size and rotation were followed)
w · hthe region that was matched, fractions of the clip's picture
samplesone per frame: [t, x, y, s, r, q]. t is seconds from the clip's start, x, y is the centre (fractions of the picture, like masks), s is the scale and r the rotation (°) relative to the first sample, q is the match quality 0…1

The tracker matches a small greyscale template of the region (normalized cross-correlation, sub-pixel, optionally over scale and rotation) and keeps the template fresh while anchoring it to the first frame so it does not drift. It stops where the match quality drops below 0.45 (the region was covered, left the frame or changed too much) and keeps what it tracked up to there. Pick regions with detail: corners, text, edges. Flat sky or a blank wall can't be tracked. A track without scale follows position only: if the thing grows, shrinks or turns noticeably, turn on Scale / Rotate (scale / rotation), or the match fades and the track stops early. Tracks are stored in clip time, so they move with the clip and follow trims and splits (re-track after changing its speed).

In the editor:

Agents: fablecut_track runs the tracker in the editor (an open tab, else headless Chrome / Edge) and saves the result:

Recipes: a title that follows a car - track a point on the car, attach the title; blur a face or a plate - an ellipse mask on a blurred copy of the shot on the track above, then apply:{mask:"Face"}; a screen replacement - track the screen with Scale and Rotate on and attach the new picture, cropped to fit; a highlight that stays on a UI element in a screen recording - track the button, attach a rect svg.