FFmpeg 媒体处理 · FFmpeg
带转场拼接NEW
📌 这是什么:按顺序拼接多段视频,并可在指定接缝上做交叉淡化或压黑过渡,支持片头淡入、片尾淡出。
💡 什么时候用:想让镜头之间平滑过渡、而不是每个接缝都硬切时用。逐条接缝指定转场类型;全部设为 none 且无头尾淡化时,等价于 concat 的零重编码快通道。
接口地址
| 用途 | 方法 | 路径 |
|---|---|---|
| 提交任务 | POST | /v1/ffmpeg/concat_transition |
| 查询结果 | GET | /v1/ffmpeg/info?id={taskId} |
⏱ 建议轮询时间:建议每 3~5 秒轮询一次(响应含 progress 0→100),直到 status = succeeded / failed。status = queued 表示已入队、排队等待执行(尚未扣费),继续轮询即可。单任务超时 300 秒、超时退款。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| inputUrls | string[] | 必填 | 视频 URL 数组,2~500 个,按播放顺序 |
| transitions | object[] | 必填 | 接缝转场数组,长度恰为 inputUrls 长度 − 1;每项 { index: 0..N-2 升序, kind: none / crossfade / dip, durationMs: 毫秒(none 为 0) }。crossfade 按重叠缩短总时长,dip 压黑淡入淡出、不改总时长 |
| headFadeInMs | integer | — | 片头从黑淡入时长(毫秒),默认 0,不改总时长 |
| tailFadeOutMs | integer | — | 片尾淡出到黑时长(毫秒),默认 0,不改总时长 |
| webhookUrl | string | — | 完成回调地址(可选) |
请求示例
curl -X POST https://api.cqtai.com/v1/ffmpeg/concat_transition \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{ "inputUrls": ["https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4", "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4", "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4"], "transitions": [{ "index": 0, "kind": "crossfade", "durationMs": 300 }, { "index": 1, "kind": "none", "durationMs": 0 }], "headFadeInMs": 500, "tailFadeOutMs": 500 }'
# -> { "code":200, "data":"<taskId>" }响应示例
{
"code": 200,
"msg": "success",
"data": {
"taskId": "<taskId>",
"operation": "transcode",
"status": "succeeded",
"progress": 100,
"resultUrl": "https://cdn.novapi.ai/ffmpeg/xxx.mp4",
"costPoints": 3,
"errorMsg": null
}
}