task_id。task_id 调用“查询任务结果”接口,直至 status 为 completed,从 output.file_url 获取结果音频地址。track 保留目标音轨。输入支持音频文件,也可直接传入带音轨的视频。参数名 | 必选 | 类型 | 描述 |
audio_url | 是(与 video_url 二选一) | string | 输入音频地址,支持 http(s) 公网 URL 或 data:audio/...;base64,... 形态。 |
video_url | 否(与 audio_url 二选一) | string | 输入视频地址,用于直接处理带音轨的视频;与 audio_url 同时传入时以 video_url 为准。 |
track | 是 | array of string | 输出音轨。 Vocal:人声(或演唱);Background:背景声(或伴奏);Sound 音效(仅 Normal 场景)。 |
scene | 否 | string | 内容场景。 Normal(默认):人声背景声分离;Music:演唱伴奏分离。 |
container | 否 | string | 输出封装格式。 m4a(默认)/ mp3 / flac / ogg。 |
codec | 否 | string | 输出音频编码。 aac(默认)/ mp3 / flac / ac3。 |
sample_rate | 否 | integer | 输出采样率。 44100(默认)/ 32000 / 48000。 |
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/audio-separate' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"audio_url": "https://example.mp3","container": "m4a","codec": "aac","sample_rate": 44100,"track": ["Vocal"],"scene": "Normal"}'
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/audio-separate' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"video_url": "https://example.mp4","track": ["Background"],"scene": "Music"}'
参数名 | 类型 | 描述 |
task_id | string | 任务唯一标识,用于调用查询接口轮询。 |
status | string | 任务状态。 |
request_id | string | 唯一请求标识,排查问题时请携带。 |
{"task_id": "1400000001-procedurev2-xxxxxxxx","status": "queued","request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9"}
status 为 completed 或 failed。GET https://tokenhub.tencentmaas.com/v1/wand/tool/audio-separate/tasks/{task_id}参数名 | 必选 | 类型 | 描述 |
task_id | 是 | string | 路径参数。提交接口返回的任务 ID,需原样传入。 |
curl -X GET 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/audio-separate/tasks/1400000001-procedurev2-xxxxxxxx' \\-H 'Authorization: Bearer YOUR_API_KEY'
参数名 | 类型 | 描述 |
task_id | string | 任务唯一标识。 |
status | string | 任务状态: queued / in_progress / completed / failed。 |
progress | integer | 处理进度,0~100。 |
output | object | 结果产物,仅 completed 时返回。 |
output.file_url | string | 结果音频地址,可直接下载或播放。 |
error | object | 失败详情,仅 failed 时返回。 |
error.code | string | 错误码,见“统一错误码”。 |
error.message | string | 错误描述,用于排查,不建议用于程序逻辑判断。 |
request_id | string | 唯一请求标识,排查问题时请携带。 |
{"task_id": "1400000001-procedurev2-xxxxxxxx","status": "completed","progress": 100,"output": {"file_url": "https://example.m4a"},"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"}
{"task_id": "1400000001-procedurev2-xxxxxxxx","status": "failed","progress": 100,"error": {"code": "InternalError","message": "internal error"},"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"}
{"request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9", "error": {"message": "...", "type": "..."}}
HTTP | type | 含义 |
400 | invalid_request_error | 参数错误: audio_url / video_url 缺失或互斥冲突、track 缺失或取值非法、scene / container / codec / sample_rate 枚举值非法、JSON 解码失败、task_id 格式非法、任务不存在。按 message 修正请求后重试。 |
401 | invalid_api_key | API Key 缺失或无效,请检查请求头 Authorization。 |
404 | not_found | 请求路径不存在,请检查路径拼写。 |
405 | method_not_allowed | 请求方法不允许(提交需 POST、查询需 GET)。 |
429 | rate_limit_exceeded | 触发 QPS 限频(提交默认 20 QPS、查询默认 100 QPS),请降低频率后重试。 |
429 | quota_exceeded | 配额用尽,请稍后重试或申请提升配额。 |
500 | server_error | 服务内部错误,可重试;持续出现请携带 Request ID 提工单排查。 |
status: failed,error.code 取值如下:错误码 | 含义 |
InvalidParameterValue | 参数不合法(如 track / scene 取值、编码与封装不兼容、源文件缺少可用音轨),请检查入参。 |
InternalError | 服务内部错误,可重试;持续出现请携带 Request ID 提工单排查。 |
audio_url;需要直接处理带音轨的视频传 video_url。同时传入时以 video_url 为准。m4a、编码 aac、采样率 44100。Vocal(人声)、Background(背景音乐)、Sound(音效, 仅 Normal 场景支持)。Normal 场景支持 5 种组合:["Vocal"]、["Background"]、["Sound"]、["Background","Sound"](去人声)、["Vocal","Sound"](去背景音乐);Music 场景支持 2 种组合:["Vocal"]、["Background"]。文档反馈