FFmpeg 媒体处理 · FFmpeg
压缩降体积NEW
📌 这是什么:降低视频体积。
💡 什么时候用:文件太大、想压小时用。
接口地址
| 用途 | 方法 | 路径 |
|---|---|---|
| 提交任务 | POST | /v1/ffmpeg/compress |
| 查询结果 | GET | /v1/ffmpeg/info?id={taskId} |
⏱ 建议轮询时间:建议每 3~5 秒轮询一次(响应含 progress 0→100),直到 status = succeeded / failed。单任务超时 300 秒、超时退款。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| inputUrl | string | 必填 | 输入媒体 URL,必须为平台 CDN 白名单域名(先用 upload 上传获取) |
| crf | integer | — | 质量参数 [18,32],越大体积越小,默认 26 |
| targetBitrate | string | — | 目标码率 [100k,8000k];与 crf 二选一 |
| webhookUrl | string | — | 完成回调地址(可选) |
请求示例
curl -X POST https://api.cqtai.com/v1/ffmpeg/compress \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{ "inputUrl": "https://cdn.novapi.ai/tmp/video.mp4", "crf": 28 }'
# -> { "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.0;1 分钟 720P ≈ 3 积分(× 你的用户费率)。任务失败自动退回。