Package Information
Documentation
n8n-nodes-comfyui-image-to-video
This package provides n8n nodes to integrate with ComfyUI - A powerful and modular stable diffusion GUI with a graph/nodes interface.
Features
- Execute ComfyUI workflows directly from n8n
- Generate images and videos using stable diffusion models
- Support for workflow JSON import
- Automatic output retrieval from workflow outputs
- Progress monitoring and error handling
- Support for API key authentication
- Configurable timeout settings
Prerequisites
- n8n (version 1.0.0 or later)
- ComfyUI instance running and accessible
- Node.js 16 or newer
Installation
npm install n8n-nodes-comfyui-image-to-video
Node Types
ComfyUI Node
This node allows you to execute ComfyUI workflows and retrieve generated images.
Settings
- API URL: The URL of your ComfyUI instance (default: http://127.0.0.1:8188)
- API Key: Optional API key if authentication is enabled
- Workflow JSON: The ComfyUI workflow in JSON format
Outputs
The node outputs an array of generated images with:
filename
: Name of the generated image filesubfolder
: Subfolder path if anydata
: Base64 encoded image data
ComfyUI Image to Video Node
This node allows you to convert images to videos using ComfyUI's image-to-video capabilities (like AnimateDiff, WanImageToVideo, or video generation models).
Settings
- API URL: The URL of your ComfyUI instance (default: http://127.0.0.1:8188)
- API Key: Optional API key if authentication is enabled
- Workflow JSON: The ComfyUI workflow in JSON format for video generation
- Input Type: Choose between URL, Base64, or Binary input methods
- Input Image: URL or base64 string of the input image (when using URL or Base64 input type)
- Binary Property: Name of the binary property containing the image (when using Binary input type)
- Timeout: Maximum time in minutes to wait for video generation
Input
The node accepts an image input in three ways:
- URL: Provide a direct URL to an image
- Base64: Provide a base64-encoded image string
- Binary: Use an image from a binary property in the workflow (e.g., from an HTTP Request node)
Outputs
The node outputs the generated video:
- In the
binary.data
property with proper MIME type and file information fileName
: Name of the generated video filedata
: Base64 encoded video datafileType
: The type of video file (e.g., 'video')fileSize
: Size of the video in KBfileExtension
: File extension (webp, mp4, gif)mimeType
: MIME type of the video
Note: If multiple videos are generated by the ComfyUI workflow, only the first video output will be returned. The node currently prioritizes video outputs (files with .webp, .mp4, or .gif extensions) and returns the first one it finds.
Usage Examples
Using the ComfyUI Node
- Export your workflow from ComfyUI as JSON
- Create a new workflow in n8n
- Add the ComfyUI node
- Paste your workflow JSON
- Configure the API URL
- Execute and retrieve generated images
Using the ComfyUI Image to Video Node
- Create a workflow in ComfyUI for video generation (e.g., using WanImageToVideo, VHS_VideoCombine)
- Export the workflow as JSON (API)
- Add the ComfyUI Image to Video node
- Paste your workflow JSON
- Select the appropriate Input Type:
- For URL: Enter the image URL
- For Base64: Provide a base64 string
- For Binary: Specify the binary property containing the image (default: "data")
- Configure timeout as needed
- Execute the workflow to generate a video from your input image
Error Handling
The node includes comprehensive error handling for:
- API connection issues
- Invalid workflow JSON
- Execution failures
- Timeout conditions
- Input image validation
Development
# Install dependencies
npm install
# Build
npm run build
# Test
npm run test
# Lint
npm run lint