技能图谱SKILLSGROVE
技能图谱/视频制作/xiaotianfotos/OPC/opc

opc

安装

$npx skills add https://github.com/xiaotianfotos/OPC --skill opc
$git clone --depth 1 https://github.com/xiaotianfotos/OPC.git /tmp/OPC && mkdir -p ~/.claude/skills && cp -r /tmp/OPC/opc-cli ~/.claude/skills/opc
请帮我安装这个 Agent Skill:https://github.com/xiaotianfotos/OPC/tree/3f49d315ae590b109a68850b99a2468b3adbc51a/opc-cli ,先阅读它的 SKILL.md 和脚本,确认安全后再安装到我的技能目录。

简介

原文描述 · Apache-2.0多引擎 AI 创作工具链。TTS 语音合成、ASR 与字幕、MiniMax Music3 音乐生成、音频压缩分析、ComfyUI 图片生成与编辑、MiniMax H3 和 LTX 视频生成、SeedVR2 超分、视频转录/理解和字幕级剪辑。使用场景:(1) 文本转语音,(2) 音频转录与字幕,(3) 音乐生成与音频处理,(4) AI 图片生成和编辑,(5) H3 文生视频/图生视频/全能参考视频,(6) LTX 图生视频与首尾帧视频,(7) 视频超分、理解和剪辑。触发词:语音、TTS、ASR、字幕、音乐生成、Music3、音频压缩、图片生成、图片编辑、视频生成、H3、LTX、SeedVR2、视频理解、prompt、知识图谱、KG、视频剪辑
以下 SKILL.md 内容转载自 xiaotianfotos/OPC(提交 3f49d31),依据 Apache-2.0 许可证转载正文(文字未改动;仅省略文件头元数据、将图片显示为链接,超长内容会截断);版权归 owner or entity authorized by 所有。许可证:LICENSE。仅展示说明文件,附带脚本请在原仓库查看。

opc - AI 创作工具链

TTS + ASR + 音频处理 + AI 图片生成/编辑 + MiniMax H3/LTX 视频生成与理解 + 视频剪辑。

环境安装

curl -LsSf https://astral.sh/uv/install.sh | sh
cd ~/.claude/skills/opc-cli
uv sync

跨平台:Linux 用 CUDA,macOS 用 MLX,命令一致。

模型下载源:

opc config --set-model-source modelscope   # 默认
opc config --set-model-source huggingface  # 备选
opc config --set-model-cache-dir /vol2/1000/llm/models

快速开始

opc discover --set-default          # 发现播放设备
opc tts "你好" -e edge-tts          # 生成语音
opc say "你好"                       # 生成并播放
opc asr audio.mp3 --format srt      # 生成字幕
opc music --caption "Warm indie pop" --lyrics-file lyrics.txt  # 生成音乐
opc image -w ernie-turbo -p "a cat"  # AI 生图
opc video -w h3-t2v -p "a rainy neon street"  # H3 视频
opc video-gen i2v --image frame.png -p "slow camera push-in"  # 图生视频
opc image kg skeleton subject:food style:photography  # KG prompt 规划

所有命令通过 uv run python scripts/opc.py 执行。

TTS 命令

opc tts <text> — 生成语音文件

opc tts "你好" -e edge-tts                           # edge-tts
opc tts "你好" -e edge-tts --rate +20% --pitch +5Hz  # 带语速/音调
opc tts "你好" -e qwen --speaker Vivian              # qwen 内置音色
opc tts "你好" -e qwen --instruct "用愤怒的语气说"    # 情绪指令
opc tts "你好" -e qwen --mode voice_design --instruct "温柔的女声"  # 声音设计
opc tts "你好" -e qwen --mode voice_clone --ref-audio ref.wav --ref-text "参考"  # 克隆

参数: -e 引擎(edge-tts|qwen)、-v 音色、-l 语言、-o 输出路径、--stdin 从 stdin 读 edge-tts: --rate、--pitch、--volume qwen: -m 模式(custom_voice|voice_design|voice_clone)、-s 音色、-i 情绪指令、--ref-audio、--ref-text

opc say <text> — 生成并播放

参数同 tts,额外 -d 指定播放设备。

opc voices / opc discover

opc voices -e edge-tts   # 322 个音色
opc voices -e qwen       # 9 个内置音色
opc discover --set-default

ASR Pipeline

4 阶段 Pipeline:ASR + Forced Alignment → Sentence Breaking → CSV Fix → Render

opc asr audio.mp3                    # 转录到 stdout
opc asr audio.mp3 --format srt       # 生成 SRT + ASS
opc asr audio.mp3 --format json -o result.json
opc asr audio.mp3 --format srt --fix-dir ./fixes             # CSV 修正
opc asr audio.mp3 --format srt --resume-from break           # 从断句阶段恢复

参数: --format(text|json|srt|ass)、--language、--model-size(1.7B|0.6B)、--style、--fix-dir、--resume-from(asr|break|fix|render)

断句规则

两遍扫描:Pass 1 按句号分段,Pass 2 按逗号断行。没有标点绝对不断行。 超长行由 Check 标记,用 opc asr-split 手动拆分:

opc asr-split audio.lines.json --line 10 --after "理解,"
opc asr audio.mp3 --format srt --resume-from render

CSV 修正格式

在 --fix-dir 放 fix_1.csv, fix_2.csv...,格式:原文本,新文本(新文本留空=删除行)。# 开头为注释。

Image 命令

AI 图片生成 + 图片编辑 + Prompt 知识图谱 + 模板系统。详见 references/image.md。

工作流从 ~/.opc_cli/opc/workflows/ 和仓库内置目录合并发现,用户目录中的同名 alias 优先。用 opc image list 查看本机实际可用的图片和视频工作流。

核心流程:

opc image list                                        # 列出可用工作流
opc image -w ernie-full -p "..."                      # 文生图
opc image -w ideogram4 --text -p "poster design"       # Ideogram 4 生图
opc image-edit --image photo.png -p "add a red hat"   # 图片编辑
opc image kg skeleton subject:food style:photography   # KG 规划
opc image analyze output.png --describe               # 分析

opc image list / info / import — 工作流管理

opc image list                    # 列出可用工作流
opc image info ernie-turbo        # 查看工作流参数详情
opc image import workflow.json --name my-workflow  # 导入工作流

opc image analyze — 图片/工作流分析

opc image analyze output.png --describe     # 视觉模型描述图片
opc image analyze output.png --describe --compare ref.png  # 对比两张图片
opc image analyze workflow.json             # 分析工作流 JSON 结构

opc image test — 工作流连通性测试

opc image test ernie-turbo --prompt "test image"  # 测试工作流连通性

opc image — 文生图

opc image -w ernie-turbo -p "a cat sitting on a windowsill"
opc image -w ernie-full -p '{"subject":"美食摄影","style":"photography"}'
opc image -w klein -p "a beautiful landscape"

参数: -w 工作流别名、-p 提示词、-P 工作流参数 key=value、--text 纯文本模式

opc image-edit — 图片编辑

基于 Klein-Edit 等工作流的图片编辑,需要提供输入图片和编辑指令。

opc image-edit --image photo.png -p "add a red hat to the person"
opc image-edit -w klein-edit --image photo.png -p "make it look like a painting"
opc image-edit --image ref1.png --image ref2.png -p "blend these two images"
opc image-edit --image photo.png -p "add sunset" --param steps=30 --param seed=42

参数: -w 工作流别名(默认 klein-edit)、--image/-i 输入图片(可多次)、-p 编辑指令(必需)、-P 工作流参数、--text 纯文本模式

opc image kg — Prompt 知识图谱

opc image kg list                              # 列出所有实体分类
opc image kg list --category style             # 按分类筛选
opc image kg info style:photography            # 实体详情
opc image kg search portrait                   # 模糊搜索
opc image kg query style:cyberpunk            # 查询搭配推荐
opc image kg skeleton subject:food lighting:neon  # 生成 prompt 骨架
opc image kg validate subject:cat style:photography lighting:dramatic  # 验证组合
opc image kg similar subject:cat               # 查找相似 prompt
opc image kg templates                         # 列出模板
opc image kg templates --entity style:cyberpunk  # 按实体查模板

Video 命令

视频生成依赖 ComfyUI 工作流。默认 alias 为 ltx-i2v 和 ltx-flf,需先确认它们出现在 opc image list 中。

# 单图动画化
opc video-gen i2v --image frame.png -p "camera slowly zooms in"

# 首尾帧过渡
opc video-gen flf --first-frame start.png --last-frame end.png -p "smooth cinematic transition"

# 更快的蒸馏模式
opc video-gen i2v --image frame.png -p "slow motion" --turbo

# 下载在线视频并用 Qwen3-ASR 转录(需要 yt-dlp 和 ffmpeg)
opc video-transcribe "https://example.com/video"

# 使用 OpenAI-compatible 视觉接口理解本地视频
opc video-describe video.mp4

生成参数: --workflow/-w 工作流、--prompt/-p 运动描述、--param/-P key=value 参数覆盖、--output/-o 输出目录、--turbo 快速模式。

视频理解配置: opc config --set-video-desc-api-url <url>、--set-video-desc-model <name>,API key 可单独设置,也可复用图片视觉模型配置。

Audio 命令

音频压缩与分析工具。

opc audio compress input.mp3 --preset voice   # 人声压缩预设
opc audio compress input.mp3 -t -20 -r 4 -a 10 --release 130  # 自定义参数
opc audio analyze input.mp3                   # 分析响度 (LUFS)
opc audio presets                              # 列出可用预设

压缩参数: -t, --threshold 阈值 dB (默认 -20.0)、-r, --ratio 压缩比 (默认 4.0)、-a, --attack 启动时间 ms (默认 10.0)、--release 释放时间 ms (默认 130.0)、--knee 拐点宽度 dB (默认 0.0)、--makeup 补偿增益 dB (默认 0.0)、--mix 干湿比 0-1 (默认 1.0)、--preset 预设名称

预设: voice 人声优化 (-20dB, 4:1, 10ms, 130ms)、music 音乐轻压缩 (-18dB, 2.5:1, 15ms, 200ms)、limiter 硬限制器 (-6dB, 20:1, 1ms, 50ms)、punch 打击乐冲击感 (-12dB, 6:1, 3ms, 80ms)、gentle 极轻压缩 (-24dB, 1.8:1, 30ms, 300ms)

Music 命令

MiniMax Music3 本地歌曲与纯音乐生成。详细格式与参数见 references/music.md。

创建、改写或扩写 Music3 Caption 时,必须优先使用 MiniMax 官方 music-caption-rewriter skill。把用户的音乐 brief、原始段落标签、目标时长和排除项交给该 Skill;将它返回的三段式英文 Caption 作为 --caption,原歌词或纯器乐结构标签仍单独传入 Music3。官方 Skill 只负责编曲描述,不替代 OPC 的真实时长和音频完整性验收。

opc music --caption-file caption.txt --lyrics-file lyrics.txt --duration 120 -o song.mp3
opc music --caption "Cinematic orchestral score" --instrumental --format flac
opc music --caption-file caption.txt --lyrics-file lyrics.txt --dry-run

官方 Rewriter 必须返回英文三段式 Structured Caption:Global Metadata、Vocal Details、Arrangement,通常为 250–450 词;歌词单独传入并保留 [Verse]、[Chorus] 等段落标签。默认 30 steps、CFG 1.7、top-k 50,支持 0.04-360 秒非流式生成。输出默认必须达到目标时长的 95%,不足或音频损坏会自动换 seed 重试三次;--min-duration 和 --attempts 可调整验收门槛。

Cut 命令

基于 ASR 字词级时间戳的视频剪辑。详见 references/cut.md。

opc cut --video video.mp4        # 启动剪辑 Web 界面

