cjp260713

Cjp260713: A complete tool to convert video speech to subtitles and embed them into video. Used to extract speech from video to generate subtitles, refine subtitle text (traditional-to-simplified conversion, error correction, punctuation, sentence segmentation), or burn subtitles into video and export MP4; supports Chinese speech recognition.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "cjp260713" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4dae798a5603466601a7c8f351103ed422da2ba62f5158f01560b9a727427cfa. Verify the upstream source and version against https://skillhub.cn/skills/user_326e3d8e/cjp260713 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Cjp260713: A complete tool to convert video speech to subtitles and embed them into video. Used to extract speech from video to generate subtitles, refine subtitle text (traditional-to-simplified conversion, error correction, punctuation, sentence segmentation), or burn subtitles into video and export MP4; supports Chinese speech recognition.

0 Downloads

Introduction source: third_party · user_326e3d8e · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: 视频字幕优化工具
description: 视频语音识别转字幕并嵌入视频的完整工具。当用户需要从视频中提取语音生成字幕、优化字幕文本(繁体转简体、纠错、标点、断句)、或将字幕烧录到视频中输出 MP4 时使用此 skill。支持中文语音识别。
agent_created: true

视频字幕优化工具

概述

从视频文件出发,完成以下完整流程:

  1. 音频提取 → 2. Whisper 语音识别 → 3. SRT 字幕生成 → 4. 字幕优化(繁转简、纠错、标点、断句、时长)→ 5. 字幕嵌入视频输出 MP4

目录结构

video-subtitle-optimizer/
├── SKILL.md                    # 本文件
├── scripts/
│   ├── video_to_subtitle.py    # 主流程脚本(音频提取→识别→生成→优化→SRT输出)
│   └── fix_subtitle.py         # 附加修正脚本(繁转简 + 自定义纠错)

前置依赖

在执行任何步骤前,确保以下 Python 包已安装:

pip install openai-whisper zhconv imageio-ffmpeg

工作流

第 1 步:运行主流程脚本(语音识别 + SRT 生成)

python scripts/video_to_subtitle.py <视频路径> --model small --language zh --max-line-length 40 --keep-audio

参数说明:

  • --model — Whisper 模型(tiny/base/small/medium/large,默认 medium)
  • --language — 语言代码(默认 zh,英文用 en)
  • --max-line-length — 每行最大字符数(默认 40)
  • --keep-audio — 保留提取的 WAV 音频文件
  • --no-optimize — 跳过优化,只输出原始 SRT
  • --optimize-only — 只优化已有 SRT,不重新识别

注意事项:

  • Windows 环境需要将 ffmpeg 加入 PATH。用以下方式确保:
    import imageio_ffmpeg, shutil, os
    ffmpeg_path = imageio_ffmpeg.get_ffmpeg_exe()
    python_dir = os.path.dirname(r"C:\path\to\python.exe")
    shutil.copy2(ffmpeg_path, os.path.join(python_dir, "ffmpeg.exe"))
  • 或者运行一次脚本,它会自动将 ffmpeg 添加到 PATH(已在脚本中处理)

第 2 步:字幕修正(繁体→简体 + 自定义纠错)

python scripts/fix_subtitle.py

默认修正内容:

  • 繁体中文 → 简体中文(使用 zhconv)
  • WalkBody/walkbody/workbody → WorkBuddy/workbuddy
  • 3wcodebody.cnwalk → www.workbuddy.cn
  • 灯路/灯录 → 登录,接面/介面 → 界面
  • 非书 → 飞书,叮叮 → 钉钉
  • 按的 → ARM
  • 独立单词 pt → prompt(正则匹配,避免内嵌误替换)

若要自定义纠错映射表,修改 fix_subtitle.py 中的 REPLACEMENTS 列表。

第 3 步:将字幕嵌入视频输出 MP4

由于 ffmpeg 的 subtitles 过滤器在 Windows 下对含空格和冒号的路径解析有问题,必须先将文件复制到无空格的临时目录:

# 复制到临时目录
cp "输入视频.mp4" "C:\Users\xxx\AppData\Local\Temp\sub_video.mp4"
cp "输入字幕.srt" "C:\Users\xxx\AppData\Local\Temp\sub_srt.srt"

# 执行编码(需 cd 到临时目录)
cd "C:\Users\xxx\AppData\Local\Temp"
ffmpeg -i sub_video.mp4 -vf "subtitles=f=sub_srt.srt:original_size=宽x高" -c:a copy -y sub_output.mp4

# 复制回项目目录
cp sub_output.mp4 "输出视频_带字幕.mp4"

关键参数:

  • original_size=宽x高 — 必须设置为视频原始分辨率(如 2160x1080),否则 ffmpeg 报错
  • 字幕字体由 libass + DirectWrite 自动选择微软雅黑(Microsoft YaHei UI)渲染中文

完整一键流程(Python 封装)

使用 scripts/video_to_subtitle.py 的 --optimize-only 模式或直接改造调用链。推荐步骤:

import subprocess
from pathlib import Path

# 1. 复制文件到无空格路径
temp_dir = Path(os.environ["TEMP"]) / "sub_temp"
temp_dir.mkdir(exist_ok=True)
shutil.copy2(video_path, temp_dir / "input.mp4")
shutil.copy2(srt_path, temp_dir / "sub.srt")

# 2. 执行 ffmpeg
ffmpeg = "ffmpeg"
cmd = [
    ffmpeg, "-i", str(temp_dir / "input.mp4"),
    "-vf", f"subtitles=f=sub.srt:original_size={width}x{height}",
    "-c:a", "copy", "-y",
    str(temp_dir / "output.mp4")
]
subprocess.run(cmd, cwd=str(temp_dir), check=True)

# 3. 复制结果
shutil.copy2(temp_dir / "output.mp4", output_path)

常见问题

Q: ffmpeg 提示 "Unable to parse option value" 错误

原因: subtitles 过滤器无法正确解析 Windows 路径中的冒号(如 C:\...)或空格。 解决: 使用 f=文件名 语法 + original_size=宽x高,且路径不能有空格。推荐复制到 TEMP 目录后用相对路径。

Q: Whisper 显示 FP16 not supported on CPU

原因: CPU 不支持 FP16,Whisper 会自动退化为 FP32,不影响结果,只是稍慢。

Q: 字幕是繁体中文

原因: Whisper 的输出取决于输入语音的用字习惯。 解决: 运行 scripts/fix_subtitle.py 自动转换为简体。

Q: 想手动修改某条字幕

解决: 直接用文本编辑器打开 *_optimized.srt,找到对应时间段的文本行修改,然后重新执行第 3 步。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value90/100

Highlights

  • 解决视频字幕生成与优化的完整流程,覆盖音频提取、语音识别、字幕优化、字幕嵌入等核心痛点
  • 支持中文语音识别和繁简转换,满足中文用户特定需求
  • 提供端到端示例和常见问题解决方案,实用性强
Trigger Precision85/100

Highlights

  • description 明确描述了使用场景和核心功能,触发词精准完整
  • 覆盖多种变体,边界清晰,用户能准确理解 Skill 的用途
Structure and Standards88/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件≤500行,目录结构、前置依赖、工作流、常见问题等章节完整
Execution Reliability82/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常
  • 不可逆操作有确认机制,脚本路径明确,异常处理建议合理
Evidence Verifiability (mean of the first four)86/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 29
  • Invoke commands or scripts

    Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.

    Mentioned in main document · lines 118

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.