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.
- Features
- Installation & Setup
- Architecture Overview
- Script-to-Video Pipeline
- Node Reference
- Example Usage
- Development Guide
- Maintainers & Acknowledgements
- 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
- ComfyUI (latest version recommended)
- Python 3.10+
- PyMuPDF for PDF processing
- Git
- 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- Install dependencies:
cd script-parser-custom-node
pip install PyMuPDF requests-
Restart ComfyUI to load the custom nodes
-
Verify installation - Look for "Script To Video Suite" in your node menu
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.
- Nodes not appearing in ComfyUI:
Ensure the repository is cloned intoComfyUI/custom_nodes/and restart ComfyUI. - Relay server connection errors:
Check your internet connection and verifyRELAY_SERVER_URLingemini_relay_client.py. - PDF parsing issues:
Confirm that the PDF is not encrypted or image-based (use OCR first if needed).
┌─────────────────┐
│ 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) │
└─────────────────┘
The suite registers three primary nodes with ComfyUI's node system, each designed for a specific stage of the script-to-video conversion pipeline.
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 scriptchunk_size: Characters per chunk (4000)overlap_size: Overlap between chunks (400)
The Storyboard Generator processes each chunk through the Gemini relay server to create detailed storyboard panels with visual descriptions and action notes.
Processing Flow:
- Iterates through text chunks
- Sends each chunk with prompt template to relay server
- Collects AI-generated storyboard panels
- De-duplicates based on action descriptions
The Prompt Generator converts storyboard scenes into detailed, AI-ready video generation prompts optimized for models like Stable Diffusion Video or RunwayML.
Scene Processing:
| 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
| 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
| 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
[PDF Chunker] → [Storyboard Generator] → [Prompt Generator] → [Save Text]
-
Add PDF Chunker Node
pdf_path: "C:/Scripts/my_screenplay.pdf" chunk_size: 4000 overlap_size: 400 -
Connect to Storyboard Generator
prompt_template: "You are a storyboard artist. Create storyboard panels from the following script text. Use '--- PANEL BREAK ---' between panels..." -
Connect to Prompt Generator
prompt_template: "You are a prompt engineer for an AI video generator. Convert the following storyboard scene into detailed prompts..."
--- 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
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
- PyMuPDF (fitz): PDF text extraction
- requests: HTTP communication with relay server
- re: Regular expression for scene parsing
- json: Data serialization
- 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 .- Testing Nodes:
- Load ComfyUI in development mode
- Add nodes to test workflow
- Monitor console output for debugging
- Use GitHub Issues for bug reports
- Include ComfyUI version, Python version, and error logs
- Provide sample PDF or workflow JSON if applicable
Long-form AI Video Generation Team
- Repository: Long-form-AI-video-generation
- Script Parser to Storyboard - Complimentary repository.
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! ⭐