AnimateAnyone動作模板產生模型,可基於人物運動視頻提取人物動作,並產生可供AnimateAnyone視頻產生模型使用的人物動作模板。本文檔介紹了該模型提供的動作模板產生能力的API調用方法。
本文檔僅適用於“中國大陸(北京)”地區。如需使用模型,需使用“中國大陸(北京)”地區的API Key。
模型概覽
模型名 | 模型簡介 |
animate-anyone-template-gen2 | animate-anyone-template-gen2是一個人物動作模板產生模型,可基於人物運動視頻提取人物動作並製作模板。 |
模型輸入要求
正確樣本:
符合動作模板製作要求的視頻樣本 | |
上傳的視頻中人物應全身入鏡、身體無遮擋、保持人臉清晰。
人物應從畫面首幀開始出現,動作連貫,一鏡到底(有情境切換的視頻建議拆分成多段)。
建議:畫面首幀人物正面朝向鏡頭;避免人物運動中出現大幅彎腰、下蹲、身體蜷縮等動作。
錯誤樣本:
身體蜷縮、遮擋 | 畫面有多人 | 人物模糊 | 人物過小 (人臉不清晰) | 人物過大 (人物不完整) |
|
|
|
|
|
為保障模板製作效果,應避免上傳視頻中的任一幀畫面出現上述錯誤情形。
當視頻首幀畫面出現上述錯誤情形時,當次提交的任務可能報錯並中止。
請確保上傳的視頻檔案來源符合相關法律法規。
產生的動作模板的音頻,與上傳的視頻檔案中的音頻一致。若不希望使用該音頻,或尚未取得該音頻(如音樂等)的使用許可,請在上傳視頻檔案前,消除其中的音頻資訊。
HTTP調用介面
功能描述
用於產生人物動作模板,該模板可作AnimateAnyone 視頻產生 API的輸入物,以產生人物動作視頻。
前提條件
已開通服務並獲得API-KEY:擷取與配置 API Key。
輸入限制
視頻格式:支援mp4、avi、mov。
視頻檔案不大於200MB。
視頻邊長不低於200,不大於2048;視訊框架率≥24fps,視頻編碼採用H.264或H.265。
視頻時間長度不小於2s且不大於60s。
視頻長寬比介於1:3到3:1。
上傳的視頻檔案支援HTTP連結,不支援本地路徑。
作業提交介面
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/因該演算法調用耗時較長,故採用非同步呼叫的方式提交任務。
任務提交之後,系統會返回對應的作業ID,後續可通過“作業任務狀態查詢和結果擷取介面”擷取任務狀態及對應結果。
入參描述
欄位 | 類型 | 傳參方式 | 必選 | 描述 | 樣本值 |
Content-Type | String | Header | 是 | 請求類型:application/json | application/json |
Authorization | String | Header | 是 | API-Key,例如:Bearer d1**2a | Bearer d1**2a |
X-DashScope-Async | String | Header | 是 | 使用 enable,表明使用非同步方式提交作業。 | enable |
model | String | Body | 是 | 指明需要調用的模型,此處用animate-anyone-template-gen2 | animate-anyone-template-gen2 |
input.video_url | String | Body | 否 | 使用者上傳的視頻 URL,用於產生基於指定視頻的動作模板。
說明 上傳檔案僅支援HTTP連結方式,不支援本地連結方式。 | http://aaa/bbb.mp4 |
出參描述:
欄位 | 類型 | 描述 | 樣本值 |
output.task_id | String | 提交非同步任務的作業 id,實際作業結果需要通過非同步任務查詢介面擷取 | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
output.task_status | String | 提交非同步任務後的 作業狀態 | “PENDING” |
request_id | String | 本次請求的系統唯一碼 | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 |
請求樣本
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/' \
--header 'X-DashScope-Async: enable' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "animate-anyone-template-gen2",
"input": {
"video_url": "http://xxx/1.mp4"
},
"parameters": {
}
}'響應樣本
{
"output": {
"task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1",
"task_status": "PENDING"
},
"request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51"
}作業任務狀態查詢和結果擷取介面
GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}入參描述
欄位 | 類型 | 傳參方式 | 必選 | 描述 | 樣本值 |
Authorization | String | Header | 是 | API-Key,例如:Bearer d1**2a。 | Bearer d1**2a |
task_id | String | Url Path | 是 | 需要查詢作業的task_id。 | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
出參描述
欄位 | 類型 | 描述 | 樣本值 |
output.task_id | String | 查詢作業的 task_id | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
output.task_status | String | 被查詢作業的作業狀態 | 任務狀態: PENDING 排隊中 RUNNING 處理中 SUCCEEDED 成功 FAILED 失敗 UNKNOWN 作業不存在或狀態未知 |
output.template_id | String | 平台輸出的動作模板ID,可作為“Animate-Anyone 視頻產生介面”的入參。 動作模板ID會進行許可權校正,請確保使用template_id的雲帳號與當前生產該動作模板的雲帳號一致。 | AACT.xxx.xxx-xxx.xxx |
usage.video_duration | Float | 本次請求產生模板時間長度計量,單位:秒 | "video_duration": 10.23 |
usage.video_ratio | String | 本次請求產生視頻模板的畫幅類型,該值為standard | "video_ratio": "standard" |
request_id | String | 本次請求的系統唯一碼 | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 |
請求樣本
curl -X GET \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
https://dashscope.aliyuncs.com/api/v1/tasks/<YOUR_TASK_ID>響應樣本
{
"request_id":"7574ee8f-38a3-4b1e-9280-11c33ab46e51",
"output":{
"task_id":"a8532587-fa8c-4ef8-82be-0c46b17950d1",
"task_status":"SUCCEEDED",
"template_id":"AACT.xxx.xxx-xxx.xxx"
},
"usage":{
"video_duration": 10.23,
"video_ratio": "standard"
}
}異常響應樣本:
{
"request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51",
"output": {
"task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1",
"task_status": "FAILED",
"code": "xxx",
"message": "xxxxxx",
}
}狀態代碼說明
大模型服務平台通用狀態代碼請查閱:錯誤資訊。
本模型還有如下特定錯誤碼:
http 返回碼* | 錯誤碼(code) | 錯誤資訊(message) | 含義說明 |
400 | InvalidParameter | Field required: xxx | 缺少入參,或格式錯誤 |
400 | InvalidURL.ConnectionRefused | Connection to ${url} refused, please provide available URL | 下載被拒絕,請提供可用的url |
400 | InvalidURL.Timeout | Download ${url} timeout, please check network connection. | 下載逾時,60s逾時 |
400 | InvalidFile.Size | Invalid file size. The video file size must be less than 200MB, and the audio file size must be less than 15MB. | 視頻檔案必須小於200MB,音頻檔案必須小於15MB |
400 | InvalidFile.Resolution | Invalid video resolution. The height or width of video must be 200 ~ 2048. | 視頻邊長需介於200-2048之間 |
400 | InvalidFile.Duration | Invalid file duration. The file duration must be 2s ~ 60s. | 視頻/音頻檔案時間長度需要介於2-60s之間 |
400 | InvalidFile.AspectRatio | Invalid file ratio. The file aspect ratio (height/width) must be between 3:1 and 1:3. | 視頻檔案長寬比需要介於3:1到1:3之間 |
400 | InvalidFile.Openerror | Invalid file, cannot open file as video. | 視頻檔案無法開啟 |
400 | InvalidFile.Content | The first frame of input video has no human body. Please choose another clip. | 視頻首幀需要有人 |
400 | InvalidFile.Content | The human is too small in the first frame of input video. Please choose another clip. | 視頻首幀人物過小 |
400 | InvalidFile.Content | The human is not clear in the first frame of input video. Please choose another clip. | 視頻首幀人物不清晰 |
400 | InvalidFile.FullBody | The human is not fullbody in the first frame of input video. Please choose another clip. | 視頻首幀人物不完整,需露出人物全身 |




