vid2anim 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. vid2anim-0.1.1/LICENSE +21 -0
  2. vid2anim-0.1.1/PKG-INFO +414 -0
  3. vid2anim-0.1.1/README.md +371 -0
  4. vid2anim-0.1.1/pyproject.toml +81 -0
  5. vid2anim-0.1.1/setup.cfg +4 -0
  6. vid2anim-0.1.1/tests/test_blender_addon.py +95 -0
  7. vid2anim-0.1.1/tests/test_cli_commands.py +85 -0
  8. vid2anim-0.1.1/tests/test_edge_cases.py +361 -0
  9. vid2anim-0.1.1/tests/test_gvhmr_and_async.py +92 -0
  10. vid2anim-0.1.1/tests/test_server.py +204 -0
  11. vid2anim-0.1.1/tests/test_universal_rigs.py +599 -0
  12. vid2anim-0.1.1/tests/test_vid2anim.py +200 -0
  13. vid2anim-0.1.1/vid2anim/__init__.py +40 -0
  14. vid2anim-0.1.1/vid2anim/cli.py +242 -0
  15. vid2anim-0.1.1/vid2anim/core/__init__.py +1 -0
  16. vid2anim-0.1.1/vid2anim/core/auto_rig.py +134 -0
  17. vid2anim-0.1.1/vid2anim/core/bvh_writer.py +62 -0
  18. vid2anim-0.1.1/vid2anim/core/calibration.py +88 -0
  19. vid2anim-0.1.1/vid2anim/core/canonical_skeleton.py +400 -0
  20. vid2anim-0.1.1/vid2anim/core/glb_writer.py +270 -0
  21. vid2anim-0.1.1/vid2anim/core/interpolation.py +107 -0
  22. vid2anim-0.1.1/vid2anim/core/kinematics.py +197 -0
  23. vid2anim-0.1.1/vid2anim/core/motion_extractor.py +1354 -0
  24. vid2anim-0.1.1/vid2anim/core/retargeter.py +164 -0
  25. vid2anim-0.1.1/vid2anim/core/rig_detector.py +857 -0
  26. vid2anim-0.1.1/vid2anim/core/scale_normalizer.py +50 -0
  27. vid2anim-0.1.1/vid2anim/core/smoothing.py +195 -0
  28. vid2anim-0.1.1/vid2anim/core/universal_transfer.py +1203 -0
  29. vid2anim-0.1.1/vid2anim/pipeline.py +169 -0
  30. vid2anim-0.1.1/vid2anim/server.py +2662 -0
  31. vid2anim-0.1.1/vid2anim/utils/__init__.py +1 -0
  32. vid2anim-0.1.1/vid2anim/utils/cli_features.py +397 -0
  33. vid2anim-0.1.1/vid2anim/utils/diagnostics.py +88 -0
  34. vid2anim-0.1.1/vid2anim/utils/fixtures.py +334 -0
  35. vid2anim-0.1.1/vid2anim/utils/math_3d.py +140 -0
  36. vid2anim-0.1.1/vid2anim/utils/progress.py +66 -0
  37. vid2anim-0.1.1/vid2anim/utils/stabilize_kp2d.py +97 -0
  38. vid2anim-0.1.1/vid2anim.egg-info/PKG-INFO +414 -0
  39. vid2anim-0.1.1/vid2anim.egg-info/SOURCES.txt +41 -0
  40. vid2anim-0.1.1/vid2anim.egg-info/dependency_links.txt +1 -0
  41. vid2anim-0.1.1/vid2anim.egg-info/entry_points.txt +2 -0
  42. vid2anim-0.1.1/vid2anim.egg-info/requires.txt +19 -0
  43. vid2anim-0.1.1/vid2anim.egg-info/top_level.txt +1 -0
