Nodes/ComfyUI Warper Nodes/Mouth Mask from Pose (Warper)
ComfyUI Node

Mouth Mask from Pose (Warper)

Lip-sync masks without a single manual paint

By AIWarper·Created about a year ago·Updated 8 months ago· 14
Mouth Mask from Pose (Warper)
  • pose_keypoints
  • MASK
mask_radius25
person_index0

Lip-sync and talking-head work is where ComfyUI's inpainting story gets genuinely annoying: you need a mask that covers only the mouth, frame after frame, and the mouth moves. Painting that by hand is misery, and a static mask drifts off the mouth the moment the head turns. Mouth Mask from Pose (Warper) does the whole job from pose keypoints - it reads the mouth landmarks out of a DWPose detection, averages them into a center point, and draws a circle of the radius you choose. The mouth can move anywhere in the frame and the mask follows it.

It's one of the pose-masking nodes in ComfyUI Warper Nodes, the niche pack from workflow author AIWarper. This is the simpler sibling of Facial Part Mask from Pose (Warper) - same idea, but it just does the mouth, in a circle, no shape options, no expansion controls.

How it works

The input pose_keypoints is the standard POSE_KEYPOINT output from a DWPose preprocessor - the same thing that comes out of ControlNet Aux's DWPreprocessor or Impact Pack's DWPose detector. It's a per-frame structure carrying face_keypoints_2d plus canvas dimensions, and this node processes each frame's detection in sequence. It grabs face keypoints 48–67 (the mouth landmarks in the standard 68-point face layout), keeps only the ones the detector is confident about, takes their mean as the mouth center, and stamps a filled circle onto a blank mask with cv2.circle using mask_radius.

Three inputs, and they're all the meaningful ones:

  • pose_keypoints - feed it the DWPose output. If there's no detection or the face keypoints are empty, you get a black (empty) mask rather than a crash.
  • mask_radius - pixels around the mouth center. Default 25 is tight; lip-sync masks usually want a bit more, say 30–40, unless your character has a very small face on canvas.
  • person_index - which detected person to mask, for frames with multiple people. 0 is the first.

Output is a single MASK, one per input frame, batched together. Wire it into an inpaint pipeline or a regional conditioning setup and you've got frame-accurate mouth masking for free.

Installing it

Same pack install as every Warper node. In ComfyUI Manager search "ComfyUI-WarperNodes" and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/AIWarper/ComfyUI-WarperNodes
# restart ComfyUI

No extra pip dependencies for the masking nodes - the code uses opencv for drawing, which your ComfyUI env almost certainly already has. The heavy RAFT model download in this pack's README is only for Flow Visualizer, not this node.

Common issues

The classic gotcha isn't the node, it's the feed: these nodes don't take an image, they take DWPose keypoints. If you try to wire an IMAGE into pose_keypoints ComfyUI won't let you, and if you're getting empty masks, the detector upstream likely found a face but no confident mouth landmarks (profile shots, extreme angles, or a detector running on a tiny downscaled frame). The mouth center is a plain average of the valid landmarks, so a partially-detected mouth pulls the circle off-center - that's when you reach for the bigger sibling with its ellipse and convex-hull shapes instead. Also note the mask is a circle, not a lip outline; for lip-sync purposes that's usually exactly what you want, for precise re-mouthing you want the facial-part version.

CategoryWarper Tools/DWMasking

Inputs (3)

NameTypeDefaultDescription
pose_keypointsPOSE_KEYPOINT
mask_radiusINT251–512
person_indexINT0

Outputs (1)

NameTypeDescription
MASKMASK