Video 命令

MiniMax H3 本地文生视频、首尾帧图生视频、参考图视频,以及 SeedVR2 超分。详见 references/video.md。

H3 创意规划路由

  • 创建、改写或扩写任何 H3 Prompt 时,必须优先使用 MiniMax 官方 h3-prompt-writing skill,并读取与输入模式对应的官方 reference。不要自行改动官方字段名、字段顺序、媒体标签或时间格式。
  • 模式映射:h3-t2v 使用 T2VA;h3-i2v 仅首帧使用 I2VA、首尾帧使用 FL2VA、仅尾帧使用 L2VA;h3-r2v 使用 Ref2VA。
  • 用户还需要创意策划、参考素材分工、审美设计、测试矩阵或生成后质检时,在官方 Skill 之后读取内置 H3 Guide。内置指南补充创意决策,不替换官方 Prompt 结构。
  • 用户只查询工作流、参数、安装、连接、缓存和报错,或已经给出符合官方结构的完整 Prompt 要直接执行时,读取 references/video.md。
  • 冲突优先级:官方 h3-prompt-writing 管 Prompt 结构;references/video.md 管 CLI 与本机工作流能力;内置 h3-guide 管创意规划和质检。
  • H3 默认采用两阶段生成:抽卡、试 Prompt 和筛选 seed 时使用 --turbo;确定方案后保持 Prompt、参考素材和 seed 不变,移除 --turbo,使用 Base 20 steps 按目标分辨率最终出片。不要把 Turbo 预览直接当最终交付。
opc video list
opc video -w h3-t2v -p "..." --width 864 --height 480 --duration 5
opc video -w h3-t2v -p "..." --width 608 --height 352 --duration 5 --seed 42 --turbo  # 抽卡/筛 Prompt
opc video -w h3-t2v -p "..." --width 1376 --height 768 --duration 5 --seed 42 --steps 20  # 最终出片,不用 Turbo
opc video -w h3-i2v -p "..." --first-frame first.png --last-frame last.png
opc video -w h3-r2v -p "..." --reference-image subject.png
opc video -w h3-t2v-upscale -p "..." --upscale-factor 2
opc video -w h3-t2v -p "..." --no-fbc  # 无近似缓存的精确基线
opc video -w h3-t2v -p "..." --duration 20  # 实验性原生 20 秒(481 帧)

CLI 支持 5–20 秒。超过 15 秒属于 ComfyUI 节点允许、但超出 H3 已验证训练区间的实验模式;需要预留更多显存并重点检查长时一致性。

H3 默认启用独立 FirstBlockCache 的 H3 Safe 预设。--no-fbc 可关闭; 显式启用 --easy-cache 时会自动省略 FBC,避免两个近似缓存叠加。

Dashboard

技能管理面板。详见 references/dashboard.md。

配置

配置文件:~/.opc_cli/opc/config.json

键 默认值 说明
tts_engine edge-tts 默认 TTS 引擎
edge_voice zh-CN-XiaoxiaoNeural edge-tts 音色
qwen_speaker Vivian qwen 音色
default_device 播放设备
asr_model_size 1.7B ASR 模型
workspace_dir ~/opc-workspace 工作目录
comfyui_host 127.0.0.1 ComfyUI 地址
comfyui_port 8188 ComfyUI 端口
video_output_dir 空 视频下载目录,空时复用 output_dir
image_output_dir 图片输出目录
vision_api_url 视觉模型 API URL
vision_model 视觉模型名称
video_desc_api_url 视频理解 API URL;为空时复用 vision_api_url
video_desc_model 视频理解模型;为空时复用 vision_model
video_desc_max_frames 8 非原生视频模型的抽帧数量
dashboard_host 0.0.0.0 Dashboard 监听地址
dashboard_port 12080 Dashboard 端口
model_source modelscope 模型下载源
opc config --show
opc config --set-engine qwen
opc config --set-comfyui-host 192.168.100.10
查看许可证全文(Apache-2.0)
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.