# kosinkadink/comfyui-videohelpersuite architecture

> Architecture diagram of the GitHub repository kosinkadink/comfyui-videohelpersuite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kosinkadink/comfyui-videohelpersuite
- Repository: https://github.com/kosinkadink/comfyui-videohelpersuite

## Overview

##### Project type and purpose
- This is a plugin-style extension (“ComfyUI-VideoHelperSuite”) for ComfyUI that adds video and image processing nodes, a minimal web server for previews, and a test framework for node validation. There’s no traditional database; instead it relies on JSON configs and ffmpeg as an external service.

##### File structure
Top-level
- pyproject.toml, requirements.txt, LICENSE, .github/workflows – build, CI/CD, packaging files
- README.md – high-level overview
- __init__.py – package root
Sub-packages
- videohelpersuite/ – core Python library implementing ComfyUI nodes, helpers, ffmpeg integrations, server.py for advanced previews
- testframework/ – a lightweight test server (server.py) plus JS testRunner for automated node tests in browser
- video_formats/ – JSON files defining ffmpeg command templates for each output format
- web/js/ – static JavaScript assets used by the ComfyUI web UI (VHS.core.js, videoinfo.js)
Tests
- tests/ – JSON test cases and a README for how to run them

##### Key insights from the README
- Core functionality revolves around four node families: Load Video/Image Sequence, Video Combine, Load Audio, Latent/Image utilities.
- Advanced preview feature uses ffmpeg to generate browser-playable clips on demand via the embedded server.
- Video formats are extensible via JSON configs in video_formats/.
- Testframework spins up a server and uses testRunner.js in a headless or browser environment to validate node behavior against JSON inputs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef backend fill:#AED6F1,stroke:#000,stroke-width:1px
    classDef client fill:#F5B041,stroke:#000,stroke-width:1px
    classDef config fill:#ABEBC6,stroke:#000,stroke-width:1px
    classDef external fill:#F1948A,stroke:#000,stroke-width:1px

    subgraph "ComfyUI Host (ComfyUI Core)"
        CU["ComfyUI Core\n(registers plugin via API)"]:::backend
    end

    subgraph "VideoHelperSuite Plugin"
        subgraph "Node Library"
            LV["Load Video Sequence Node"]:::backend
            LI["Load Image Sequence Node"]:::backend
            VC["Video Combine & FFMPEG Argument Composer"]:::backend
            LA["Load Audio Node"]:::backend
            IL["Image Latent Nodes"]:::backend
            LP["Latent Preview Node"]:::backend
            UT["Helper Utilities"]:::backend
            LG["Logging"]:::backend
            DOC["Node Registration & Documentation"]:::backend
        end
        subgraph "Preview Server (Advanced Previews)"
            PS["Preview Server"]:::backend
        end
    end

    FL["JSON Format Loader"]:::config
    FF["ffmpeg CLI"]:::external

    subgraph "Web Browser (Client)"
        UIW["ComfyUI Web UI"]:::client
        VHS["VHS.core.js"]:::client
        VI["videoinfo.js"]:::client
    end

    subgraph "Test Framework"
        TS["Test Framework Server"]:::backend
        TR["Test Runner JS"]:::client
        TC["Test Case Definitions"]:::config
    end

    CU -->|"loads plugin nodes"| LV
    CU --> LI
    CU --> VC
    CU --> LA
    CU --> IL
    CU --> LP
    CU --> UT
    CU --> LG
    CU --> DOC

    UIW -->|"configures node\nsends params"| LV
    UIW --> LI
    UIW --> VC
    UIW --> LA
    UIW --> IL
    UIW --> LP

    LV -->|"invokes ffmpeg"| FF
    LI -->|"invokes ffmpeg"| FF
    VC -->|"reads JSON templates"| FL
    VC -->|"invokes ffmpeg"| FF
    LA -->|"invokes ffmpeg"| FF
    IL -->|"invokes ffmpeg"| FF
    LP -->|"invokes ffmpeg"| FF

    UIW -->|"HTTP GET /preview"| PS
    PS -->|"invokes ffmpeg"| FF
    PS -->|"returns clip"| UIW

    TR -->|"HTTP API"| TS
    TS -->|"spins ComfyUI instance or mocks nodes"| LV
    TS -->|"returns pass/fail"| TR
    TC --> TS

    FL --> VC

    click LV "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/load_video_nodes.py"
    click LI "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/load_images_nodes.py"
    click VC "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/batched_nodes.py"
    click LA "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/nodes.py"
    click IL "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/image_latent_nodes.py"
    click LP "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/latent_preview.py"
    click UT "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/utils.py"
    click LG "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/logger.py"
    click DOC "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/documentation.py"
    click PS "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/videohelpersuite/server.py"
    click FL "https://github.com/kosinkadink/comfyui-videohelpersuite/tree/main/video_formats/"
    click TS "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/testframework/server.py"
    click TR "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/testframework/web/js/testRunner.js"
    click TC "https://github.com/kosinkadink/comfyui-videohelpersuite/tree/main/tests/"
    click VHS "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/web/js/VHS.core.js"
    click VI "https://github.com/kosinkadink/comfyui-videohelpersuite/blob/main/web/js/videoinfo.js"
```
