Communitygithub.com

comfy-h3-render-core

Short drama industrialized pipeline: Stage 3. H3 physics-based video rendering and anti-crash orchestration. Interfaces with local ComfyUI to schedule MiniMax H3 for Turbo 8-step video generation. Hardcore safeguards: Windows WDDM driver lock defense, latent space 32-divisibility law, single-speaker lock and all-silence suppression, first-frame I2V safety injection, and inter-shot VRAM leak prevention.

What is comfy-h3-render-core?

This skill, comfy-h3-render-core, is the third stage in an industrialized short drama production pipeline. It orchestrates physics-based video rendering using MiniMax H3 on a local ComfyUI instance, performing Turbo 8-step generation. Its primary value lies in enforcing three critical "anti-crash" rules: 1) Latent space width must be divisible by 32 (e.g., 832×480) to avoid VAE crashes; 2) On Windows, it mandates specific ComfyUI startup flags (`--disable-cuda-malloc`, `--disable-async-offload`) to prevent WDDM driver mutex lock contention that can slow rendering 15x; 3) It injects precise prompt instructions to lock a single speaker and enforce total silence for all other characters, preventing unwanted mouth movements. The skill also includes VRAM cleanup between shots via ComfyUI's `/free` endpoint and checkpoint resume logic to skip already-rendered segments. By integrating these physics-aware controls, it ensures reliable, efficient, and artifact-free generation suitable for long, multi-shot productions on Windows systems.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/abserari/drama-production-skills/tree/HEAD/skills/comfy-h3-render-core

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

ComfyUI H3 Render Core (H3 Physical Rendering & Orchestration Stage)

Stage Role: Core physical generation stage for short dramas. Core Principles: Do not hardcode ComfyUI node numbers; strictly prevent Windows WDDM driver deadlocks; enforce single-speaker lock and latent space size safety checks.


1. Run Contract & Input/Output

  • Input:
    1. plan.json (containing camera movement, dialogue, and sequence timing of 175 frames);
    2. Fixed-frame base images from Stage 2: segments/{seg_id}_keyframe.png;
    3. style_bible.json.
  • Output:
    1. H3 natively generated video: segments/{seg_id}.mp4 (with native audio and video);
    2. VRAM status monitoring log and rendering time ledger.

2. Hardcore SOP: Three Anti-Crash Physical Laws (with numeric characteristics and error counterexamples)

2.1 Law 1: Latent Space Width 32-Divisibility Rule (Prevent VAE Latent Space Crash)

  • Symptom/Error: RuntimeError: shape '[1, 24, 1, 1, 15, 2, 26, 2]' is invalid for input of size 38160
  • Root Cause: MiniMax H3's 3D Patch size requires width to be divisible by 16, and the quotient must be even (i.e., width % 32 == 0).
  • Criteria & Handling:
    • Forbidden: 848×480 (848/16=53 is odd, cannot be divided by patch=2, will crash!);
    • Forced Lock: Standard widescreen is always locked to 832×480 (832/16=52 is even, 52/2=26 gives perfect divisibility!).

2.2 Law 2: Windows WDDM Driver Mutex Lock Defense (Prevent 15x Slowdown)

  • Symptom: On Windows, enabling cudaMallocAsync or multi-stream async offloading (async-offload) causes single-step sampling to drop from 40 seconds to 600 seconds (single segment takes up to 70 minutes).
  • Root Cause: Windows' WDDM driver model causes severe kernel mutex lock contention when transferring large weights across CUDA streams.
  • Handling (ComfyUI Golden Startup Arguments):
    python <COMFYUI_PATH>/main.py --disable-auto-launch --disable-mmap --disable-cuda-malloc --disable-async-offload --listen 127.0.0.1 --port 8188
    
    Using native caching and single-stream scheduling bypasses driver locks, keeping single-segment generation time stable at 350 seconds (5.8 minutes).

2.3 Law 3: Single Speaker Lock & Silence Suppression Instruction Assembly (Eliminate All-Characters Talking)

When constructing [Subject 1] and [Action 1], strictly enforce separate assembly:

  • [Subject 1]: Primary speaker: [SpeakerName], alongside [ListenerName] (silent listener).
  • [Action 1] Core Primitive:
    Only [SpeakerName] is actively speaking with natural, synchronized Mandarin lip movement, [Action]. 
    Crucial requirement: [ListenerName] remains strictly silent with lips tightly sealed and mouth completely closed, neither speaking nor making any mouth motions, showing a tense glare. 
    In the final 1.2 seconds, all characters firmly close their mouths, ending on a tense silent glare.
    

3. Hardcore SOP: VRAM Anti-Fragmentation & Checkpoint Resume Protection

  1. Inter-Shot VRAM Cleanup: After rendering each shot, call the ComfyUI /free endpoint:
    payload = {"unload_models": False, "free_memory": True}
    
    Clear PyTorch intermediate 3D latent space tensor cache to prevent cumulative OOM during long production cycles.
  2. Checkpoint Resume to Prevent Re-rendering: Check if segments/{seg_id}.mp4 exists and its size is greater than 100KB. If so, print [Reuse] and skip, enabling second-level checkpoint resume.

4. Dedicated Tool Script

  • H3 Execution Graph Assembly & Orchestration Engine: python scripts/h3_render_orchestrator.py --plan plan.json --server 127.0.0.1:8188

Individual skills in this repo

This repo contains 5 individual skills — each has its own dedicated page.

comfy-h3-video-producer

本地 ComfyUI 剧本转视频自动生产管线(MiniMax H3)。用户给剧本要求用 ComfyUI 出分镜视频,或提到"一采二采/超分/班长套件/CSGlide/工作流生成视频"时使用。覆盖:工作流握手(不写死节点号)、导演调度与段规划、H3 提示词、提交与自动监工、一采双检闸门、收片清床音与拼接、断点续产。

drama-audio-soundstage

短剧工业化管线·第 4 工序:声音工程与智能避让配乐。负责 H3 视频生成后的声音精修。硬核沉淀:谱减法音频门控(消灭风噪/电流床音)、Whisper ASR 纯普通话语种漂移拦截、FFmpeg 原生侧链动态避让混音(Sidechain Ducking,台词开口 BGM 瞬降 -14dB,闭嘴扬起)。

drama-director-staging

短剧工业化管线·第 1 工序:编剧与导演分镜调度。负责将剧情大纲或小说文本转化为符合短剧视听规律的工业级分镜。内置:6 大动态运镜轮换决策树、台词纯中文汉字归一化(数字大写)、短剧快节奏 20~28 字密度调控、单人发言与旁观者闭嘴标注。

drama-finishing-upscaler

短剧工业化管线·第 5 工序:终期成片与 1080p 超分增强。负责全集分镜无损拼接与院线级 1080p 超分辨率放大。硬核沉淀:FFmpeg concat 零损耗直拼、RealESRGAN x2plus GPU 独占 FP16 批量超分(~4.8fps)、原生高质量避让音轨无损混流、ffprobe 工业级物理参数验收。

drama-keyframe-forge

短剧工业化管线·第 2 工序:分镜定帧与资产一致性。负责在视频渲染前,建立全局风格母卡 (Style Bible),并为每个分镜前置生成“场景+人物+道具”三合一的 16:9 高清定帧垫图。彻底根治 T2V 盲跑带来的人脸变形、角色换脸、场景变色与道具软化。

Related Skills