ComfyUI Node

Face Crop Info

The face detector that unlocks LivePortrait's multi-face mode

By MixLabPro·Created 2 years ago·Updated 2 years ago· 479
Face Crop Info
  • source_image
  • crop_info
  • debug_image
face_sorting_directionleft-right
face_index0
debugfalse

FaceCropInfo is the small utility node that does the unglamorous but essential job: find the face (or faces) in an image, work out where each one sits, and package that up as crop info the rest of the pack can use. On its own it doesn't animate anything. But it's the piece that turns this Mixlab LivePortrait pack from "animate one face" into "animate everyone in a group photo, each with their own driving video" - which is the main reason to pick this pack over the more common Kijai one.

It runs a YOLO face detector under the hood (the pack borrows this from shadowcz007's comfyui-ultralytics-yolo), so it needs a YOLO face model on disk before it'll do anything - more on that below.

How it works

You give it an image; it detects the faces, computes a crop box and alignment for each one, and emits that as a CROP_INFO bundle - one entry per face. Downstream, LivePortraitNode takes that crop_info on its optional input and uses it to know exactly which region to warp, so the animation is precise instead of relying on the node to re-find a single face itself. Feed it a photo with several faces, tell it to process all of them, and you get a list of crops - the foundation of the group / "family portrait" workflow where each detected face is driven independently.

The inputs and outputs that matter

One required input, source_image (IMAGE) - the picture to scan. Then three optional controls that actually matter:

  • face_index (INT, default 0) - which face to return. Set it to a specific index to target just one face; set it to -1 to process every face it finds, which is exactly how you enable the multi-face path. This is the switch between single-face and group behavior.
  • face_sorting_direction (enum: left-right / large-small, default left-right) - the order faces come back in when there's more than one. left-right orders them across the frame; large-small puts the biggest (usually nearest) face first. This is what makes "face index 2" mean a predictable person shot to shot.
  • debug (BOOLEAN, default false) - turn it on and the node draws the detected boxes onto an image so you can see what it actually found. Invaluable when a face isn't being picked up or the crop looks off.

Outputs are crop_info (CROP_INFO, a list - one per face) and debug_image (IMAGE, the annotated preview). The crop_info list is what you wire into LivePortraitNode, optionally routing it through a Retargeting node first to toggle eye/lip driving.

How to install it

ComfyUI Manager → search comfyui-liveportrait → install → restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-liveportrait

then restart. Two model requirements here, not one. The usual LivePortrait and InsightFace weights (Google Drive / Baidu links in the README) go under ComfyUI/models/liveportrait and ComfyUI/models/insightface. And FaceCropInfo needs a YOLO face model - download face_yolov8m.pt (or the lighter face_yolov8n.pt) from the ultralytics assets releases and place it in ComfyUI/models/ultralytics/bbox/.

Common issues

The failure that's unique to this node is a missing or misplaced YOLO model - no face_yolov8*.pt in models/ultralytics/bbox/ and detection simply won't run. That's the first thing to check if FaceCropInfo errors while the rest of the pack loads. If it runs but grabs the wrong person, that's a face_index / face_sorting_direction problem - flip on debug and read the boxes off the debug image. Faces that are small, turned, or partly hidden may not be detected at all; YOLO wants a reasonably clear, reasonably frontal face. And the shared pack realities still apply: the LivePortrait and InsightFace weights don't auto-download, InsightFace is the dependency most likely to break the import, and its model weights are non-commercially licensed.

Category♾️Mixlab/Video/LivePortrait

Inputs (4)

NameTypeDefaultDescription
source_imageIMAGE
face_sorting_directionoptCOMBOleft-right2 options: left-right, large-small
face_indexoptINT0-1–200
debugoptBOOLEANfalse

Outputs (2)

NameTypeDescription
crop_infoCROP_INFO
debug_imageIMAGE