Image to Video Motion
Image to Video Motion
POST https://api.novita.ai/v3/async/img2video-motion
This API generates dynamic videos by integrating motion data with static images. It allows users to create engaging and fluid video content by applying motion vectors and sequences to still images, making it ideal for animation, video production, and creative media projects.
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 generates new videos using motion videos and images. The returned video can be accessed via the API /v3/async/task-result
using the task_id
.
Try it in the playground.
1. Get Image Assets ID
Request:
curl -X PUT -T "{{image file path}}" 'https://assets.novitai.com/image'
Response:
{
"assets_id": "cjIvbm92aXRhLWFpLWFzc2V0L2ltYWdlL214TVlKamtTemFCTmo3bkIyelNoWU5tSjdITVNlMjdk"
}
Image Files:
2. Get Video Assets ID
Request:
curl -X PUT -T "{{video file path}}" 'https://assets.novitai.com/video'
Response:
{
"assets_id": "cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL0NLd0N3aHJwS0ZyYVduNWVoejVFV0tleGlzN0toNmRq"
}
Video Files:
Below are some examples of videos and their asset IDs that can be used as motion videos. You can also use tools here to generate your own motion videos from original videos.
cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL3BYTjRDTXpwNzNqa2U2Wm1Na0FiRmVpcGtXRHMyajM4
https://faas-static-assets.s3.ap-southeast-1.amazonaws.com/demo1.mp4
cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL1BRNlpiRW5jWW1LR1pINk1LWDViMzRCRmo1Yk1jRDY4
https://faas-static-assets.s3.ap-southeast-1.amazonaws.com/demo2.mp4
cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL2JrdE01UEpIY0tIU0ZmUzdINEQ0aTdTZEpTWjhBRWFC
https://faas-static-assets.s3.ap-southeast-1.amazonaws.com/demo3.mp4
cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL0NLd0N3aHJwS0ZyYVduNWVoejVFV0tleGlzN0toNmRq
https://faas-static-assets.s3.ap-southeast-1.amazonaws.com/demo4.mp4
cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL1FFcmphdGJCOFI3ODdhR0gzajVUSkJZbTNkaHIzNzRu
https://faas-static-assets.s3.ap-southeast-1.amazonaws.com/demo5.mp4
3. Request Image to Video with Motion API
Use the image and video asset IDs generated from steps 1 and 2 to request image to video with motion API.
Request:
curl --location 'https://api.novita.ai/v3/async/img2video-motion' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{API Key}}' \
--data '{
"image_assets_id": "cjIvbm92aXRhLWFpLWFzc2V0L2ltYWdlL2J0aThqMm5EczI1bjVSYWZDNVhacGtSQ1Jud3pzUGty",
"motion_video_assets_id": "cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL2hFa1B6YmhzN204UHBjU2ZBUHA4Q1hiM1h6WkJTRThC",
"seed": 20231127
}'
Response:
{
"task_id": "6469ca5b-5929-4200-b263-241020763eb8"
}
Use task_id
to get images
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 videos url in videos
of response.
Request:
curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id=6469ca5b-5929-4200-b263-241020763eb8' \
--header 'Authorization: Bearer {{API Key}}'
Response:
{
"task": {
"task_id": "6469ca5b-5929-4200-b263-241020763eb8",
"task_type": "IMG_TO_VIDEO_MOTION",
"status": "TASK_STATUS_SUCCEED",
"reason": "",
"eta": 0,
"progress_percent": 100
},
"images": [],
"videos": [
{
"video_url": "https://faas-output-video.s3.ap-southeast-1.amazonaws.com/test/5e39e5f0-8416-4d17-8f5f-7cbe88a5168f/033f5fc7f5734b35bedcd7cac82b59d0.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASVPYCN6LRCW3SOUV%2F20231215%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=20231215T032655Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=53dafec708be2bbb3f814652b9a523372bc59b6334c0bf0e548109d088810701",
"video_url_ttl": "3600",
"video_type": "mp4"
}
]
}
Motion Video files: