Video to Motion API
Turn a video of a person moving into a motion clip, then play it on any two-legged character you rigged with the Rigging API.
Moving from v1? The request is the same. The main changes for Video to Motion:
- The create response is the task object instead of an object with the task ID in
result. - Read the task through Tasks instead of
GET /openapi/v1/video-to-motion/:id. - Results are in
outputinstead ofresult, andoutputisnulluntil the task succeeds.
Create a Video to Motion task
Creates a Video to Motion task and returns the task object. The task reads the motion of the person in a video into a GLB clip as long as the video. It runs in the background. To read its result, see Get the result.
Meshy downloads and checks the video while it handles your request, so a video it can't use returns 400 before Meshy creates a task. The video must meet all of these requirements:
- File: an MP4, MOV, or AVI file of at most 200 MB (200,000,000 bytes)
- Video codec: H.264, HEVC, MPEG-4, or Motion JPEG
- Length: 2 to 60 seconds
- Frame rate: 24 to 120 frames per second
- Resolution: each side 300 to 4,096 pixels
For the best clip, film one person whose whole body stays in the frame.
A task costs 5 credits for each second of video, rounded to the nearest credit. For example, a 2.5-second video costs 13 credits. Meshy charges the credits when it creates the task, and refunds them if the task fails. See Pricing.
When the task succeeds or fails, Meshy deletes your video. The clip stays with the task, like other task files. See Asset retention.
To play the motion on a character, see Apply the motion to a character.
Request
# Read the motion from a video at a public URL
curl https://api.meshy.ai/openapi/v2/video-to-motion \
-X POST \
-H "Authorization: Bearer ${MESHY_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"video_url": "https://example.com/videos/dance.mp4"
}'
# Send a local MP4 file as a data URI
{ printf '{"video_url": "data:video/mp4;base64,'; base64 < dance.mp4 | tr -d '\n'; printf '"}'; } |
curl https://api.meshy.ai/openapi/v2/video-to-motion \
-X POST \
-H "Authorization: Bearer ${MESHY_API_KEY}" \
-H 'Content-Type: application/json' \
--data-binary @-
Response
{
"id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
"type": "video-to-motion",
"status": "PENDING",
"progress": 0,
"created_at": 1796083214512,
"started_at": null,
"finished_at": null,
"expires_at": null,
"preceding_tasks": 1,
"consumed_credits": 21,
"task_error": null,
"input": {
"video_url": "data:video/mp4;base64,[omitted]"
},
"output": null
}
Parameters
- Name
- video_url
- Type
- string
- Required
- Description
The video, as a public
httporhttpsURL or a base64 data URI, such asdata:video/mp4;base64,.... A data URI's media type must bevideo/*orapplication/octet-stream. Either way, the file can be at most 200 MB. A video that Meshy can't download, or that's outside the preceding requirements, returns400.
Returns
202 Accepted with the task object. The task starts as PENDING, with your request in input and output set to null. When you send a data URI, input.video_url holds its header without the video, such as data:video/mp4;base64,[omitted].
Two response headers help you read the task:
Location: the task's URL on TasksRetry-After: how many seconds to wait before you first read it
Failure modes
- Name
400 - Bad Request- Description
The request can't run. For example:
video_urlwasn't sent. The code isparameter_missing.- The request has a parameter the endpoint doesn't take, such as
prompt. The code isparameter_unknown. - Meshy couldn't download
video_url. The code isinput_download_failed. Make the URL publicly readable, or send the file as a data URI. - The file isn't a video Meshy can use. The code is
input_file_invalid, and the message names the problem, for examplevideo_url: the video runs 1.5 s; it must run 2 to 60 s. Send a video that meets the requirements.
The error message says which problem it found. See Errors.
- Name
401 - Unauthorized- Description
The API key is missing or invalid. Check the
Authorizationheader.
- Name
402 - Payment Required- Description
One of these applies:
- The account doesn't have enough credits for this video.
- The account reached a credit limit.
- The account is on the free plan.
Check your credits and plan, then retry.
- Name
403 - Forbidden- Description
Content moderation blocked the video. The code is
moderation_blocked_nsfw, and the message isexplicit content. Send a different video.
- Name
429 - Too Many Requests- Description
One of these limits was reached:
- Meshy is checking too many videos. The code is
rate_limit_exceeded, and the message isVideo processing is busy; try again shortly. Wait a few seconds, then retry. - You sent too many requests. Wait the number of seconds in
Retry-After, then retry. - Too many of your tasks are queued or running. Wait for some to finish, then retry.
- On an unlimited plan with no credits left, you reached the number of tasks that can run without credits. Wait for a task to finish, or add credits.
- Meshy is checking too many videos. The code is
Meshy charges nothing for a request that returns an error.
Apply the motion to a character
The clip in output.motion_url has the motion on its own, with no character. To play it on your character, wait until the Video to Motion task's status is SUCCEEDED. Then create an Animation task with these parameters:
motion_task_id: the Video to Motion task'sidrig_task_id: theidof one of your Rigging tasks with abipedrig
Create the Animation task within 3 days after the Video to Motion task finishes. After that, Meshy deletes the clip, like other task files, and Animation returns 404. Enterprise accounts keep their files.
Meshy charges for each task separately. See Pricing.
Video to Motion, then Animation
# 1. Read the motion from a video
curl https://api.meshy.ai/openapi/v2/video-to-motion \
-X POST \
-H "Authorization: Bearer ${MESHY_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"video_url": "https://example.com/videos/dance.mp4"
}'
# 2. When it succeeds, play it on a rigged character
curl https://api.meshy.ai/openapi/v2/animations \
-X POST \
-H "Authorization: Bearer ${MESHY_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"rig_task_id": "<Rigging task ID>",
"motion_task_id": "<Video to Motion task ID>"
}'
Get the result
Read Video to Motion tasks the same way as every other v2 task, through the Tasks routes. To list only Video to Motion tasks, filter by type=video-to-motion.
| To | Call |
|---|---|
| Get one task | GET /openapi/v2/tasks/{id} |
| Wait for updates | GET /openapi/v2/tasks/{id}/stream or a webhook |
| List your tasks | GET /openapi/v2/tasks?type=video-to-motion |
| Delete a task | DELETE /openapi/v2/tasks/{id} |
Video to Motion output
When the task succeeds, output holds these fields. The rest of the task object is the same for every task type. The URL in output stops working at expires_at.
Succeeded Video to Motion task
{
"id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
"type": "video-to-motion",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1796083214512,
"started_at": 1796083216813,
"finished_at": 1796083288293,
"expires_at": 1796342488293,
"preceding_tasks": 0,
"consumed_credits": 21,
"task_error": null,
"input": {
"video_url": "https://example.com/videos/dance.mp4"
},
"output": {
"motion_url": "https://assets.meshy.ai/***/output/clip.glb?Expires=***",
"motion_format": "glb",
"duration_ms": 4200
}
}
- Name
- motion_url
- Type
- string | null
- Description
Signed URL to the motion clip, a GLB file at 30 frames per second.
- Name
- motion_format
- Type
- string
- Description
The clip's file format, always
glb.
- Name
- duration_ms
- Type
- integer
- Description
The clip length, in milliseconds. It's the length of the video, as Meshy measured it when you created the task.