Skip to main content

视频-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 推荐使用,以便拿到完整结果和及时扣费

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.5.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.5-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.5.tar.gz.

File metadata

File hashes

Hashes for mcpcn_video_ai_subtitle_mcp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 075b319464eb353a8f8b2a89a69fcaa4e8b848416c168ba885e2c8e003e2e855
MD5 fa86cd6ae440563a5978ada3891e6d13
BLAKE2b-256 9ac797d905b7dc6f035265d47f8a8f22312014ba615260a605bcb3330ac0b220

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcpcn_video_ai_subtitle_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dd4c7e3baa7312b904421a0577f09184bb69e3dcf30e964edcb897b42305e222
MD5 8dbb366d9bba780753aa499b43c7944e
BLAKE2b-256 46ac2c6f553f36a69bfff45ee8df487ccd0d4c3540b4903ab794e3d0ab01b8c7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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