Overview
This node generates videos from images using the PiAPI Kling service. It transforms a single input image into a video, optionally guided by text prompts and enhanced with additional visual elements or an end frame image. This is useful for content creators, marketers, or developers who want to automate video generation from static images with customizable styles and durations.
Common scenarios include:
- Creating short promotional videos from product images.
- Generating social media video content from photos with thematic prompts.
- Automating video creation workflows where input images are dynamically provided.
Practical example:
- Input an image URL of a landscape, specify a prompt like "sunset over mountains," choose a 10-second duration and portrait aspect ratio, and generate a stylized video clip suitable for Instagram stories.
Properties
| Name | Meaning |
|---|---|
| Image Source | Where to get the main image from: either a URL or binary data from a previous node's output. |
| Image URL | The URL of the image to transform into a video (required if Image Source is URL). |
| Binary Property | The name of the binary property containing the image (required if Image Source is binary data). |
| End Frame Image Source | Whether to use an end frame image and its source: None, URL, or binary data. |
| End Frame Image URL | URL of the end frame image (required if End Frame Image Source is URL). |
| End Frame Binary Property | Name of the binary property containing the end frame image (required if End Frame Image Source is binary data). |
| Prompt | Text prompt to guide the style and content of the generated video. |
| Negative Prompt | Text prompt specifying elements to avoid in the video. |
| Use Elements | Boolean flag to enable adding up to 4 element images into the video (available in version 1.6 only). |
| Elements | Collection of element images (URLs) to include in the video when Use Elements is enabled. |
| Duration | Length of the generated video: 5 or 10 seconds. |
| Aspect Ratio | Aspect ratio of the video: Landscape (16:9), Portrait (9:16), or Square (1:1). |
| Mode | Generation mode: Standard or Professional. |
| Version | Model version to use for generation, ranging from V1.0 to V2.1 Master, with some versions having higher cost. |
| CFG Scale | Controls how strongly the video adheres to the prompt, between 0 and 1 (recommended 0.5). |
| Wait for Completion | Whether to wait for the video generation task to complete before returning output. |
Output
The node outputs JSON data containing details about the video generation task. The key fields include:
task_id: Identifier of the submitted video generation task.- Other metadata returned by the API about the task status and parameters.
- If "Wait for Completion" is enabled, the output includes the final completed task data once the video is ready.
Binary data output is not directly produced by this node; instead, it returns task information and URLs to access the generated video externally.
Dependencies
- Requires an API key credential for the PiAPI Kling service.
- Uses the PiAPI REST API endpoint
/api/v1/taskto submit video generation requests. - The node depends on helper functions to fetch binary data buffers from input items when images are provided as binary.
- Network access is required to fetch images from URLs and communicate with the external API.
Troubleshooting
- Invalid image URL: If the provided image URL is malformed, the node throws an error indicating the invalid URL. Ensure URLs are correctly formatted.
- Missing binary data: When using binary data as image input, if the specified binary property does not exist or contains no data, an error is thrown. Verify that the binary property name matches the input data.
- Elements feature errors: Enabling elements requires at least one and at most four element images. Providing zero or more than four will cause an error.
- API errors: If the API returns a non-200 response code, the node throws an error with the message from the API. Check API credentials and request parameters.
- Timeouts or long waits: If "Wait for Completion" is enabled, the node waits for the task to finish. Long processing times may delay workflow execution.
To resolve these issues:
- Validate all URLs before running the node.
- Confirm binary properties exist and contain valid image data.
- Follow the constraints on elements count.
- Ensure correct and active API credentials.
- Consider disabling "Wait for Completion" if immediate response is preferred.
Links and References
- PiAPI Kling Video Generation Documentation (hypothetical link for reference)
- n8n documentation on Working with Binary Data
- General info on Video Aspect Ratios