Nodes/lip_mask_from_pose/Mouth Strip Crop (fixed union box)
ComfyUI Node

Mouth Strip Crop (fixed union box)

One locked-off box for the whole clip

By Jalen-Brunson·Created 5 months ago·Updated 10 days ago· 1
Mouth Strip Crop (fixed union box)
  • images
  • masks
  • matte
  • images
  • x
  • y
  • width
  • height
pad_x32
pad_y24
threshold0.50
snap16
backgroundkeep
background_blur_sigma14.0

If you're building a lipsync or dubbing pipeline, you've probably seen the "mouth-strip" trick: crop the reference video down to a tight vertical strip of just the mouth, and feed that strip to your control or guide model so it only has to track lip movement, not the whole face. Mouth Strip Crop is that trick, done properly, for an entire clip at once. The author built it for their own reference-clip workflow (the "H3 <Video N> refs" in the description are literally named after the source clips they use), and the design choices are worth understanding before you substitute your own crop node.

Why not just BatchCropFromMask?

The obvious tool is KJNodes' BatchCropFromMask, and the author's source notes explain exactly why it's wrong here. With two mouths far apart - a two-shot conversation, say - the union bounding box is wide and short, and BatchCropFromMask's size handling inflates the height until the crop is at face scale. They observed this directly: a 504×270 crop from an 848×480 two-shot, dragging eyes and hair into frame. A mouth guide needs the opposite: width spanning every lip pixel, height staying at lip scale. This node does that.

How it works

The core decision is a single fixed box for the whole clip. It unions the mask pixels across every frame (anything above the threshold, default 0.5), pads that union by pad_x/pad_y (defaults 32/24), grows the crop to a multiple of snap (default 16 - the tooltip spells out why: it keeps encoders and VAEs happy), and crops every frame with that same box. Zero jitter across the clip, so it reads like a locked-off close-up, and when two mouths converge for a kiss, the same box simply frames the contact instead of dancing around.

The inputs that matter:

  • images and masks - the frames and a mouth-mask batch of the same length (the tooltip suggests MouthMaskFromSapiens2Seg's mask_a, a sibling node in this same pack).
  • background - what to do outside the matte inside the strip. keep is the default; blur is the interesting one, giving that shallow-depth-of-field look that hides eyes and identity sharing the strip's vertical range while staying natural video. black is the hard cut.
  • matte (optional) - a soft matte of the region to keep sharp, for finer control than the raw mask; defaults to masks if unconnected.

Outputs are images plus the x, y, width, height of the box - you'll want those to paste the crop back into the full frame or pass the coordinates to a VACE paste stage.

Install & troubleshooting

It's part of Jalen-Brunson/lip_mask_from_pose - ComfyUI Manager (search the pack name) or:

cd ComfyUI/custom_nodes
git clone https://github.com/Jalen-Brunson/lip_mask_from_pose

Restart after. No extra dependencies beyond what ComfyUI ships.

Two gotchas the source is upfront about. First, if the mask is empty across the entire clip, the node raises an error - there's genuinely nothing to crop to, so fix your upstream mask. Second, masks must be the same length as images (or a single frame, which it'll reuse), and it auto-resizes a spatial mismatch. If your crop looks like it's missing lips, check that your mask batch isn't being truncated upstream.

CategoryLipMask

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
masksMASKMouth mask batch (same length as images), e.g. MouthMaskFromSapiens2Seg mask_a
pad_xINT320–1024Horizontal padding around the union of mask pixels
pad_yINT240–1024Vertical padding around the union of mask pixels
thresholdFLOAT0.500–1
snapINT162–64Crop dims are grown to a multiple of this (keeps encoders/VAEs happy)
backgroundCOMBOkeepWhat to do OUTSIDE the matte inside the strip. 'blur' looks like shallow depth of field — hides eyes/identity that share the strip's vertical range while staying natural video.
background_blur_sigmaFLOAT14.01–64
matteoptMASKSoft matte of the region to KEEP SHARP (e.g. mask_b of the same MouthMaskFromSapiens2Seg with bigger grow/blur). Defaults to `masks` if unconnected.

Outputs (5)

NameTypeDescription
imagesIMAGE
xINT
yINT
widthINT
heightINT