Skip to content

创建对口型任务

说明

创建对口型任务,异步执行,具体进度通过详情/列表接口查看

RPM   10/min

请求地址

http
POST /open/v1/video_lip_sync/create
http
access_token: {{access_token}}

参数说明

请求参数body

字段类型二级字段类型说明
video_file_idstring视频文件id,通过《文件管理》 上传文件
视频文件格式支持:mp4、mov、webm
screen_heightint屏幕高度【可选,默认1920】
backwayint指定数字人驱动到素材末尾的播放顺序【可选,默认1】
1-正放、2-倒放
drive_modestring驱动模式【可选,默认""】
""-正常驱动、random-随机帧驱动
screen_widthint屏幕宽度【可选,默认1080】
callbackstring回调地址【可选】
modelint模型版本【可选,默认0】
0-基础版、1-高质量版
audio_typestring声音驱动类型【默认tts】
tts-文本驱动
audio-音频驱动
tts_configobject文本驱动设置【文本驱动时必选】
textarray[string]文本
audio_man_idstirng声音id
speednumber语速【可选,默认1】 范围:0.5~2
pitchnumber音调【可选,默认1】 音调范围参考《创建语音生成任务》
audio_file_idstring音频文件id【音频驱动时必选】
通过《文件管理》 上传文件
音频文件格式支持:mp3、m4a、wav
volumeint音量【可选,默认100】范围1~100

响应参数

字段类型说明
trace_idstring链路追踪id
codeint响应状态码
msgstring响应消息
datastring创建视频id

请求示例

json
{
  "video_file_id": "e284db4d95de4220afe78132158156b5",
  "screen_width": 1080,
  "screen_height": 1920,
  "callback": "https://example.com/openapi/callback",
  "model": 0,
  "audio_type": "tts",
  "tts_config": {
    "text": "君不见黄河之水天上来,奔流到海不复回。",
    "audio_man_id": "C-f2429d07554749839849497589199916",
    "speed": 1,
    "pitch": 1
  }
}

响应JOSN

json
{
  "trace_id": "8d10659438827bd4d59eaa2696f9d391",
  "code": 0,
  "msg": "success",
  "data": "9499ed79995c4bdb95f0d66ca84419fd"
}

回调json

json
{
  "trace_id": "8d10659438827bd4d59eaa2696f9d391",
  "code": 0,
  "msg": "success",
  "data": {
    "id": "9499ed79995c4bdb95f0d66ca84419fd",
    "status": 20,
    "progress": 100,
    "msg": "success",
    "video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
    "preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
    "duration": 300,
    "create_time": 1738636800
  }
}

响应状态码说明

code说明
0响应成功
10400AccessToken验证失败
40000参数错误
40001超出RPM限制
50000系统内部错误

示例代码

bash
curl -L 'https://open-api.chanjing.cc/open/v1/video_lip_sync/create' \
  -H 'access_token: {{access_token}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "video_file_id": "e284db4d95de4220afe78132158156b5",
    "screen_width": 1080,
    "screen_height": 1920,
    "callback": "https://example.com/openapi/callback",
    "model": 0,
    "audio_type": "tts",
    "tts_config": {
      "text": "君不见黄河之水天上来,奔流到海不复回。",
      "audio_man_id": "C-f2429d07554749839849497589199916",
      "speed": 1,
      "pitch": 1
    }
  }'
go
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://open-api.chanjing.cc/open/v1/video_lip_sync/create"
	payload := []byte(`{
  "video_file_id": "e284db4d95de4220afe78132158156b5",
  "screen_width": 1080,
  "screen_height": 1920,
  "callback": "https://example.com/openapi/callback",
  "model": 0,
  "audio_type": "tts",
  "tts_config": {
    "text": "君不见黄河之水天上来,奔流到海不复回。",
    "audio_man_id": "C-f2429d07554749839849497589199916",
    "speed": 1,
    "pitch": 1
  }
}`)

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
	if err != nil {
		panic(err)
	}
	req.Header.Set("access_token", "{{access_token}}")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	b, _ := io.ReadAll(resp.Body)
	fmt.Println(string(b))
}
java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n" +
  "  \"video_file_id\": \"e284db4d95de4220afe78132158156b5\",\n" +
  "  \"screen_width\": 1080,\n" +
  "  \"screen_height\": 1920,\n" +
  "  \"callback\": \"https://example.com/openapi/callback\",\n" +
  "  \"model\": 0,\n" +
  "  \"audio_type\": \"tts\",\n" +
  "  \"tts_config\": {\n" +
  "    \"text\": \"君不见黄河之水天上来,奔流到海不复回。\",\n" +
  "    \"audio_man_id\": \"C-f2429d07554749839849497589199916\",\n" +
  "    \"speed\": 1,\n" +
  "    \"pitch\": 1\n" +
  "  }\n" +
  "}\n");
Request request = new Request.Builder()
  .url("https://open-api.chanjing.cc/open/v1/video_lip_sync/create")
  .method("POST", body)
  .addHeader("access_token", "{{access_token}}")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
py
import requests
import json

url = "https://open-api.chanjing.cc/open/v1/video_lip_sync/create"

payload = json.dumps({
  "video_file_id": "e284db4d95de4220afe78132158156b5",
  "screen_width": 1080,
  "screen_height": 1920,
  "callback": "https://example.com/openapi/callback",
  "model": 0,
  "audio_type": "tts",
  "tts_config": {
    "text": "君不见黄河之水天上来,奔流到海不复回。",
    "audio_man_id": "C-f2429d07554749839849497589199916",
    "speed": 1,
    "pitch": 1
  }
})
headers = {
  'access_token': '{{access_token}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)