ComfyUI Node Runs on cloud

Video Reframe

9:16 without cropping the actor's face off

By WASasquatch·Created 4 years ago·Updated a day ago· 1,864
Video Reframe
  • video
  • mask
  • motion
  • video
  • preview
◄aspect9:16►
◄smoothing0.50►
◄zoom1.00►
◄followlargest►

Reframing a landscape clip for a phone is the most boring task in video and the one everybody has. Centre-crop it and half the shots cut the subject's head off; keyframe the window by hand and you will be there all afternoon. Video Reframe crops a clip to another aspect with the window following a subject that a mask marks, along a smoothed path, resetting at each scene so a cut does not drag your window across the frame.

And it keeps the source's own pixels - a 9:16 crop of a 1216×688 clip is 386×688, not an upscale. That matters: you are not inventing detail, you are choosing a window.

Inputs

video is the clip. aspect is the crop ratio: 9:16 for vertical, 4:5 for a portrait post, 1:1 for square.

smoothing is the personality of the move, in seconds of movement averaged into the path: 0 locks the window to the subject (twitchy, use for a locked subject), 0.5 is the default, 2 is a slow steady follow that looks like a real camera operator. In practice 0.5–1.0 is where most clips look best; the whole reason this is a seconds value rather than a slider is so you can think "how long a beat should the window take to react".

zoom is how much tighter than the largest crop that fits: 1.0 takes the full height of the frame, 1.5 is closer, up to 4. A little zoom is the escape hatch for a subject that keeps sliding out of a full-height window.

follow is what part of the mask the window tracks - largest follows its biggest region held from frame to frame, which is what you want for one subject among several; everything uses the centre of all of it.

mask is the subject per frame, white on the subject, from something like SAM 3, or a single mask for the whole clip. Frames where the mask is empty keep the last position, which is the correct behaviour and also why a mask with one bad frame does not ruin the shot. motion is optional and takes a shared measurement from Video Motion; the cuts in it reset the path, and left empty cuts are found here. That cut-reset behaviour is the difference between a usable tool and a joke - without it, a cut to a new shot sends the window lurching.

Outputs

video is the reframed clip at the crop's size, with the source's frame rate and audio. preview is the source at its own size with the window outlined and the rest dimmed - wire it to a preview node and check it before you spend time encoding anything. Watching the window travel through the preview is the fastest way to see that smoothing is too low or that the mask is jumping to a different person.

Install

ComfyUI Manager → search WAS Node Suite v3 → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

ComfyUI 0.14.0+ and Python 3.10+. The pack installs no packages of its own - requirements.txt is a comment, no pip runs - and it needs no model files. The mask is on you: SAM 3's ComfyUI node is the usual source, though that one wants Triton and is a known annoyance on Windows. A simpler per-frame matte from whatever you already run works fine; the mask only has to be roughly right, since the path is smoothed anyway.

Where it goes wrong

One mask for the whole clip vs per frame. A single mask is fine for a static subject and wrong the moment they move. Per-frame masks, plus smoothing doing the stabilising, is the normal case.

A mask that catches two people. follow: largest grabs the biggest region; if the wrong person is slightly bigger, the window follows them. everything averages both and centres between them, which is sometimes the better answer for a two-hander.

Expecting it to fill a vertical frame. This crops, it does not outpaint. If you need a genuine 9:16 composition with new pixels at the sides, that is a video model with an outpainting pass, not a crop window.

Smoothing as a fix for a bad mask. It will not be. It makes a jittery path smooth, not a path that is following the wrong object.

CategoryWAS Suite/Animation

Inputs (7)

NameTypeDefaultDescription
videoVIDEOThe clip to reframe.
aspectCOMBO9:16Width to height of the crop: '9:16' = phone; '4:5' = portrait post; '1:1' = square.
smoothingFLOAT0.500–10Seconds of movement averaged in the path: 0 = locked to the subject; 0.5 = default; 2 = a slow, steady follow.
zoomFLOAT1.001–4How much tighter than the largest crop that fits: 1.0 = full height; 1.5 = closer.
followCOMBOlargestWhat of the mask the window follows: 'largest' = its biggest region, held from frame to frame, for one subject among several; 'everything' = the centre of all of it.
maskoptMASKThe subject per frame, white on the subject, such as from SAM 3, or one mask for the whole clip. A frame where it is empty keeps the last position.
motionoptWAS_MOTIONMotion from Video Motion, measured from this same clip at any size, whose cuts reset the path. Left empty, cuts are found here.

Outputs (2)

NameTypeDescription
videoVIDEOThe reframed clip at the crop's size, with the source's frame rate and audio.
previewVIDEOThe source at its own size with the window outlined and the rest dimmed, for showing where the frame travels.