Skip to content

Yeabebe/script-parser-custom-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComfyUI Script-to-Video Suite

Transform PDF scripts into AI-ready video generation prompts through an intelligent pipeline.

A ComfyUI custom node suite that converts long-form PDF scripts into structured storyboards and detailed video generation prompts using AI-powered parsing and scene breakdown.


Badges

ComfyUI Python Status


Table of Contents


Features

  • PDF Script Processing: Extract and chunk text from PDF screenplay/script files with configurable overlap
  • AI-Powered Storyboarding: Generate detailed storyboard panels using Gemini AI via relay server
  • Prompt Engineering: Convert storyboard scenes into optimized video generation prompts
  • Modular Pipeline: Three independent, chainable nodes for maximum flexibility
  • ComfyUI Integration: Seamless workflow integration with custom output types

Installation & Setup

Prerequisites

  • ComfyUI (latest version recommended)
  • Python 3.10+
  • PyMuPDF for PDF processing
  • Git

Installation Steps

  1. Clone the repository into your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/
git clone https://github.com/Long-form-AI-video-generation/script-parser-custom-node.git
  1. Install dependencies:
cd script-parser-custom-node
pip install PyMuPDF requests
  1. Restart ComfyUI to load the custom nodes

  2. Verify installation - Look for "Script To Video Suite" in your node menu

Relay Server Configuration

The suite uses a Gemini AI relay server for processing. The default endpoint is pre-configured.

To use your own relay server, update the RELAY_SERVER_URL in the gemini_relay_client.py file.

Troubleshooting

  • Nodes not appearing in ComfyUI:
    Ensure the repository is cloned into ComfyUI/custom_nodes/ and restart ComfyUI.
  • Relay server connection errors:
    Check your internet connection and verify RELAY_SERVER_URL in gemini_relay_client.py.
  • PDF parsing issues:
    Confirm that the PDF is not encrypted or image-based (use OCR first if needed).

Architecture Overview

System Design

┌─────────────────┐
│   PDF Script    │
│    (Input)      │
└────────┬────────┘
         │
         ▼
┌─────────────────────────┐
│   1. PDF Chunker        │
│   - Extract text        │
│   - Create overlapping  │
│     chunks              │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│ 2. Storyboard Generator │
│   - Process via Gemini  │
│   - Create panels       │
│   - De-duplicate        │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│ 3. Prompt Generator     │
│   - Split into scenes   │
│   - Generate prompts    │
│   - Format for AI video │
└────────┬────────────────┘
         │
         ▼
┌─────────────────┐
│ Video Prompts   │
│   (Output)      │
└─────────────────┘

Core Components

The suite registers three primary nodes with ComfyUI's node system, each designed for a specific stage of the script-to-video conversion pipeline.


Script-to-Video Pipeline

Stage 1: PDF Chunking

The PDF Chunker node extracts text from PDF files and splits it into manageable chunks with configurable overlap to maintain context between segments.

Key Parameters:

  • pdf_path: File path to the source PDF script
  • chunk_size: Characters per chunk (4000)
  • overlap_size: Overlap between chunks (400)

Stage 2: Storyboard Generation

The Storyboard Generator processes each chunk through the Gemini relay server to create detailed storyboard panels with visual descriptions and action notes.

Processing Flow:

  1. Iterates through text chunks
  2. Sends each chunk with prompt template to relay server
  3. Collects AI-generated storyboard panels
  4. De-duplicates based on action descriptions

Stage 3: Prompt Generation

The Prompt Generator converts storyboard scenes into detailed, AI-ready video generation prompts optimized for models like Stable Diffusion Video or RunwayML.

Scene Processing:


Node Reference

1. PDF Chunker (S2V)

Property Description
Category Script To Video Suite
Input Types pdf_path (STRING), chunk_size (INT), overlap_size (INT)
Output Type CHUNKS (custom type)
Function process_pdf

Purpose: Extracts and chunks PDF script text for processing


2. Storyboard Generator (S2V)

Property Description
Category Script To Video Suite
Input Types chunks (CHUNKS), prompt_template (STRING)
Output Type STRING (storyboard_text)
Function generate_storyboard

Purpose: Converts script chunks into structured storyboard panels using AI


3. Prompt Generator (S2V)

Property Description
Category Script To Video Suite
Input Types storyboard_text (STRING), prompt_template (STRING)
Output Type STRING (final_prompts)
Function generate_prompts

Purpose: Generates AI video generation prompts from storyboard scenes


Example Usage

Basic Workflow

[PDF Chunker] → [Storyboard Generator] → [Prompt Generator] → [Save Text]

Workflow Configuration

  1. Add PDF Chunker Node

    pdf_path: "C:/Scripts/my_screenplay.pdf"
    chunk_size: 4000
    overlap_size: 400
    
  2. Connect to Storyboard Generator

    prompt_template: "You are a storyboard artist. Create storyboard 
    panels from the following script text. Use '--- PANEL BREAK ---' 
    between panels..."
    
  3. Connect to Prompt Generator

    prompt_template: "You are a prompt engineer for an AI video generator. 
    Convert the following storyboard scene into detailed prompts..."
    

Sample Output Format

--- SCENE BREAK ---

PANEL 001
ACTION_DESCRIPTION: Character walks through foggy street at night
VISUAL_PROMPT: cinematic shot, noir atmosphere, streetlights through fog, 
lone figure silhouette, moody lighting, 4k quality

--- SCENE BREAK ---

PANEL 002
ACTION_DESCRIPTION: Close-up of character's face showing concern
VISUAL_PROMPT: dramatic close-up, concerned expression, rim lighting, 
shallow depth of field, cinematic color grading

Development Guide

Project Structure

script-parser-custom-node/
└── comfyui-script-to-video-suite/
    ├── __init__.py                    # Node registration
    └── s2v_nodes/
        ├── gemini_relay_client.py     # API relay client
        ├── pdf_parser_node.py         # Legacy parser 
        ├── s2v_chunker_node.py        # PDF Chunker node
        ├── s2v_storyboard_node.py     # Storyboard Generator
        └── s2v_prompt_gen_node.py     # Prompt Generator

Dependencies

  • PyMuPDF (fitz): PDF text extraction
  • requests: HTTP communication with relay server
  • re: Regular expression for scene parsing
  • json: Data serialization

Environment Setup

  1. Development Installation:
git clone https://github.com/Long-form-AI-video-generation/script-parser-custom-node.git
cd script-parser-custom-node
pip install -e .
  1. Testing Nodes:
    • Load ComfyUI in development mode
    • Add nodes to test workflow
    • Monitor console output for debugging

Reporting Issues

  • Use GitHub Issues for bug reports
  • Include ComfyUI version, Python version, and error logs
  • Provide sample PDF or workflow JSON if applicable

Maintainers & Acknowledgements

Maintainers

Long-form AI Video Generation Team

Related Projects



Contributions, feedback, and ideas are always welcome! let’s build the future of AI video together!

⭐ If this project helps your workflow, consider giving it a star! ⭐

About

script-parser-custom-node

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%