Nodes/ComfyTV/Corner Pin
ComfyUI Node

Corner Pin

Warp footage onto a screen by dragging four corners

By jtydhr88·Created 3 months ago·Updated about 15 hours ago· 725
Corner Pin
  • video
  • track
  • video
force_run_token0
project_id
parent_output_id0
corners
keyframes

Every screen replacement, billboard insert, and "put my logo on that angled wall" shot comes down to the same trick: take your clip, drag its four corners to where they belong in the shot, and let the math figure out the perspective. Corner Pin is that, done the way you'd expect from an actual editor - you drag the four handles right on the node, it applies a homographic warp so the footage fits the surface, and it renders on ▶ Run. No typing coordinates, no fiddly math.

It can also grow up: the corners can be keyframed for a moving surface, or driven by a track input from a corner tracker, which is the difference between a one-off screen swap and pinning footage onto something that's actually moving in the frame.

How it works

The node stores your four corners as corners - JSON in [[x1,y1],[x2,y2],[x3,y3],[x4,y4]] order, TL, TR, BR, BL - normally written by dragging the handles rather than typing. A ▶ Run renders the warp via the pack's corner_pin_video runner. If you wire a track input (COMFYTV_TEXT) carrying corner keyframes - say from a planar tracker - it overrides the manual keyframes. And the keyframes field itself is JSON [{t, corners}] for animating the pins over time, usually authored through the node UI.

The one honest error in this pack is here too, and it's a good one: run it without placing four corners and without keyframes, and it stops and tells you to drag the corners first. COMFYTV_VIDEO in and out; Bridge to native nodes if you need them.

The inputs that matter

  • corners - the four destination corners, TL/TR/BR/BL order. Drag on the node; don't hand-type unless you know the coordinate space.
  • keyframes - advanced animation of the corners over time, for a moving surface.
  • track - optional COMFYTV_TEXT corner-tracking data that overrides keyframes when present.

Output is video (COMFYTV_VIDEO).

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV

Restart the ComfyUI backend (a real restart, not a tab refresh); nodes appear under the ComfyTV category. ComfyUI Manager finds the pack by searching "ComfyTV". The README's two recurring gotchas: on Desktop/macOS/multi-install setups the relative cd can clone into the wrong instance - read the startup log for the base path it loaded and clone into that absolute path, quoted - and the first level of custom_nodes/ComfyTV/ must contain __init__.py, not a nested ComfyTV/ComfyTV/ folder. No Python dependencies to install.

Troubleshooting and tips

  • "Drag the four corners on the node first." You ran it with no corners and no keyframes. Do that, or wire a track.
  • Folded / degenerate warp. Corner order is fixed TL→TR→BR→BL. Cross them up and you get a twisted mess, not a perspective fit.
  • Just pan/scale/rotate? Don't reach for a corner pin - Video Transform does that more cleanly. Corner Pin is for free perspective where the surface is angled.
  • Screen replacement workflow. Warp your new content in here, then composite it onto the background with Video Composite. The corner pin is the match; the composite is the reveal.
CategoryComfyTV/VideoFX

Inputs (7)

NameTypeDefaultDescription
force_run_tokenINT00–2147483647Internal — bumped on Run to invalidate ComfyUI's input cache.
project_idSTRINGInternal — populated by the projectStore on the frontend.
parent_output_idINT00–2147483647Internal — lineage parent set by spawn handlers on the frontend.
cornersSTRINGJSON [[x1,y1],[x2,y2],[x3,y3],[x4,y4]] TL,TR,BR,BL
keyframesSTRINGJSON [{t, corners}]
videooptCOMFYTV_VIDEO
trackoptCOMFYTV_TEXT

Outputs (1)

NameTypeDescription
videoCOMFYTV_VIDEO