# Repository Briefing: sirioberati/Genjustsu-Open-Source-Workflow
> Source: https://repoforai.com/repo/sirioberati/Genjustsu-Open-Source-Workflow (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/sirioberati/Genjustsu-Open-Source-Workflow
- **Official Docs / Website**: https://tein.ai
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: B+ (73/100 · Maintenance 26/35 · Adoption 21/25 · Releases 6/20 · License 20/20)
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Self-Hosted, API
- **Momentum**: 1,726 ★ total (+3 24h / +36 7d) · 401 forks
- **When to Use**: Best for: Solo creators and prototyping teams replacing video subjects with media they are authorized to upload, who want full-clip review, a draft checkpoint and the original soundtrack in the export. Skip if: You need offline inference, cannot expose media through public URLs, require validated tracking for complex multi-person scenes, or need a production-ready multi-user service.

## Overview
```text
### Architecture & Core Mechanics
Genjustsu is a local, single-user Python application that orchestrates remote video inference rather than serving the generation models itself. FastAPI and Uvicorn serve an HTML/CSS/vanilla JavaScript UI; `workflow.py` provides CLI operations for preparation, status and recovery. PyAV, NumPy, Pillow, OpenCV and SciPy support local media processing. The hosted path uses Replicate for Demucs vocal isolation, colored depth and SAM 3 segmentation, and Enhancor for Seedance generation.

The key boundary is between preparation and paid submission: approval is tied to the hashes of the reviewed artifacts, so it applies to a specific set of inputs rather than to the job in general. An optional MediaPipe Face Landmarker runs in a separate Python 3.12 worker environment. Job state is persisted locally; polling determines completion even when the required provider callback is delayed. The agent runbook and skill can guide a user-supplied coding agent through visual QA and CLI operations, but no agent service is bundled.

### Key Capabilities & Differentiators
The advanced path normalizes working video to 24 fps and up to 960 pixels, preserves the returned depth colors, and uses SAM 3 per-frame PNG masks to composite the depth-rendered subject over the original background. The mask must be inspected across the full clip for alignment, coverage and spill. Fast face mesh skips depth and SAM entirely; combined mode tracks the original frames and overlays facial geometry onto the depth composite. The mesh modes are experimental and tuned for a single centered speaker.

All modes isolate vocals with Demucs and use Rubber Band to pitch them up three semitones without changing duration. Seedance receives the prepared MP4 with the processed vocals embedded, not a separate audio file. Still-image references use Edit, while video identity references use Omni (`multi_reference`). Draft and 1080p outputs remain separate, with explicit approval required for the HD step. Final outputs discard generated audio and restore the entire source soundtrack.

### Trade-offs & Limitations
Compared with integrating Seedance directly, Genjustsu adds reusable preprocessing, review of intermediate artifacts, a separate HD approval step and consistent source-audio restoration. That is useful when those stages would otherwise be manual, but it brings more setup and more failure points across providers. Compared with an offline editing pipeline, the hosted design removes the need for local generation hardware but introduces paid API calls, network dependencies and third-party handling of media.

Localhost is the app boundary, not the media privacy boundary: Tmpfiles and Catbox both expose media through public URLs, and the configured Catbox fallback is persistent. Recovery resumes collection for saved jobs rather than resubmitting paid requests; ambiguous timeouts require checking provider state before retrying. Keep one collector per job, and add authentication and a durable worker queue before considering public hosting. MIT covers the code and documentation, not the examples, TEIN artwork or third-party services.

### Hardware & Deployment Guide
Install Python 3.12+, the Rubber Band CLI and, unless you already have a public HTTPS webhook receiver, `cloudflared`. `bash setup.sh` creates `.venv` and prepares `.env`; hosted processing requires funded or enabled accounts with `ENHANCOR_API_KEY` and `REPLICATE_API_TOKEN`. The optional Hugging Face depth route can use `HF_TOKEN`. For mesh modes, `bash setup-face-mesh.sh` creates `.venv-face` with a Python 3.12 interpreter; the Google Face Landmarker model downloads on first use.

Start with `bash start.command`, open `http://127.0.0.1:8770`, and verify readiness with `.venv/bin/python doctor.py --require-keys`. The launcher starts a callback-only Cloudflare Quick Tunnel unless `ENHANCOR_WEBHOOK_URL` is configured. The default path needs no local GPU but is not offline; local capacity needs depend on clip size, frame processing and intermediate files. Native Windows users are directed to WSL2. No GitHub release is listed; live validation covered macOS ARM64 with Python 3.14.6, a draft-to-1080p run and a browser download. Other OS installations and the optional Catbox route were not live-tested.
```

## Key Capabilities
```text
- Runtime: FastAPI/Uvicorn serves a vanilla JavaScript UI; `workflow.py` provides CLI preparation, status and collection recovery.
- Preparation: Choose colored depth plus SAM 3, local face mesh without depth or SAM, or a combined depth-and-mesh composite.
- Review integrity: Approvals bind to artifact hashes, with full-clip review of masks or facial tracking as required by the mode.
- Audio path: Rubber Band pitches isolated vocals up three semitones without changing duration; final exports restore the complete source soundtrack.
- Generation routing: Seedance Edit handles image references; Omni handles video identity references; 1080p requires explicit approval.
- Recovery: Saved jobs resume result collection, not submission; polling remains authoritative if callbacks are delayed.
```

## Quick Start / Clone
```bash
.venv/bin/python doctor.py --require-keys
.venv/bin/python test_composite.py
.venv/bin/python -m unittest discover -s tests
.venv/bin/python workflow.py status LOCAL_JOB_ID
.venv/bin/python workflow.py resume LOCAL_JOB_ID
.venv/bin/python workflow.py resume LOCAL_JOB_ID --hd
```
