Extensions/ComfyUI-AdvancedLivePortrait-Universal
ComfyUI Extension

ComfyUI-AdvancedLivePortrait-Universal

Maintained AdvancedLivePortrait fork with universal device support (Intel XPU, Apple MPS, CUDA, ROCm, CPU) and other improvements.

By cyberterm·Created 21 days ago·Updated 18 days ago· 2
cyberterm/ComfyUI-AdvancedLivePortrait-Universal
Nodes6
On cloudLocal install
CategoryAdvancedLivePortrait
Stars2
Updated18 days ago
Readme

ComfyUI-AdvancedLivePortrait (Universal Edition)

🌟 Maintained Community Edition: This is an actively maintained, modernized edition of the original PowerHouseMan/ComfyUI-AdvancedLivePortrait. Beyond adding native multi-device hardware acceleration, this edition loads the official neural eye & lip retargeting networks, modernizes expression presets to safe JSON, adds optional FP16 autocast acceleration, and includes updated workflow templates.


Key Enhancements in this Edition

1. Universal Device & Hardware Acceleration

Unlike the original CUDA-only implementation, this edition integrates natively with ComfyUI's model management:

  • Intel Arc & Data Center GPUs (XPU) — Full acceleration via PyTorch XPU backend.
  • Apple Silicon (MPS) — Metal Performance Shaders acceleration on macOS (M1/M2/M3/M4).
  • NVIDIA GPUs (CUDA) — Native CUDA acceleration with Tensor Core optimizations.
  • AMD GPUs (ROCm / DirectML) — Accelerated through ComfyUI device mapping.
  • CPU Fallback — Graceful execution when ComfyUI is launched in CPU mode (--cpu).

2. Safe & Portable JSON Expression Presets

  • No More Pickled Binaries: Upstream used dill to pickle internal Python objects and PyTorch tensors, which hardcoded CUDA memory pointers (crashing on Intel Arc, Mac, and CPU) and broke on forked repository paths.
  • Human-Readable .json: Presets are now saved as lightweight, human-readable JSON files that can be edited, shared, and loaded seamlessly across any operating system and hardware device.
  • Automatic Legacy Migration: Any legacy .exp files in output/exp_data/ or sample/ are automatically loaded safely across all devices (CUDA, XPU, MPS, CPU) and auto-migrated to .json.

3. Optional Half-Precision (FP16) Acceleration

  • Faster Batch Rendering: Optional half_precision toggle on AdvancedLivePortrait and ExpressionEditor accelerates video rendering by ~35% to 45% and cuts peak activation VRAM in half.
  • Native PyTorch Autocast: Uses dynamic autocast rather than destructive model casting.
  • Zero Jitter: Heavy neural networks (WarpingNetwork, SPADEDecoder) run in FP16, while coordinate math, Euler rotation matrices, and stitching offsets stay in Float32 to eliminate pupil/mouth micro-jittering.

4. Neural Eye & Lip Retargeting Networks

  • Real Retargeting Modules: Unlike the original implementation which used basic coordinate-shift heuristics, this fork actually loads and runs the official LivePortrait retarget_eye and retarget_lip neural networks from stitching_retargeting_module.pth / .safetensors.
  • Natural Eye Blinking & Lip Motion: Dynamically calculates eye openness and lip separation ratios, feeding them through the retargeting MLPs for lifelike eye blinking, pupil tracking, and mouth synchronization without facial distortion.
  • Full Node Integration: Fully integrated into both AdvancedLivePortrait (for video retargeting) and ExpressionEditor (for OnlyEyes and OnlyMouth transfer modes), with automatic fallback if retargeting weights are absent.

5. Ready-to-Run Workflow Templates

Includes 5 refreshed, ready-to-use workflows in example_workflows/ accessible directly from ComfyUI's sidebar template browser.


Features Overview

  • ExpressionEditor: Interactive slider-based facial expression adjustments (smile, wink, eyebrow, gaze, mouth shapes, head pose) with real-time UI preview.
  • Animation Chaining: Multi-keyframe facial expression sequences with automated smoothing and interpolation.
  • Expression Presets: Save and load reusable .json expression presets (SaveExpData, LoadExpData).
  • Video Retargeting: Drive portraits with facial motion extracted from driving video clips or reference photos.

https://github.com/user-attachments/assets/90b78639-6477-48af-ba49-7945488df581


Installation

Clone this repository into your ComfyUI/custom_nodes/ directory:

cd ComfyUI/custom_nodes
git clone https://github.com/cyberterm/ComfyUI-AdvancedLivePortrait-Universal.git

Or install via ComfyUI Manager by searching for ComfyUI-AdvancedLivePortrait-Universal.


Usage & Workflow Templates

Built-in Templates

This extension includes ready-to-run ComfyUI workflow templates. To load them inside ComfyUI:

  1. Click on the Templates icon in the ComfyUI sidebar.
  2. Select ComfyUI-AdvancedLivePortrait-Universal.
  3. Choose any of the included workflows:
    • 01_Basic_Simple_Expression_Editing — Interactive slider expression editing on a single portrait.
    • 02_Basic_LivePortrait_With_Expression_Editing — Driving portrait animation with a video + expression tweaking.
    • 03_Basic_Extracting_Expression_From_Photo — Extracting expressions from a reference photo onto your portrait.
    • 04_Advanced_Animate_Without_Video — Multi-keyframe animation chaining without needing a driving video.
    • 05_Advanced_Inserting_Expressions_Into_Video — Seamlessly injecting scripted expressions into driving video clips.

Test Assets & Sample Media

Sample assets are bundled in the sample/ directory:

  • Ready-to-use samples: source_image.png, driving_video.mp4, exp_image.png, sample_exp_data.json.
  • Sample library: sample/original_sample_asset/ contains additional driving video clips (driving/d0–d9.mp4) and portrait photos (source/s0–s10.jpg).

Command Timeline Scripting

You can sequence facial expressions over time using the command text box in the AdvancedLivePortrait node:

readme

[Motion index] = [Changing frame length] : [Length of frames waiting for next motion]

  • Motion index 0 is the original source image.
  • Indexes 1, 2, ... correspond to the order connected through motion_link.
  • Linking a driving video to src_images will layer facial expressions on top of the driving video.

Saving & Loading Expressions

You can save and load custom expression presets with the Save Exp Data and Load Exp Data nodes:

  • Save Exp Data: Connect save_exp from ExpressionEditor and specify a file_name (e.g. happy_smile). Presets are saved as clean, human-readable .json files in ComfyUI/output/exp_data/. Outputs the saved preset name as a string.
  • Load Exp Data: Select any saved preset from the file_name dropdown menu, or wire a name into custom_name (e.g. chained directly from SaveExpData). Scale the expression strength using the ratio slider (0.0–1.0).
  • Universal Backwards Compatibility: Legacy .exp files in output/exp_data/ or sample/ are automatically loaded across all devices (CUDA, Intel XPU, Apple MPS, CPU) and auto-migrated to .json.

Changelog

See CHANGELOG.md for full release notes and version history.


Thanks & Credits

  • Original LivePortrait paper & models: https://liveportrait.github.io/
  • Upstream ComfyUI implementation: https://github.com/PowerHouseMan/ComfyUI-AdvancedLivePortrait
  • Safetensors model conversions: https://github.com/kijai/ComfyUI-LivePortraitKJ