precison9/avatar-animation-pipeline
0
๐ญ Video-Driven Avatar Animation Pipeline
Production-quality system that captures real human facial performance from video and retargets it onto a stylized avatar.
Architecture
Input Video (MP4, front-facing, well-lit)
โ
โผ
[1] Face Detection โ OpenCV Haar Cascade (CPU, no GPU)
โ
โผ
[2] 68 Landmark Extraction โ eyes, brows, nose, mouth, jaw
โ
โผ
[3] Head Pose + Expression Analysis
โ
โผ
[4] Temporal Smoothing (windowed averaging)
โ
โผ
[5] Piecewise Affine Warping โ Delaunay triangular mesh deformation
โ
โผ
[6] Video Render โ MP4 at 1080p/720pKey Features
- Pure CPU โ No GPU, no MediaPipe GL dependencies, works everywhere
- 68-point face model โ Industry standard, compatible with Blender/UE
- Delaunay mesh warping โ Piecewise affine transforms for smooth deformation
- Temporal smoothing โ Eliminates jitter, preserves natural timing
- Canonical landmark fallback โ Works with cartoon/drawn avatars (no face detection needed)
- Procedural avatar generation โ Build characters with color pickers if no reference image
Usage
- Upload Input Video โ Front-facing speaker, good lighting (the motion source)
- Upload Avatar Image OR customize procedural avatar with colors/hair/expression
- Click Preview Avatar to see the character
- Adjust Expression Exaggeration (1.2 = slightly more animated than source)
- Click Process Video โ wait 1-2 min per minute of footage
- Download: animated video + motion data JSON + Blender import script
Pipeline Parameters
Limitations
- Lip sync uses video mouth shapes, not audio phonemes. For audio-driven precision, add a dedicated module (e.g., Rhubarb, Wav2Lip).
- No full body โ face/head only. Add DWPose or MediaPipe Holistic for shoulders.
- No audio on HF Spaces (ffmpeg not available). Run locally for audio.
- Haar detection can miss faces in poor lighting or extreme angles. Use front-facing, well-lit footage.
Tech Stack
- Python 3.10+, OpenCV 4.8+, NumPy, Gradio 6
- No deep learning models, no GPU required
- Optional: FFmpeg for audio extraction
Local Development
pip install -r requirements.txt
python app.py