Skip to main content

MCP server for AI-powered video subtitle generation and merging using Volcano Engine speech recognition

Project description

视频-AI加字幕 MCP Server

MCP server for AI-powered video subtitle generation and merging using Volcano Engine speech recognition.

Features

  • generate_subtitle: Generate SRT subtitle file from video URL using AI speech recognition
  • merge_subtitle: Burn subtitles into video with customizable styling (color, size, position)

Installation

pip install mcpcn-video-ai-subtitle-mcp

Environment Variables

  • VOLCANO_APPID: Volcano Engine App ID
  • VOLCANO_ACCESS_TOKEN: Volcano Engine Access Token
  • FFMPEG_BINARY: (Optional) Path to ffmpeg binary
  • FFPROBE_BINARY: (Optional) Path to ffprobe binary

Usage

MCP Configuration

{
  "mcpServers": {
    "video-ai-subtitle": {
      "command": "uvx",
      "args": ["mcpcn-video-ai-subtitle-mcp"],
      "env": {
        "VOLCANO_APPID": "your-app-id",
        "VOLCANO_ACCESS_TOKEN": "your-access-token"
      }
    }
  }
}

License

MIT

音视频字幕 API(简化版)

概述

  • 功能:提交音/视频生成字幕任务,并查询字幕结果
  • 扣费:在“查询成功返回”时按时长扣积分(VIP也扣)
  • 去重:同一 volcano_task_id 仅扣一次

鉴权

  • Header:x-token: <用户登录令牌>
  • 所有接口需登录态

计费与积分

  • 换算:1分钱 = 2积分1元 = 200积分
  • 阶梯单价(按当月累计小时数选择单价):
    • 0~300 小时:6.5 元/小时 → 1300 积分/小时
    • 301~1000 小时:6 元/小时 → 1200 积分/小时
    • 1001~3000 小时:5.6 元/小时 → 1120 积分/小时
    • 3001~5000 小时:5 元/小时 → 1000 积分/小时
    • 5001+ 小时:4 元/小时 → 800 积分/小时
  • 扣费时机:查询成功(code=0/message=Success)且解析到时长后扣费
  • 时长解析顺序:
    • data.duration(单位秒,优先)
    • data.utterancesstart_time/end_time(单位毫秒,取整段范围,换算为秒)
    • 兼容旧格式:result.durationresult.segmentsresult.subtitles
  • 扣减优先级:FreePointsVipPointsPoints
  • 去重规则:积分流水 reason 前缀为 视频字幕生成 volcano_task_id=<id> 的记录存在即视为已扣

接口列表

1) 提交任务

  • Method:POST
  • URL:/api/translate/videoCaption/submit
  • Header:x-token: <用户登录令牌>
  • Body(JSON):
    • url 必填,媒体地址
    • words_per_line 可选,默认 46
    • max_lines 可选,默认 1
    • language 可选,默认 zh-CN
    • caption_type 可选,默认 auto
    • use_itnuse_puncuse_ddcwith_speaker_info 可选,默认 false
  • Response(JSON):
    • 成功:{"code":0,"data":{"id":"<taskId>"}}
    • 失败:{"code":非0,"msg":"提交失败: <原因>"}

示例:

POST /api/translate/videoCaption/submit
{
  "url": "https://example.com/media.mp4",
  "language": "zh-CN",
  "caption_type": "auto"
}

2) 查询结果并扣费

  • Method:GET
  • URL:/api/translate/videoCaption/query?id=<taskId>&blocking=1
  • Header:x-token: <用户登录令牌>
  • Query:
    • id 必填,任务 ID
    • blocking 可选,1 表示阻塞等待(建议)
  • Response(JSON):
    • 成功:返回第三方原始数据(含 data.durationdata.utterances
    • 失败:{"code":非0,"msg":"查询失败: <原因>"}

示例返回(节选):

{
  "code": 0,
  "data": {
    "code": 0,
    "message": "Success",
    "duration": 18.13575,
    "id": "88620edc-9be1-432b-8476-8a84986c578e",
    "utterances": [
      { "start_time": 1200, "end_time": 2020, "text": "飞书," },
      { "start_time": 12120, "end_time": 13420, "text": "打开飞书," }
    ]
  },
  "msg": "成功"
}

扣费示例(积分流水)

  • 记录格式:
    • Type: translate
    • Reason: 视频字幕生成 volcano_task_id=<id> duration_seconds=<秒> price_per_hour=<单价>
    • Remark: 扣减明细:<免费+VIP+普通>
  • 示例(实际库中记录):
INSERT INTO `sys_user_points`
(`id`,`created_at`,`updated_at`,`deleted_at`,`user_id`,`change`,`reason`,`project_id`,`project_tool_id`,`type`,`model_id`,`usage_log_id`,`order_id`,`remark`,`task_id`,`user_task_id`,`redeem_code_id`,`membership_id`)
VALUES
(15504,'2025-12-11 17:31:37.242','2025-12-11 17:31:37.242',NULL,49,-7,'视频字幕生成 volcano_task_id=88620edc-9be1-432b-8476-8a84986c578e duration_seconds=18 price_per_hour=6.5',0,0,'translate',0,0,0,'扣减明细:7(VIP)',0,0,0,0);

注意事项

  • 返回成功且可解析到时长才扣费;否则不扣
  • 同一任务仅扣一次;重复查询不重复扣费
  • blocking=1 推荐使用,以便拿到完整结果和及时扣费

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpcn_video_ai_subtitle_mcp-0.1.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcpcn_video_ai_subtitle_mcp-0.1.4-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file mcpcn_video_ai_subtitle_mcp-0.1.4.tar.gz.

File metadata

File hashes

Hashes for mcpcn_video_ai_subtitle_mcp-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7a9b36c135dd864b187aea3bc7364a5a0d8e0ba284e15f001ee85de3c9de8179
MD5 800dc3b688e65457dba782cc21aab3a0
BLAKE2b-256 3058880275253fd559e632dba1f7dc0b273f9c084bd1a851e8123a1e1204171d

See more details on using hashes here.

File details

Details for the file mcpcn_video_ai_subtitle_mcp-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mcpcn_video_ai_subtitle_mcp-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 becf0c3198605b15123a5a794091cde2fcf73bea9a5022211d670be0ff6bb2dd
MD5 02445ed636d8c4096b1bf76a59449e05
BLAKE2b-256 d4816d84077ee58bd4c49768da05b20b6eb1e0637d2d8f236e78d15b88568317

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page