视频处理 Open API

提交公网视频链接创建去字幕或去水印 Pro 任务,使用任务查询接口获取处理结果。

本接口主要面向极客用户、自动化脚本和定制化工作流接入,不建议将其简单包装后二次出售或作为独立服务转售。

异步任务

接入速览

基础路径/open
认证方式userNo + apiKey
请求格式application/x-www-form-urlencoded
开放能力去字幕 / 去水印 Pro
任务状态waiting / processing / success / failed

接入流程

1

获取 API Key

点击右上角个人中心,进入 Open API Key 设置页面生成密钥;完整 Key 只展示一次,请妥善保存。

2

查询积分余额

调用 queryCredits 预估当前账号是否具备提交任务的积分。

3

提交处理任务

按功能调用去字幕或去水印 Pro 提交入口,接口立即返回 taskId。

4

轮询任务状态

调用 taskDetail 或 taskList 查询 waiting、processing、success、failed 状态。

5

获取处理结果

任务成功返回 resultUrl,失败返回 failReason;去字幕可选 callbackUrl 回调。

认证与公共参数

Content-Type: application/x-www-form-urlencoded
userNo=xxxx
apiKey=sk-fxpc-xxxxxxxxxxxxxxxxxxxxxxxx

接口说明

POST /open/submitTask提交公网视频链接并创建异步去字幕任务。
模型与消除方式
curl -X POST 'https://api.example.com/open/submitTask' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'userNo=9999999' \
  --data-urlencode 'apiKey=sk-fxpc-xxx' \
  --data-urlencode 'videoUrl=https://example.com/video.mp4' \
  --data-urlencode 'width=1280' \
  --data-urlencode 'height=720' \
  --data-urlencode 'duration=30' \
  --data-urlencode 'size=10485760' \
  --data-urlencode 'x1=0' \
  --data-urlencode 'y1=600' \
  --data-urlencode 'x2=1280' \
  --data-urlencode 'y2=720' \
  --data-urlencode 'model=strong' \
  --data-urlencode 'processMode=range'

代码示例

以下示例使用表单格式提交去水印 Pro 任务,并按返回的 taskId 查询处理结果。

const API_BASE = 'https://api.example.com'
const userNo = '9999999'
const apiKey = 'sk-fxpc-xxx'

async function openPost(path, data) {
  const body = new URLSearchParams({ userNo, apiKey, ...data })
  const res = await fetch(API_BASE + path, {
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body
  })
  const json = await res.json()
  if (json.code !== 200) throw new Error(json.message || 'Open API error')
  return json
}

const task = await openPost('/open/videoWatermarkPro/submitTask', {
  videoUrl: 'https://example.com/video.mp4',
  duration: '30',
  width: '1280',
  height: '720',
  size: '10485760',
  maskAreas: JSON.stringify([{ x: 100, y: 500, width: 300, height: 80 }]),
  originalFileName: 'test.mp4'
})

console.log('taskId:', task.taskId)

const detail = await openPost('/open/taskDetail', { taskId: task.taskId })
console.log(detail.status, detail.resultUrl || detail.failReason || '')

错误码与注意事项

  • videoUrl 必须是公网可访问地址,不支持内网、localhost、登录态链接和临时本地网络地址。
  • 提交接口为异步创建任务,返回 taskId 后请通过任务详情或任务列表查询进度。
  • taskId 带有任务类型前缀,例如 videoRemove:531454 或 videoWatermarkPro:531454。
  • 稳定模型不支持反选处理;需要反选时请使用 model=strong 且 processMode=inverse。
  • 视频去字幕和去水印 Pro 均按 3 积分/秒计费,最终以任务详情 cost 为准。
  • 去字幕任务的 width、height、duration、size 请按视频真实信息填写;填写不准确可能导致任务提交失败。
  • callbackUrl 当前仅去字幕任务支持;去水印 Pro 请通过任务详情或任务列表查询结果。