vid2anim-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mehul and vid2anim contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,414 @@
1
+ Metadata-Version: 2.4
2
+ Name: vid2anim
3
+ Version: 0.1.1
4
+ Summary: Animate any 3D character model from video or photos using AI motion capture and universal retargeting.
5
+ Author: vid2anim contributors
6
+ Author-email: Mehul <mehul@users.noreply.github.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/mehulcode12/vid2anim
9
+ Project-URL: Documentation, https://github.com/mehulcode12/vid2anim#readme
10
+ Project-URL: Repository, https://github.com/mehulcode12/vid2anim.git
11
+ Project-URL: Bug Tracker, https://github.com/mehulcode12/vid2anim/issues
12
+ Keywords: motion-capture,retargeting,animation,3d,mixamo,vrm,gltf,glb,blender,computer-vision,deep-learning
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: numpy>=1.22.0
29
+ Requires-Dist: scipy>=1.9.0
30
+ Requires-Dist: opencv-python>=4.7.0
31
+ Requires-Dist: mediapipe>=0.10.0; python_version < "3.13"
32
+ Requires-Dist: tqdm>=4.64.0
33
+ Provides-Extra: gpu
34
+ Requires-Dist: torch>=2.0.0; extra == "gpu"
35
+ Requires-Dist: torchvision>=0.15.0; extra == "gpu"
36
+ Provides-Extra: full
37
+ Requires-Dist: torch>=2.0.0; extra == "full"
38
+ Requires-Dist: torchvision>=0.15.0; extra == "full"
39
+ Requires-Dist: trimesh>=4.0.0; extra == "full"
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
42
+ Dynamic: license-file
43
+
44
+ <div align="center">
45
+
46
+ # vid2anim
47
+
48
+ ### AI Motion Capture & Universal 3D Character Retargeting Studio
49
+
50
+ **Turn any video or photo into production-ready 3D character animations.**
51
+ Works with **Mixamo, VRM / VTubers, Blender Rigify, Unreal Engine Mannequins, Daz3D**, and even **raw unrigged meshes**.
52
+
53
+ [![Python 3.10 - 3.12](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org/)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
+ [![Blender 3.0 - 4.2+ LTS](https://img.shields.io/badge/Blender-3.0%20to%204.2+-E87D0D.svg?style=flat&logo=blender&logoColor=white)](https://www.blender.org/)
56
+ [![Triple AI Engines](https://img.shields.io/badge/Engines-MediaPipe%20%7C%20DWPose%20%7C%20GVHMR%20(SMPL--X)-blue.svg?style=flat)](https://github.com/mehulcode12/vid2anim)
57
+ [![Drive Isolation](https://img.shields.io/badge/Storage-Zero%20C%3A%20Drive%20Writes%20(Project--Isolated)-00C853.svg?style=flat)](https://github.com/mehulcode12/vid2anim)
58
+ [![Output: GLB & BVH](https://img.shields.io/badge/Output-glTF%202.0%20(.glb)%20%7C%20BVH-673AB7.svg?style=flat)](https://github.com/mehulcode12/vid2anim)
59
+ [![Tests: 57 Passing](https://img.shields.io/badge/Tests-57%20passed-brightgreen.svg)](https://github.com/mehulcode12/vid2anim)
60
+ [![CI Test Suite](https://github.com/mehulcode12/vid2anim/actions/workflows/ci.yml/badge.svg)](https://github.com/mehulcode12/vid2anim/actions/workflows/ci.yml)
61
+ [![YouTube Demos](https://img.shields.io/badge/YouTube-Video%20Demos-FF0000.svg?style=flat&logo=youtube&logoColor=white)](https://youtu.be/4eaRWq1vsGs)
62
+
63
+ [Showcase](#-walkthrough--visual-showcase) •
64
+ [Sample Assets](#-included-sample-models--videos) •
65
+ [Key Features](#-why-3d-artists--animators-love-vid2anim) •
66
+ [Triple AI Engines](#-triple-ai-tracking-engine-suite) •
67
+ [Three Ways to Use](#-three-ways-to-use-vid2anim) •
68
+ [Supported 3D Rigs](#-supported-character-rigs--formats) •
69
+ [2-Minute Quickstart](#-2-minute-quickstart) •
70
+ [Blender Add-on Guide](#-blender-3d-bridge-add-on) •
71
+ [Animator Tips](#-animator--capture-best-practices)
72
+
73
+ </div>
74
+
75
+ ---
76
+
77
+ ## 🎬 Walkthrough & Visual Showcase
78
+
79
+ <div align="center">
80
+
81
+ ### 1. Synchronized Multi-Character Studio Demo
82
+ *Reference video driving dual independent character armatures in lockstep with 5-digit finger articulation, metric root trajectory, and stance-foot ground contact.*
83
+
84
+ <p align="center">
85
+ <a href="https://youtu.be/Y3eJLQgHwsc" target="_blank">
86
+ <img src="docs/media/comparison_preview.gif" alt="vid2anim Synchronized Multi-Character Studio Demo" width="95%" />
87
+ </a>
88
+ </p>
89
+
90
+ <p align="center">
91
+ <a href="https://youtu.be/Y3eJLQgHwsc" target="_blank">
92
+ <img src="https://img.shields.io/badge/%E2%96%B6%EF%B8%8F_Watch_on_YouTube-Comparison_Demo_(1080p)-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch on YouTube" />
93
+ </a>
94
+ &nbsp;
95
+ <a href="samples/">
96
+ <img src="https://img.shields.io/badge/%F0%9F%93%A6_Explore_Sample_Assets-models_%26_clips-673AB7?style=for-the-badge&logo=github&logoColor=white" alt="Sample Assets" />
97
+ </a>
98
+ </p>
99
+
100
+ <br/>
101
+
102
+ ### 2. Full Web Studio & Pipeline Walkthrough
103
+ *End-to-end browser workflow: real-time milestone progress bar, live event logging, skeleton helper overlays, frame scrubbing, and one-click GLB download.*
104
+
105
+ <p align="center">
106
+ <a href="https://youtu.be/4eaRWq1vsGs" target="_blank">
107
+ <img src="docs/media/walkthrough_preview.gif" alt="vid2anim Studio Walkthrough" width="95%" />
108
+ </a>
109
+ </p>
110
+
111
+ <p align="center">
112
+ <a href="https://youtu.be/4eaRWq1vsGs" target="_blank">
113
+ <img src="https://img.shields.io/badge/%E2%96%B6%EF%B8%8F_Watch_on_YouTube-Studio_Walkthrough_(1080p)-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch on YouTube" />
114
+ </a>
115
+ &nbsp;
116
+ <a href="samples/README.md">
117
+ <img src="https://img.shields.io/badge/%E2%9A%A1_Sample_Quickstart-samples%2FREADME.md-E87D0D?style=for-the-badge&logo=markdown&logoColor=white" alt="Quickstart Guide" />
118
+ </a>
119
+ </p>
120
+
121
+ <br/>
122
+
123
+ | 🎬 **Studio Walkthrough** | ⚡ **Trio Comparison Demo** | 📦 **Sample Assets** |
124
+ |:---:|:---:|:---:|
125
+ | [▶ **Watch on YouTube (60s)**](https://youtu.be/4eaRWq1vsGs)<br/><sub>Complete Studio UI, progress tracking & download</sub> | [▶ **Watch on YouTube (27s)**](https://youtu.be/Y3eJLQgHwsc)<br/><sub>Synchronized reference video with dual GLB characters</sub> | [📁 **Explore Sample Assets**](samples/)<br/><sub>Pre-rigged models (`ybot.glb`, `eve.glb`) & sample videos</sub> |
126
+
127
+ </div>
128
+
129
+ ---
130
+
131
+ ## ⚡ Why 3D Artists & Animators Love vid2anim
132
+
133
+ Most AI mocap tools force you into proprietary cloud subscriptions, require expensive multi-thousand-dollar GPUs, or spit out locked skeletons that don't match your character's armature.
134
+
135
+ `vid2anim` is an **open-source, artist-friendly 3D workstation tool** designed to fit right into your existing Blender, Unreal, Unity, or VTuber pipeline:
136
+
137
+ * **🚀 Triple-Engine Tracking Suite:** Choose the right engine for your hardware and quality needs — from ultra-fast 100% CPU MediaPipe tracking (60+ FPS) to studio-grade parametric 3D Human Mesh Recovery (**GVHMR + SMPL-X**).
138
+ * **🔒 Strict Project Directory Isolation:** Never pollutes or fills your system `C:` drive. All model weights, PyTorch caches, HuggingFace downloads, and temp files are strictly isolated inside `./weights`, `./assets`, and `./inputs`.
139
+ * **⚡ Asynchronous Frame Prefetching (`AsyncVideoReader`):** Multithreaded background decoding overlaps video I/O with model inference, eliminating CPU decode stalls and boosting pipeline throughput by ~30%.
140
+ * **🚶 Real World Root Motion & Foot Grounding:** Characters actually walk, sprint, and jump across 3D space with metric world translation ($X, Z$) and stance-foot ground contact ($Y$), eliminating root freeze and foot sliding.
141
+ * **🔌 Native Blender 3D Add-on:** Retarget reference video directly onto your character armature inside Blender with a single click. Bakes standard keyframes straight to the Blender Timeline & Action Editor.
142
+ * **🌐 Interactive Web Studio:** Drag-and-drop your video and 3D character (`.glb`, `.fbx`, `.obj`). Preview synchronized side-by-side motion in real time with an interactive Three.js 3D orbit viewport before exporting.
143
+ * **🖐️ 5-Digit Anatomical Finger Articulation:** Captures independent Thumb, Index, Middle, Ring, and Pinky flexion. No rigid "mitten hands" or static fists.
144
+ * **🎯 Universal Rig Auto-Detection:** Automatically matches bones for **Mixamo, VRM (Ready Player Me / VTubers), Blender Rigify, Unreal Engine Mannequins (UE4/UE5), and Daz3D / Character Creator**.
145
+ * **🦴 Auto-Rigging for Static Meshes:** Have an unrigged 3D statue or creature mesh? The built-in auto-rigger automatically fits a humanoid skeleton and computes smooth skinning weights.
146
+ * **📦 Universal glTF 2.0 & BVH Export:** Exports clean, strictly compliant `.glb` files ready for Blender, Unreal Engine, Unity, Three.js, Godot, and Web, plus standard `.bvh` files for Maya, Cinema 4D, and 3ds Max.
147
+
148
+ ---
149
+
150
+ ## 🧠 Triple AI Tracking Engine Suite
151
+
152
+ `vid2anim` provides three specialized AI tracking engines, selectable via CLI (`--engine`), the Web UI, or the Blender Add-on:
153
+
154
+ | Engine | Ideal Use Case | Speed / FPS | Hardware | Download Size | Key Capabilities |
155
+ |:---|:---|:---:|:---:|:---:|:---|
156
+ | **MediaPipe Pose**<br>`--engine mediapipe` | Instant setup, standard laptops, mobile clips | **60–100+ FPS** | **100% CPU Ready** | ~28 MB (Lightweight) | Real-time tracking, 2D-to-3D screen unprojected root motion, zero heavy downloads. |
157
+ | **DWPose WholeBody**<br>`--engine dwpose` | Expressive gestures, dance, sign language | **25–45 FPS** | CPU or CUDA | ~150 MB (ONNX) | 133 WholeBody keypoints with 21-point anatomical finger curl and face tracking. |
158
+ | **GVHMR Studio (3D HMR)**<br>`--engine gvhmr` | Studio cinemactics, full-body turns, actor travel | **Deep Recovery** | CPU or CUDA | ~5.3 GB (Full SOTA) | Parametric SMPL-X human mesh recovery in gravity-view world coordinates, true metric root trajectory. |
159
+
160
+ ---
161
+
162
+ ## 🎬 Three Ways to Use vid2anim
163
+
164
+ Choose the workflow that fits your creative setup:
165
+
166
+ ### 1. In Blender (1-Click Viewport Add-on)
167
+ > **Best for:** 3D Animators, Riggers, and Character Artists.
168
+
169
+ No need to leave Blender! Install the included add-on (`plugins/blender/vid2anim_blender.py`):
170
+ 1. Press <kbd>N</kbd> in the 3D Viewport to open the sidebar tab **`vid2anim`**.
171
+ 2. Select your character's armature in the scene.
172
+ 3. Choose your reference video or photo and select your preferred engine (**MediaPipe**, **DWPose**, or **GVHMR Studio**).
173
+ 4. Click **"Animate Selected Armature"**.
174
+ 5. Keyframes are baked directly into a native Blender **Action**, ready for tweaking in the Graph Editor or NLA Stacks.
175
+
176
+ ---
177
+
178
+ ### 2. In Your Browser (Web Studio & Real-Time 3D Player)
179
+ > **Best for:** Quick previews, game devs, VTubers, and visual inspection.
180
+
181
+ Launch the local studio with one command:
182
+ ```bash
183
+ vid2anim serve --port 8080
184
+ ```
185
+ Open **`http://localhost:8080`** to access:
186
+ * **Drag-and-Drop Station:** Drop your reference `.mp4` / `.jpg` on the left, and your `.glb` / `.fbx` character on the right.
187
+ * **Tracking Engine Selector:** Toggle between MediaPipe, DWPose, or GVHMR Studio with 1 click.
188
+ * **Synchronized Side-by-Side Playback:** Scrub video and 3D motion together with sub-frame timecode display and frame-stepping buttons (<kbd>◀</kbd> / <kbd>▶</kbd>).
189
+ * **Interactive 3D Orbit Viewport:** Rotate, pan, zoom, inspect skeleton bones, toggle wireframe, and check ground alignment.
190
+ * **1-Click Download:** Download the animated `.glb` or export universal `.bvh` motion files instantly.
191
+
192
+ ---
193
+
194
+ ### 3. Command Line & Automation (Pipeline TDs & Batch Work)
195
+ > **Best for:** Technical Directors, game studios, and processing entire motion libraries.
196
+
197
+ ```bash
198
+ # 1. Animate sample humanoid with ultra-fast CPU MediaPipe tracking (works out-of-the-box):
199
+ vid2anim run --input samples/videos/dance_urban.mp4 --model samples/models/ybot.glb --engine mediapipe --output outputs/ybot_dance.glb
200
+
201
+ # 2. Animate with high-detail 5-digit finger articulation on Eve:
202
+ vid2anim run --input samples/videos/dance_street.mp4 --model samples/models/eve.glb --engine dwpose --output outputs/eve_dance.glb
203
+
204
+ # 3. Extract motion once to reusable cache, then retarget onto multiple characters:
205
+ vid2anim extract --input samples/videos/dance_urban.mp4 --engine mediapipe --output outputs/motion_urban.npz
206
+ vid2anim retarget --motion outputs/motion_urban.npz --model samples/models/ybot.glb --output outputs/ybot_anim.glb
207
+ vid2anim retarget --motion outputs/motion_urban.npz --model samples/models/eve.glb --output outputs/eve_anim.glb
208
+
209
+ # 4. Batch animate entire directory of videos across multiple 3D characters:
210
+ vid2anim batch --input-dir ./my_videos --model-dir ./my_characters --output-dir ./outputs/batch --engine mediapipe
211
+
212
+ # 5. Export or auto-install Blender Bridge 3D Add-on:
213
+ vid2anim addon --export # Packages outputs/vid2anim_blender.zip
214
+ vid2anim addon --install # Auto-detects local Blender 3.0 - 4.2+ LTS & installs directly
215
+
216
+ # 6. Benchmark hardware throughput & retargeting FPS:
217
+ vid2anim benchmark --frames 60
218
+
219
+ # 7. Check environment, active tracking engines & isolated storage:
220
+ vid2anim info
221
+ vid2anim samples list # Inspect bundled characters and dance videos
222
+ ```
223
+
224
+ ---
225
+
226
+ ## 🦾 Supported Character Rigs & Formats
227
+
228
+ `vid2anim` comes pre-configured with bone mapping dictionaries and topological solvers for the world's most popular 3D character ecosystems:
229
+
230
+ | Character Rig / Ecosystem | Common Bone Prefixes | Finger Tracking | Default Rest Pose | Target Tools & Engines |
231
+ |:---|:---|:---:|:---:|:---|
232
+ | **Mixamo** | `mixamorig:Hips`, `mixamorig:LeftArm` | All 5 Digits | T-Pose | Blender, Unity, Unreal, Web |
233
+ | **VRM / VTuber** | `J_Bip_C_Hips`, `hips`, `leftUpperArm` | All 5 Digits | T-Pose / A-Pose | VRChat, VTubing, Unity, Three.js |
234
+ | **Ready Player Me** | `Armature/Hips`, `LeftHandIndex1` | All 5 Digits | T-Pose | Web3D, Unity, Unreal, Godot |
235
+ | **Blender Rigify** | `DEF-spine`, `DEF-upper_arm.L` | All 5 Digits | T-Pose / A-Pose | Blender Film & VFX Pipeline |
236
+ | **Unreal Engine Mannequin** | `pelvis`, `upperarm_l`, `hand_l` | All 5 Digits | A-Pose (30° / 45°) | Unreal Engine 4 & 5 Blueprints |
237
+ | **Daz3D / Character Creator** | `hip`, `lShldr`, `lForeArm` | All 5 Digits | T-Pose | Cinematics, Metahumans |
238
+ | **Static Meshes (Auto-Rig)** | *Raw unrigged mesh* | Procedural | Auto-Fitted | Any `.glb`, `.gltf`, or `.obj` |
239
+
240
+ > **Tip:** Not sure how your model is rigged? Run `vid2anim inspect your_model.glb` to get an instant terminal breakdown of all bones, detected rig profile, and joint bindings.
241
+
242
+ ---
243
+
244
+ ## 🎨 What Makes It Built for 3D Artists?
245
+
246
+ ### 🖐️ Natural 5-Digit Hand Tracking
247
+ Most AI motion systems leave hands frozen or lock fingers into rigid blocks. `vid2anim` models natural human hand anatomy with independent flexion and curling cascades for:
248
+ * **Thumb:** CMC, MCP, and IP articulation.
249
+ * **Fingers:** Proximal, Intermediate, and Distal joints for Index, Middle, Ring, and Pinky.
250
+ * **Auto-Curling:** Captures expressive gestures, pointing, open palms, and clenched fists.
251
+
252
+ ### 🧘 Zero Gimbal Lock & No 360° "Bone Pop" Flips
253
+ By using closed-form Lie algebra basis transformations ($C D C^T$) and continuous quaternion shortest-arc SLERP, joints never flip 180°/360° or suffer from Euler angle gimbal lock when limbs cross axes.
254
+
255
+ ### 🌊 Adaptive Anti-Jitter Filtering
256
+ Raw computer vision mocap is notoriously noisy. `vid2anim` applies temporal smoothing with velocity spike clamping:
257
+ * Eliminates micro-shiver and jitter on stationary joints.
258
+ * Preserves sharp, high-velocity movements (punches, kicks, fast dance steps).
259
+
260
+ ### 🦶 Root Grounding & Stance Foot Anchoring
261
+ Calculates true hip trajectory relative to ground contact, preventing characters from floating in mid-air or sinking into the floor during squats, walking, and running.
262
+
263
+ ---
264
+
265
+ ## 🚀 2-Minute Quickstart
266
+
267
+ ### 1. Installation
268
+
269
+ Requires **Python 3.10, 3.11, or 3.12**:
270
+
271
+ ```bash
272
+ # Clone the repository
273
+ git clone https://github.com/mehulcode12/vid2anim.git
274
+ cd vid2anim
275
+
276
+ # Create & activate a virtual environment
277
+ python -m venv .venv
278
+ # On Windows: .venv\Scripts\Activate.ps1
279
+ # On Linux/macOS: source .venv/bin/activate
280
+
281
+ # Install vid2anim
282
+ pip install -e .
283
+ ```
284
+
285
+ ### 2. Verify Your System
286
+ ```bash
287
+ vid2anim doctor
288
+ ```
289
+ Checks your CPU cores, compute device, and AI tracking engines.
290
+
291
+ ### 3. Launch the Web Studio
292
+ ```bash
293
+ vid2anim serve --port 8080
294
+ ```
295
+ Open **[http://localhost:8080](http://localhost:8080)** in your browser and start animating!
296
+
297
+ ### 4. Animate Sample Character in 30 Seconds
298
+ ```bash
299
+ vid2anim run \
300
+ --input samples/videos/dance_urban.mp4 \
301
+ --model samples/models/ybot.glb \
302
+ --engine mediapipe \
303
+ --output outputs/my_first_dance.glb
304
+ ```
305
+
306
+ ---
307
+
308
+ ## 📦 Included Sample Models & Videos
309
+
310
+ To get started immediately without hunting for 3D assets or reference footage, `vid2anim` comes bundled with official sample assets in [`samples/`](samples/):
311
+
312
+ | Asset Type | File Path | Rig Type / Motion Style | Specs | Size | Best For |
313
+ |:---|:---|:---|:---|:---:|:---|
314
+ | **Humanoid Robot** | [`samples/models/ybot.glb`](samples/models/ybot.glb) | Adobe Mixamo Humanoid | 52 Bones, T-Pose | 2.2 MB | Fast CPU tracking, quick testing |
315
+ | **Stylized Character** | [`samples/models/eve.glb`](samples/models/eve.glb) | Adobe Mixamo Humanoid | 65 Bones, 5-Digit Hand Rigging | 18.3 MB | Expressive finger gestures & textured renders |
316
+ | **Urban Dance** | [`samples/videos/dance_urban.mp4`](samples/videos/dance_urban.mp4) | Dynamic urban rhythm | 1080×1920, 25 FPS, 11.2s | 6.8 MB | Sharp arm movements & foot grounding |
317
+ | **Street Freestyle** | [`samples/videos/dance_street.mp4`](samples/videos/dance_street.mp4) | Street dance choreography | 1080×1920, 25 FPS, 15.2s | 10.3 MB | Torso travel, leg steps & hand gestures |
318
+
319
+ > See [`samples/README.md`](samples/README.md) for full rig specs, bone hierarchy tables, and batch scripts.
320
+
321
+ ---
322
+
323
+ ## 🧩 Blender 3D Bridge Add-on
324
+
325
+ `vid2anim` includes a dedicated bridge add-on for **Blender 3.0, 3.6 LTS, 4.0, 4.1, and 4.2+ LTS**.
326
+
327
+ ### How to Install:
328
+ 1. Start the local server: `vid2anim serve --port 8080`
329
+ 2. Open Blender &rarr; **Edit &rarr; Preferences &rarr; Add-ons**.
330
+ 3. Click **Install...** (or the arrow dropdown in 4.2) and select:
331
+ ```
332
+ plugins/blender/vid2anim_blender.py
333
+ ```
334
+ *(Or click "Download Blender Add-on" from the Web Studio header).*
335
+ 4. Enable the checkbox for **Animation: vid2anim Blender Bridge**.
336
+
337
+ ### How to Use:
338
+ 1. In the 3D Viewport, press <kbd>N</kbd> to toggle the sidebar, and click the **`vid2anim`** tab.
339
+ 2. Select your character's armature.
340
+ 3. Browse for your reference video or photo and choose your engine.
341
+ 4. Click **"Animate Selected Armature"**.
342
+ 5. Done! The animation is now a native Blender Action.
343
+
344
+ ---
345
+
346
+ ## 💡 Animator & Capture Best Practices
347
+
348
+ For the cleanest, production-ready mocap results:
349
+
350
+ | Factor | Recommended | Avoid |
351
+ |:---|:---|:---|
352
+ | **Framing** | Full body visible (head to toes in frame) | Cut-off feet or cropped hands |
353
+ | **Camera** | Static camera at chest height | Shaky handheld, extreme bird's-eye / worm's-eye |
354
+ | **Lighting** | Clear contrast between actor and background | Strong silhouettes or dark environments |
355
+ | **Clothing** | Form-fitting or casual everyday clothes | Baggy dresses, long cloaks, heavy trench coats |
356
+ | **Model Rest Pose** | Clean T-Pose or 45° A-Pose | Custom distorted bind poses |
357
+
358
+ ---
359
+
360
+ ## 💻 CLI Reference Cheat Sheet
361
+
362
+ | Command | Usage | Description |
363
+ |:---|:---|:---|
364
+ | `vid2anim serve` | `vid2anim serve --port 8080` | Launch local Web Studio & interactive Three.js 3D player |
365
+ | `vid2anim run` | `vid2anim run -i clip.mp4 -m rig.glb --engine gvhmr -o out.glb` | Full end-to-end video-to-character animation pipeline |
366
+ | `vid2anim batch` | `vid2anim batch -i clips/ -m characters/ -o outputs/batch` | Batch process multiple videos and 3D character models |
367
+ | `vid2anim addon` | `vid2anim addon --export` / `vid2anim addon --install` | Package or auto-install Blender Bridge 3D Add-on |
368
+ | `vid2anim extract` | `vid2anim extract -i clip.mp4 --engine dwpose -o motion.npz` | Extract 3D skeletal motion to reusable cached `.npz` |
369
+ | `vid2anim retarget` | `vid2anim retarget -m motion.npz --model rig.glb -o out.glb` | Retarget cached motion onto any 3D model |
370
+ | `vid2anim benchmark` | `vid2anim benchmark --frames 60` | Test hardware throughput, universal retargeter & pose FPS |
371
+ | `vid2anim samples` | `vid2anim samples list` / `vid2anim samples run` | Inspect, demo test, or copy bundled characters & dance clips |
372
+ | `vid2anim inspect` | `vid2anim inspect character.glb` | Inspect bones, rig type (Mixamo/VRM/UE), and rest pose |
373
+ | `vid2anim doctor` | `vid2anim doctor` | Run hardware diagnostics (CPU, CUDA GPU, FFmpeg, engines) |
374
+ | `vid2anim info` | `vid2anim info` | Quick overview of version, active engines & isolated paths |
375
+
376
+ ---
377
+
378
+ ## 🛠️ Python Developer API
379
+
380
+ Integrate retargeting into your custom Python DCC pipelines:
381
+
382
+ ```python
383
+ from pathlib import Path
384
+ from vid2anim import PipelineConfig, Vid2AnimPipeline
385
+
386
+ config = PipelineConfig(
387
+ input_media=Path("mocap_reference.mp4"),
388
+ target_model=Path("game_character.glb"),
389
+ output_glb=Path("output/game_character_animated.glb"),
390
+ engine="gvhmr", # "mediapipe", "dwpose", or "gvhmr"
391
+ smooth=True, # Anti-jitter filter
392
+ max_duration_sec=60.0,
393
+ )
394
+
395
+ pipeline = Vid2AnimPipeline(config)
396
+ result = pipeline.execute()
397
+
398
+ if result.success:
399
+ print(f"Animation saved: {result.output_glb} ({result.frame_count} frames)")
400
+ ```
401
+
402
+ ---
403
+
404
+ ## 🤝 Contributing
405
+
406
+ We welcome contributions from animators, technical directors, and developers!
407
+ * Found a character rig that doesn't map cleanly? Open an issue with your bone hierarchy!
408
+ * Have ideas for Blender add-on UI improvements? Pull requests are warmly welcomed.
409
+
410
+ ---
411
+
412
+ ## 📄 License
413
+
414
+ This project is licensed under the **MIT License** — free for commercial, indie, and personal use.