FFmpeg 媒体处理 · FFmpeg
裁剪片段NEW
📌 这是什么:截取视频的一段时间区间。
💡 什么时候用:只想保留某段时间时用。
接口地址
| 用途 | 方法 | 路径 |
|---|---|---|
| 提交任务 | POST | /v1/ffmpeg/trim |
| 查询结果 | GET | /v1/ffmpeg/info?id={taskId} |
⏱ 建议轮询时间:建议每 3~5 秒轮询一次(响应含 progress 0→100),直到 status = succeeded / failed。单任务超时 300 秒、超时退款。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| inputUrl | string | 必填 | 输入媒体 URL,必须为平台 CDN 白名单域名(先用 upload 上传获取) |
| start | number | 必填 | 起始时间(秒,≥0) |
| end | number | 必填 | 结束时间(秒,>start) |
| webhookUrl | string | — | 完成回调地址(可选) |
请求示例
curl -X POST https://api.cqtai.com/v1/ffmpeg/trim \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{ "inputUrl": "https://cdn.novapi.ai/tmp/video.mp4", "start": 10, "end": 25 }'
# -> { "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
}
}计费与积分
系数 0.3,按输出时长 end-start 计(× 你的用户费率)。任务失败自动退回。