FFmpeg 媒体处理 · FFmpeg
叠加水印NEW
📌 这是什么:在视频上叠加图片水印。
💡 什么时候用:想加 logo / 版权标识时用。
接口地址
| 用途 | 方法 | 路径 |
|---|---|---|
| 提交任务 | POST | /v1/ffmpeg/watermark |
| 查询结果 | GET | /v1/ffmpeg/info?id={taskId} |
⏱ 建议轮询时间:建议每 3~5 秒轮询一次(响应含 progress 0→100),直到 status = succeeded / failed。单任务超时 300 秒、超时退款。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| inputUrl | string | 必填 | 输入媒体 URL,必须为平台 CDN 白名单域名(先用 upload 上传获取) |
| imageUrl | string | 必填 | 水印图片 URL(白名单域名) |
| position | string | — | 位置:tl / tr / bl / br / center,默认 br |
| opacity | number | — | 透明度 [0,1],默认 1.0 |
| margin | integer | — | 边距像素 [0,200],默认 10 |
| webhookUrl | string | — | 完成回调地址(可选) |
请求示例
curl -X POST https://api.cqtai.com/v1/ffmpeg/watermark \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{ "inputUrl": "https://cdn.novapi.ai/tmp/video.mp4", "imageUrl": "https://cdn.novapi.ai/tmp/logo.png", "position": "br", "opacity": 0.8, "margin": 20 }'
# -> { "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
}
}计费与积分
系数 1.3;1 分钟 720P ≈ 4 积分(× 你的用户费率)。任务失败自动退回。