# freddysae0/video2mocap architecture

> Architecture diagram of the GitHub repository freddysae0/video2mocap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/freddysae0/video2mocap
- Repository: https://github.com/freddysae0/video2mocap

## Overview

video2mocap turns video into multi-person skeletal animation, then supports cleanup, review/editing, facial animation, viewing and engine export. A separate scan workflow reconstructs textured meshes from photos or video. The README documents the end-to-end behavior; source excerpts and the SOURCE INDEX establish selected implementation relationships. Some subsystem internals were not sampled, so undocumented connections are omitted.

Main entry points: [`src/video2mocap/cli.py`](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/cli.py) (CLI commands), [`src/video2mocap/run.py`](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/run.py) (Run orchestration), [`src/video2mocap/pipeline.py`](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/pipeline.py) (Motion cleanup), [`src/video2mocap/scan/pipeline.py`](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/scan/pipeline.py) (Photogrammetry pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and estimation"]
  node_tracking["Person tracking<br/>[tracking.py]"]
  node_gemx["GEM-X estimator adapter<br/>[gemx.py]"]
  node_rawmotion["Raw track motion<br/>[motion.py]"]
  node_run["Run orchestration<br/>[run.py]"]
end

subgraph group_motion["Motion processing"]
  node_postprocess["Motion cleanup<br/>[pipeline.py]"]
  node_smoothing["Smoothing filters<br/>[filters.py]"]
  node_contacts["Contact detection<br/>[contacts.py]"]
  node_footlock["Grounding and foot lock<br/>[footlock.py]"]
  node_ik["Leg IK<br/>[ik.py]"]
  node_metrics["Motion metrics<br/>[metrics.py]"]
end

subgraph group_review["Review and editing"]
  node_review_sheet["Review sheets<br/>[review.py]"]
  node_review_inputs["Review inputs<br/>[review_io.py]"]
  node_edit["Declarative motion edits<br/>[edit.py]"]
  node_viewer["Web viewer and editor<br/>[export.py]"]
end

subgraph group_delivery["Face and delivery"]
  node_face_capture["Face capture<br/>[capture.py]"]
  node_face_sync["Face synchronization and attach<br/>[sync.py]"]
  node_face_attach["Face attachment<br/>[attach.py]"]
  node_bvh["BVH I/O<br/>[bvh.py]"]
  node_blender["Blender FBX export<br/>[blender.py]"]
end

subgraph group_scan["Scene reconstruction"]
  node_scan_pipeline["Photogrammetry pipeline<br/>[pipeline.py]"]
  node_scan_clean["Image cleaning<br/>[clean.py]"]
  node_colmap["COLMAP"]
  node_openmvs["OpenMVS"]
  node_mesh["Textured mesh and report"]
end

node_operator(("Video creator"))
node_cli["CLI commands<br/>[cli.py]"]
node_unreal(("Blender and Unreal users"))

node_operator -->|"runs commands"| node_cli
node_cli -->|"starts run"| node_run
node_run -->|"tracks people"| node_tracking
node_run -->|"runs estimator"| node_gemx
node_tracking -->|"provides tracks"| node_gemx
node_gemx -->|"loads motion"| node_rawmotion
node_run -->|"postprocesses motion"| node_postprocess
node_postprocess -->|"smooths motion"| node_smoothing
node_postprocess -->|"detects contacts"| node_contacts
node_postprocess -->|"grounds and locks"| node_footlock
node_footlock -->|"solves leg IK"| node_ik
node_postprocess -->|"reports metrics"| node_metrics
node_run -->|"renders review"| node_review_sheet
node_review_sheet -->|"uses track inputs"| node_review_inputs
node_operator -->|"writes edits"| node_edit
node_cli -->|"applies edits"| node_edit
node_viewer -->|"applies saved edits"| node_edit
node_cli -->|"serves viewer"| node_viewer
node_cli -->|"captures face"| node_face_capture
node_face_capture -->|"synchronizes take"| node_face_sync
node_cli -->|"attaches expressions"| node_face_attach
node_face_attach -->|"loads face take"| node_face_capture
node_cli -->|"exports BVH"| node_bvh
node_cli -->|"exports FBX"| node_blender
node_bvh -->|"imports BVH"| node_blender
node_blender -->|"exports for engine"| node_unreal
node_operator -->|"starts reconstruction"| node_scan_pipeline
node_scan_pipeline -->|"cleans images"| node_scan_clean
node_scan_pipeline -->|"runs SfM"| node_colmap
node_scan_pipeline -->|"builds dense mesh"| node_openmvs
node_openmvs -->|"produces textured mesh"| node_mesh
node_colmap -.->|"passes reconstruction"| node_openmvs

click node_cli "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/cli.py"
click node_tracking "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/tracking.py"
click node_gemx "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/backends/gemx.py"
click node_rawmotion "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/motion.py"
click node_run "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/run.py"
click node_postprocess "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/pipeline.py"
click node_smoothing "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/filters.py"
click node_contacts "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/contacts.py"
click node_footlock "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/footlock.py"
click node_ik "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/ik.py"
click node_metrics "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/qa/metrics.py"
click node_review_sheet "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/qa/review.py"
click node_review_inputs "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/review_io.py"
click node_edit "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/edit.py"
click node_viewer "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/viewer/export.py"
click node_face_capture "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/capture.py"
click node_face_sync "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/sync.py"
click node_face_attach "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/attach.py"
click node_bvh "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/io/bvh.py"
click node_blender "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/blender.py"
click node_scan_pipeline "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/scan/pipeline.py"
click node_scan_clean "https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/scan/clean.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tracking,node_gemx,node_rawmotion,node_run,node_unreal toneBlue
class node_postprocess,node_smoothing,node_contacts,node_footlock,node_ik,node_metrics toneAmber
class node_review_sheet,node_review_inputs,node_edit,node_viewer toneMint
class node_face_capture,node_face_sync,node_face_attach,node_bvh,node_blender toneRose
class node_scan_pipeline,node_scan_clean,node_colmap,node_openmvs,node_mesh,node_operator toneIndigo
class node_cli toneTeal
```

## Components

### Capture and estimation

- [Person tracking](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/tracking.py): `src/video2mocap/tracking.py`
- [GEM-X estimator adapter](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/backends/gemx.py): `src/video2mocap/backends/gemx.py`
- [Raw track motion](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/motion.py): `src/video2mocap/motion.py`
- [Run orchestration](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/run.py): `src/video2mocap/run.py`

### Motion processing

- [Motion cleanup](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/pipeline.py): `src/video2mocap/pipeline.py`
- [Smoothing filters](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/filters.py): `src/video2mocap/process/filters.py`
- [Contact detection](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/contacts.py): `src/video2mocap/process/contacts.py`
- [Grounding and foot lock](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/footlock.py): `src/video2mocap/process/footlock.py`
- [Leg IK](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/ik.py): `src/video2mocap/process/ik.py`
- [Motion metrics](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/qa/metrics.py): `src/video2mocap/qa/metrics.py`

### Review and editing

- [Review sheets](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/qa/review.py): `src/video2mocap/qa/review.py`
- [Review inputs](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/review_io.py): `src/video2mocap/review_io.py`
- [Declarative motion edits](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/process/edit.py): `src/video2mocap/process/edit.py`
- [Web viewer and editor](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/viewer/export.py): `src/video2mocap/viewer/export.py`

### Face and delivery

- [Face capture](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/capture.py): `src/video2mocap/face/capture.py`
- [Face synchronization and attach](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/sync.py): `src/video2mocap/face/sync.py`
- [Face attachment](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/face/attach.py): `src/video2mocap/face/attach.py`
- [BVH I/O](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/io/bvh.py): `src/video2mocap/io/bvh.py`
- [Blender FBX export](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/blender.py): `src/video2mocap/blender.py`

### Scene reconstruction

- [Photogrammetry pipeline](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/scan/pipeline.py): `src/video2mocap/scan/pipeline.py`
- [Image cleaning](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/scan/clean.py): `src/video2mocap/scan/clean.py`
- **COLMAP**
- **OpenMVS**
- **Textured mesh and report**

### Other components

- **Video creator**
- [CLI commands](https://github.com/freddysae0/video2mocap/blob/main/src/video2mocap/cli.py): `src/video2mocap/cli.py`
- **Blender and Unreal users**

## Connections

- Video creator → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Run orchestration: starts run (evidence: `src/video2mocap/cli.py`)
- Run orchestration → Person tracking: tracks people (evidence: `README.md`)
- Run orchestration → GEM-X estimator adapter: runs estimator (evidence: `src/video2mocap/run.py`)
- Person tracking → GEM-X estimator adapter: provides tracks (evidence: `README.md`)
- GEM-X estimator adapter → Raw track motion: loads motion (evidence: `src/video2mocap/backends/gemx.py`)
- Run orchestration → Motion cleanup: postprocesses motion (evidence: `src/video2mocap/run.py`)
- Motion cleanup → Smoothing filters: smooths motion (evidence: `src/video2mocap/pipeline.py`)
- Motion cleanup → Contact detection: detects contacts (evidence: `src/video2mocap/pipeline.py`)
- Motion cleanup → Grounding and foot lock: grounds and locks (evidence: `src/video2mocap/pipeline.py`)
- Grounding and foot lock → Leg IK: solves leg IK (evidence: `src/video2mocap/process/footlock.py`)
- Motion cleanup → Motion metrics: reports metrics (evidence: `src/video2mocap/pipeline.py`)
- Run orchestration → Review sheets: renders review (evidence: `src/video2mocap/run.py`)
- Review sheets → Review inputs: uses track inputs (evidence: `src/video2mocap/review_io.py`)
- Video creator → Declarative motion edits: writes edits (evidence: `README.md`)
- CLI commands → Declarative motion edits: applies edits (evidence: `src/video2mocap/cli.py`)
- Web viewer and editor → Declarative motion edits: applies saved edits (evidence: `src/video2mocap/viewer/export.py`)
- CLI commands → Web viewer and editor: serves viewer (evidence: `src/video2mocap/cli.py`)
- CLI commands → Face capture: captures face (evidence: `src/video2mocap/cli.py`)
- Face capture → Face synchronization and attach: synchronizes take
- CLI commands → Face attachment: attaches expressions (evidence: `src/video2mocap/cli.py`)
- Face attachment → Face capture: loads face take (evidence: `src/video2mocap/face/attach.py`)
- CLI commands → BVH I/O: exports BVH (evidence: `src/video2mocap/cli.py`)
- CLI commands → Blender FBX export: exports FBX (evidence: `src/video2mocap/cli.py`)
- BVH I/O → Blender FBX export: imports BVH (evidence: `README.md`)
- Blender FBX export → Blender and Unreal users: exports for engine (evidence: `README.md`)
- Video creator → Photogrammetry pipeline: starts reconstruction (evidence: `README.md`)
- Photogrammetry pipeline → Image cleaning: cleans images (evidence: `src/video2mocap/scan/pipeline.py`)
- Photogrammetry pipeline → COLMAP: runs SfM (evidence: `src/video2mocap/scan/pipeline.py`)
- Photogrammetry pipeline → OpenMVS: builds dense mesh (evidence: `src/video2mocap/scan/pipeline.py`)
- OpenMVS → Textured mesh and report: produces textured mesh
- COLMAP → OpenMVS: passes reconstruction
