MpFaceTrackingMultiElement Op
Get face mesh from webcam/video using mediapipe library
Get face mesh from webcam/video using mediapipe library
Summary (oneliner)
read more on the mediapipe project page: https://chuoling.github.io/mediapipe/solutions/face_mesh.html
some info about the mesh data: https://github.com/lysdexic-audio/n4m-facemesh
Overview of Improvements markdown_content = """# FaceMesh Operator: Multi-Face Tracking Documentation Update
Overview of Improvements
The upgraded operator transitions from a single-face tracking prototype to a production-ready, multi-face tracking node with improved frame scheduling, coordinate stabilization, and resource cleanup.
- Simultaneous Multi-Face Tracking: Tracks up to $N$ faces simultaneously instead of hardcoding detection to a single face.
- Spatial Index Sorting: Eliminates index-swapping jitter across frames by sorting detected faces along the X-axis.
- Bounding Box Generation: Computes normalized 2D bounding boxes (center X/Y, width, height) in real time for each detected face.
- Custom Render Loop & State Protection: Replaces the third-party
Camerautility with an asynchronousrequestAnimationFrameloop featuring concurrency gating (isProcessing) and videoreadyStatechecks to prevent MediaPipe freezes. - Lifecycle & Memory Management: Implements
op.onDeleteto cancel active animation frames and callfaceMesh.close(), preventing WebAssembly (WASM) memory leaks on operator recompilation or deletion.
New Input Parameters
Max Faces(inMaxFaces| Integer, default:4): Defines the maximum number of faces MediaPipe should detect and track simultaneously.Min Detection Confidence(inMinConfidence| Float Slider, default:0.5): Sets the minimum confidence score ($[0.0, 1.0]$) for the face detection model to consider a detection successful.Min Tracking Confidence(inMinTracking| Float Slider, default:0.5): Sets the minimum confidence score ($[0.0, 1.0]$) for landmark tracking; higher values reduce jitter but drop fast-moving faces.Sort Faces (L to R)(inSortFaces| Boolean, default:true): Orders output arrays from left to right based on face center X coordinates, preventing target index swapping when people shift positions.Flip X(inFlipX| Boolean, default:false): Inverts coordinates along the horizontal axis, providing mirrored mapping suitable for standard selfie/webcam feeds.
Output Changes
Points(outPoints| Array): Now outputs an array of point arrays (allPoints[faceIndex]), where each nested array contains the normalized 3D coordinates $(x, y, 0)$ for that face.Bounding Boxes(outBoxes| Array): Emits an array of 4D bounding boxes formatted as[centerX, centerY, boxWidth, boxHeight]for each detected face.Found Faces(outFound| Number): Outputs the total number of faces successfully identified in the current frame.
- Ops.Patch.PR5Jn1t.MpFaceTrackingMultiElement
- Patch Op - visible in this patch only
- MIT
- Aug 22, 2026 at 13:00
- mp_face.js (commonjs)
Documentation (markdown)
Issues
Example patch id
Youtube ids (comma seperated)
Op Licence
Caniuse query
Multi Face Tracking Bounding box & video Element
Multiface tracking Op with bounding box and videoTextureElement Op example
Inspired by https://cables.gl/p/fr5hEj and https://cables.gl/p/Q78AyQ
New features added (check Op's documentation)
INPUT PORTS
Source webcam/video as HTML element
Maximum number of faces to detect simultaneously in the frame
Minimum confidence threshold required to successfully detect a new face
Minimum confidence threshold required to maintain tracking on an existing face across frames
Automatically sorts detected faces from left to right to prevent index swapping between frames
Enables detailed eyes and lips landmarks and adds landmarks for iris
Horizontally mirrors the output coordinates and bounding boxes