capcut-edit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecapcut-edit
capcut-edit
CLI for editing CapCut / JianYing drafts through a version-aware store. v0.11 detects and synchronizes readable timelines across , , , and .
draft_content.jsondraft_info.jsondraft_meta_info.jsontemplate-2.tmp用于通过版本感知存储编辑 CapCut / 剪映草稿的 CLI。v0.11 可检测并同步 、、 和 中的可读时间线。
draft_content.jsondraft_info.jsondraft_meta_info.jsontemplate-2.tmpProject locations
项目位置
- macOS:
~/Movies/CapCut/User Data/Projects/com.lveditor.draft/<project>/ - Windows:
%LOCALAPPDATA%\CapCut\User Data\Projects\com.lveditor.draft\<project>\
- macOS:
~/Movies/CapCut/User Data/Projects/com.lveditor.draft/<project>/ - Windows:
%LOCALAPPDATA%\CapCut\User Data\Projects\com.lveditor.draft\<project>\
Core principle — deterministic scripts
核心原则——确定性脚本
Any recipe involving more than one call, any arithmetic, or any branching ships as a parameterised shell script in . Claude invokes the script with inputs; the script runs a fixed sequence. If a recipe can be a script, it must be a script — not a narrative in .
capcutscripts/references/references/workflows.md任何涉及多次 调用、任何算术或任何分支的操作配方,都以参数化 shell 脚本形式放在 中。Claude 使用输入调用脚本;脚本按固定顺序执行。如果一个操作配方可以写成脚本,那就必须写成脚本——而不是 中的叙述性文字。
capcutscripts/references/references/workflows.mdProgressive disclosure
渐进式信息展示
Start broad, drill into what you need. Never dump full project JSON.
bash
capcut info <project> -H # overview
capcut doctor -H # installed media/transcription capabilities
capcut diagnose <project> -H # canonical files, divergence, editor safety
capcut tracks <project> -H # all tracks
capcut materials <project> -H # material summary
capcut segments <project> -H # segments with timing
capcut segment <project> <id> # one item, full detail先从概览开始,再深入你需要的部分。绝不导出完整项目 JSON。
bash
capcut info <project> -H # 概览
capcut doctor -H # 已安装媒体/转写能力
capcut diagnose <project> -H # 规范文件、差异、编辑器安全
capcut tracks <project> -H # 所有轨道
capcut materials <project> -H # 素材摘要
capcut segments <project> -H # 带时间的片段
capcut segment <project> <id> # 单个项目,完整详情Output modes
输出模式
- JSON (default): pipe to , feed to scripts.
jq - : human-readable tables.
-H - : quiet, exit code only — for write commands in scripts.
-q
- JSON(默认):可通过管道传给 ,或供脚本使用。
jq - :人类可读的表格。
-H - :安静模式,仅返回退出码——适用于脚本中的写入命令。
-q
Batch writes
批量写入
bash
echo '{"cmd":"set-text","id":"a1b2c3","text":"Fixed"}
{"cmd":"volume","id":"d4e5f6","volume":0.5}' | capcut batch <project>Operations: , , , , , , .
set-textshiftshift-allspeedvolumeopacitytrimBatch is transactional: one failing operation writes nothing. Use only when the user explicitly accepts a partial commit; it still exits non-zero.
--continue-on-errorbash
echo '{"cmd":"set-text","id":"a1b2c3","text":"Fixed"}
{"cmd":"volume","id":"d4e5f6","volume":0.5}' | capcut batch <project>操作:、、、、、、。
set-textshiftshift-allspeedvolumeopacitytrim批量操作是事务性的:只要有一个操作失败,就不会写入任何内容。仅当用户明确接受部分提交时才使用 ;它仍然会以非零状态退出。
--continue-on-errorWhere to look
查找指南
- — every command, every flag, every value format (time, percentages, degrees), the ID-prefix rule, the
references/api-reference.mdinvariant..bak - — generated command-contract v2 with typed positionals/options, mutability, prerequisites, output form, and exit codes.
../../docs/command-reference.md - — recipes = which
references/workflows.mdto run and why.scripts/X.sh - — close-project-first,
references/pitfalls.md,.bakon audio,clip=nullmath withsource_timerange, alpha-keyframes-don't-render-use-animation-materials, etc.speed - Enum discovery — call (or
capcut enums --<category>for a table) to list every CapCut slug. Categories:-H,--transitions,--masks,--image-intros,--image-outros,--image-combos,--text-intros,--text-outros,--text-loop-anims,--scene-effects,--character-effects,--audio-effects. Add--fontsto switch namespace. The--jianyingbundle is generated once viaenums.json; runtime is Python-free.python3 scripts/extract-enums.py - — the client library. Current:
scripts/- — attach any of 9 CapCut intro/outro animations;
anim.shandfade-in.share thin wrappers.fade-out.sh - — scale + pan keyframes via
ken-burns.sh(motion properties render; alpha does not — usecapcut keyframe --batchinstead).anim.sh fade-in - — cut a range, stamp title + CTA text.
long-to-short.sh - — apply a saved text template (see
stamp-cta.sh).assets/examples/subscribe-cta.json - — run every wrapper against the fixture; run after any change here.
_test.sh
- — raw JSON snippets for hand-editing.
assets/examples/
- — 每个命令、每个标志、每种值格式(时间、百分比、角度)、ID 前缀规则、
references/api-reference.md不变量。.bak - — 生成的命令契约 v2,包含类型化位置参数/选项、可变性、前置条件、输出形式和退出码。
../../docs/command-reference.md - — 操作配方 = 运行哪个
references/workflows.md以及为什么。scripts/X.sh - — 常见陷阱:先关闭项目、
references/pitfalls.md、音频段上的.bak、带clip=null的speed计算、alpha 关键帧不渲染需使用动画素材,等等。source_timerange - 枚举发现 — 调用 (或使用
capcut enums --<category>查看表格)列出所有 CapCut slug。类别:-H、--transitions、--masks、--image-intros、--image-outros、--image-combos、--text-intros、--text-outros、--text-loop-anims、--scene-effects、--character-effects、--audio-effects。添加--fonts可切换命名空间。--jianying捆绑包通过enums.json生成一次;运行时无需 Python。python3 scripts/extract-enums.py - — 客户端库。当前包含:
scripts/- — 附加任意 9 种 CapCut 开场/结尾动画;
anim.sh和fade-in.sh是轻量封装。fade-out.sh - — 通过
ken-burns.sh设置缩放 + 平移关键帧(运动属性可渲染;alpha 不可——请改用capcut keyframe --batch)。anim.sh fade-in - — 裁剪一个区间,并添加标题 + CTA 文字。
long-to-short.sh - — 应用已保存的文字模板(参见
stamp-cta.sh)。assets/examples/subscribe-cta.json - — 针对测试夹具运行所有封装脚本;修改此处后运行。
_test.sh
- — 供手动编辑的原始 JSON 片段。
assets/examples/
Invariants
不变量
- Close the project in CapCut before editing; reopen after.
- Every write is conflict-checked, prepared atomically, and synchronized to every readable timeline target. Every target receives and rolling history snapshots.
.bak - Never pass unless the user explicitly accepts overwriting changed-on-disk state or an open editor.
--force-write - is
clipon audio segments (no opacity/scale).null - writes to
capcut cut, never modifies the source.--out - IDs: first 6+ chars of the UUID match as a prefix.
- Time formats: ,
1.5s,500ms,+0.5s,-1s,1:30, bare number = seconds.0:05.5
- 编辑前先在 CapCut 中关闭项目;编辑后重新打开。
- 每次写入都会进行冲突检查、原子化准备,并同步到所有可读时间线目标。每个目标都会生成 和滚动历史快照。
.bak - 除非用户明确接受覆盖磁盘上已更改的状态或正在打开的编辑器,否则绝不传递 。
--force-write - 音频片段上的 为
clip(不支持不透明度/缩放)。null - 写入
capcut cut,绝不修改源文件。--out - ID:UUID 的前 6 个以上字符可作为前缀匹配。
- 时间格式:、
1.5s、500ms、+0.5s、-1s、1:30,裸数字表示秒。0:05.5
v0.11 high-value paths
v0.11 高价值路径
- Whole draft: , then
capcut compile spec.json --check. Specs support refs, transforms, decorators, templates, captions, keyframes, and fades.capcut compile spec.json --out <dir> - Karaoke: .
capcut caption <project> --audio <path> --whisper-engine <openai|whisper-cpp|faster-whisper> --karaoke - Proxy: ; run
capcut render <project> --all-video-tracks --burn-captionsfirst for FFmpeg capability flags.doctor - Automation: ; give jobs stable
capcut serve --workers N --retries N --timeout MSfields and let the runner serialize writes per project.id - Agent schema: is the source of truth. Do not scrape help text or invent flags.
capcut describe
- 整个草稿:先运行 ,然后运行
capcut compile spec.json --check。规格支持引用、变换、装饰器、模板、字幕、关键帧和淡入淡出。capcut compile spec.json --out <dir> - 卡拉OK字幕:。
capcut caption <project> --audio <path> --whisper-engine <openai|whisper-cpp|faster-whisper> --karaoke - 代理渲染:;先运行
capcut render <project> --all-video-tracks --burn-captions获取 FFmpeg 能力标志。doctor - 自动化:;为任务提供稳定的
capcut serve --workers N --retries N --timeout MS字段,让运行器按项目串行化写入。id - Agent 模式:是唯一权威来源。不要抓取帮助文本或编造标志。
capcut describe