Image-to-Video
Image-to-Video
POST https://api.novita.ai/v3/async/img2video
This API seamlessly transforms an image into a cohesive video. It is designed to create smooth transitions and animations from static images, making it ideal for producing dynamic visual content for presentations, social media, and marketing campaigns.
This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the video generation results.
Example
This API helps generate a video from an image. The returned video can be accessed via the API /v3/async/task-result
using the task_id
.
Try it in playground.
Request:
curl --location --request GET 'https://api.novita.ai/v3/async/img2video' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model_name": "SVD-XT",
"image_file": "{{Base64 encoded image}}",
"frames_num": 25,
"frames_per_second": 6,
"seed": 20231127,
"image_file_resize_mode": "CROP_TO_ASPECT_RATIO",
"steps": 20
}'
Response:
{
"task_id": "fa20dff3-18cb-4417-a7f8-269456a35154"
}
Use task_id
to get videos
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get the video URLs from the videos
field in the response.
Request:
curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id=fa20dff3-18cb-4417-a7f8-269456a35154' \
--header 'Authorization: Bearer {{API Key}}'
Response:
{
"task": {
"task_id": "fa20dff3-18cb-4417-a7f8-269456a35154",
"task_type": "IMG_TO_VIDEO",
"status": "TASK_STATUS_SUCCEED",
"reason": ""
},
"images": [],
"videos": [
{
"video_url": "https://faas-output-video.s3.ap-southeast-1.amazonaws.com/test/fa20dff3-18cb-4417-a7f8-269456a35154/e40de30e115947a0be2dfc78925e587d.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASVPYCN6LRCW3SOUV%2F20231127%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=20231127T151757Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=14faf7df34c2c2ff68fed102095af593844db7c5c5cd2d80e80beec0613192c7",
"video_url_ttl": "3600",
"video_type": "mp4"
}
]
}