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
cd comfyui_script_to_video_suite
pip install -r requirements.txt-
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. This was required because API usage is restricted in some location and if it is needed to abstract the API calls in another location.
Steps
- clone the gemeni relay repository.
git clone https://github.com/bisratberhanu/gemini-relay.git - set your gemeni api key in the environment variable.
- run the server by running
GEMINI_API_KEY="your-gemeni-api-key" gunicorn --bind 127.0.0.1:8080 --timeout 700 app:app - In a new terminal run the command
ngrok http 8080. make sure ngrok is installed on your computer. - copy the server location it will look some thing like
https://unique-name.ngrok-free.dev - copy
.env.exampleto.envin this repository:cp .env.example .env
- 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 verify thatRELAY_SERVER_URLis correctly set in your environment or in the.envfile used by this project.
┌─────────────────┐
│ 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 and iamge prompts │
│ (Output) │
└─────────────────┘────────────────────
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
-
Connect to Prompt Generator
--- 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
and more nodes
- 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
Contributions, feedback, and ideas are always welcome!
⭐ If this project helps your workflow, consider giving it a star! ⭐