agentleFS
smiling66652smiling66652/workbuddy-skill-toolkits/local-video-pipeline/SKILL.md

local-video-pipeline

Skill1 starsChanged 48 days agoMITView on GitHub

纯 CPU 本地合成口播视频:文案txt → sherpa-onnx中文配音 → Pillow封面卡片 → 文案直出字幕 → ffmpeg合成1080p MP4,全程离线。触发词:做视频、口播视频、出片、视频合成、配音视频。

Files
SKILL.md

技能|本地视频合成流水线法

当用户需要把文字文案做成带配音、字幕的口播视频(且要求本地/离线/不用 GPU)时,按以下步骤执行:

〇、环境检查(首次使用必做)

  1. 确认流水线根目录(含 bin/ffmpeg.exe、models/、make_video.py)。默认 D:\LocalLLM\video,可用环境变量 VIDEO_PIPELINE_HOME 覆盖。
  2. 若环境缺失,按「二、依赖安装」补齐;Python 解释器用 WorkBuddy 托管 venv(本机:C:\Users\Administrator\.workbuddy\binaries\python\envs\default\Scripts\python.exe,含 Pillow)。

一、出片命令(核心用法)

  1. 让用户确认文案:每行一句(一行=一张卡片+一段配音),句末用。!?;均可,流水线会再细切;单行建议 ≤60 字。
  2. 执行:
    <venv-python> <VIDEO_PIPELINE_HOME>/make_video.py <输出.mp4> <标题> <副标题> <文案.txt>
  3. 交付文件命名带版本号(如 xxxV1.1.mp4),不覆盖旧版。

二、依赖安装(换机重建时按此执行)

组件来源要点
ffmpeg 7.1pip 装 imageio-ffmpeg(清华镜像),从 site-packages 把 ffmpeg-win-x86_64-*.exe 复制为 <home>/bin/ffmpeg.exe免 GitHub
TTS 引擎pip sherpa-onnx(清华镜像)新版 API 用 OfflineTtsConfig(VitsModelConfig(...)) 构造,老 kwargs 写法会 TypeError
TTS 模型sherpa-onnx releases 的 vits-piper-zh_CN-huayan-medium.tar.bz2(67MB)解压到 <home>/models/GitHub 直连/ghfast.top 常失败,用 https://gh-proxy.com/ 前缀代理
备用 ASRpip faster-whisper + hf-mirror 下 Systran/faster-whisper-small(483MB)到 <home>/models/faster-whisper-small/仅给外部录音上字幕
字体Windows 自带微软雅黑(msyh.ttc / msyhbd.ttc)缺失时封面会退化

三、注意边界

  • 字幕必须文案直出,禁止用 whisper-small 转自己的 TTS 音频——实测错字率很高("承接"→"产阶"级);whisper 仅用于外部录音,且建议 medium 模型(1.5GB)。
  • ffmpeg subtitles 滤镜在 Windows 下绝对路径冒号转义必炸(Unable to parse option value ... as image size);脚本已用 cwd+相对路径规避,改脚本时勿回退。
  • 长句自动换行显示,但配音不分段——单行 ≤60 字。
  • 数字读法:文案里写成中文数字("一百二十")比阿拉伯数字朗读更稳。
  • 内存:TTS+whisper 共约 1GB,可与常驻大模型服务并存;运行时不要再加载其他大模型。

四、反例避雷

反例后果正确做法
直接 GitHub 直连下模型卡死或 0 字节gh-proxy.com 前缀代理,或 hf-mirror
whisper 生成 TTS 音频字幕错字满屏文案直出 SRT(流水线已内置)
subtitles 滤镜写 D:/绝对路径original_size 解析报错cwd + 相对路径(已内置)
文案一行塞整段 500 字卡片挤满、配音一气到底一行一句,每行 ≤60 字
覆盖旧 mp4 文件名版本丢失文件名带版本号递增

五、版本记录

版本日期变更
v1.0.02026-09-16首版:文案→TTS→卡片→字幕→ffmpeg 五步流水线,端到端 25.3s 样例验证通过
v1.0.12026-09-16按开放平台规范重构 frontmatter;脚本路径改为 VIDEO_PIPELINE_HOME 环境变量可配置

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.