The /image-to-video endpoint converts an image into a video with options for frame rate, length, and zoom speed, allowing for custom animations like slow zoom.
- URL:
/image-to-video - Method:
POST
- X-API-Key (string, required): The API key used for authentication.
- image_url (string, required): URL of the image to convert into a video.
- length (integer, optional): Duration of the output video in seconds. Defaults to 10 seconds.
- frame_rate (integer, optional): Frame rate for the video. Defaults to 24 frames per second.
- zoom_speed (float, optional): Rate of zoom applied to the image (e.g.,
1.1for slight zoom-in effect). Defaults to1.0(no zoom). - webhook_url (string, optional): URL to receive the video URL upon completion.
- id (string, optional): Unique identifier for tracking the job.
{
"image_url": "https://example.com/image.jpg",
"length": 15,
"frame_rate": 30,
"zoom_speed": 1.2,
"webhook_url": "https://your-webhook-url.com/notify",
"id": "video123"
}curl -X POST "https://your-api-domain.com/image-to-video" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/image.jpg",
"length": 15,
"frame_rate": 30,
"zoom_speed": 1.2,
"webhook_url": "https://your-webhook-url.com/notify",
"id": "video123"
}'If the video conversion is successful and no webhook_url is provided:
- Status Code:
200 OK - Body:
{ "job_id": "video123", "video_url": "https://cloud-storage-url.com/output.mp4", "message": "success" }
If a webhook_url is provided, the request is queued, and this response is returned:
- Status Code:
202 Accepted - Body:
{ "job_id": "video123", "message": "processing" }
- 400 Bad Request: Missing or invalid
image_url.{ "error": "Missing image_url parameter" } - 500 Internal Server Error: Conversion process failed.
{ "error": "Error during image-to-video conversion" }
- 400 Bad Request: Returned if
image_urlis missing or invalid. - 500 Internal Server Error: Returned if there is an error during video conversion.
zoom_speedvalues greater than1.0apply a zoom-in effect; values below1.0apply a zoom-out effect.- The
frame_ratecan be adjusted for smoother or more cinematic animations.
- Invalid Image URL: Make sure
image_urlis accessible and points directly to the image file. - Unsupported Frame Rate or Length: Check if the
frame_rateorlengthvalues are too high for server resources.
- Use
webhook_urlfor Long Conversions: For large images or high frame rates, usewebhook_urlto receive the video asynchronously. - Optimize Frame Rate: A
frame_rateof 24 is generally smooth, but adjust as needed based on animation requirements.