一段录像可以提供多个短片,但转录文本无法判断节选是否忠于上下文,1080 × 1920 的导出尺寸也不能证明成片适合观看。本指南用五个手动调用的 Claude Code 项目技能组织转录、排序、剪切、字幕和渲染工作。人工编辑批准每个原片区间,并完整观看每个成片文件。流程仅适用于你拥有或明确获准编辑和分享的视频。
这是一份面向 macOS Terminal 和 zsh、基于文档的操作方案。BIG CHANGE 未运行这些命令、查看私有素材或制作五个文件。操作前请核查已安装工具的帮助和实际媒体。配图只是创作者将审核的五个竖屏视频的概念示意,并非真实片段、软件输出或 BIG CHANGE 对此流程的测试。
关键变化
- 变化是什么: Claude Code 项目技能可以把本地视频编辑分成五个手动调用阶段。建议的交接记录将原片时间、获批剪切、校正字幕和最终文件对应起来;工具文档并不能证明这个具体流程已成功运行。
- 为什么重要: 持有素材使用许可的创作者可在每个阶段交给人工编辑一个明确决定,包括原片是否真的有五段独立可用的内容。这样能在加字幕导出前拒绝薄弱或误导性的剪切。
- 需要关注: 是否分享结果,仍取决于权利、所选 Claude 账户的数据政策,以及对每个已保存 MP4 的完整播放检查。文件技术检测通过不能解决这些问题。
开始之前
你需要本地的 source.mp4 ,其中音频可用,还需足够存储、Claude Code 访问权限、可工作的本地 whisper.cpp whisper-cli 和支持目标语言的模型,以及包含所需编码器和滤镜的 FFmpeg、ffprobe。还需要一名能检查原片和全部五份导出文件的编辑。记录 Claude Code 账户及数据政策、安装版本、whisper.cpp 提交或构建、模型 SHA-256 与许可证、用量限制。即使转录和渲染在本地,Claude Code 也可能使用托管模型。只授权它访问符合素材权利及账户政策的转录或媒体。其 技能说明 并不限制访问;单独的 工具权限控制 管理工具调用。按设置不同,常规只读操作可能无需提示即可执行。应主动检查技能能读取什么,而不只检查它打算写入或执行什么。
在一个可信的新本地运行文件夹中放入不可变的原片副本和 rights.json 。权利记录应说明原片 SHA-256、编辑、允许的节选及后续用途、说话者、音乐和画面的许可,以及存储和保留规则。权利不确定时不要继续。在该文件夹打开 Terminal,确认 pwd,然后创建工作文件夹:
mkdir -p transcript clips captions shorts probes .claude/skills/video-transcribe .claude/skills/video-rank .claude/skills/video-cut .claude/skills/video-caption .claude/skills/video-vertical
command -v claude
command -v ffmpeg
command -v ffprobe
claude --version
ffmpeg -version
ffprobe -version
ffmpeg -hide_banner -h encoder=libx264
ffmpeg -hide_banner -h encoder=aac
ffmpeg -hide_banner -h filter=subtitles
ffmpeg -hide_banner -h filter=scale将 WHISPER_CLI 和 WHISPER_MODEL 设置为真实、带引号的绝对路径。将 LANGUAGE 设置为已核实的口语语言代码,例如 en 仅在音频为英语时使用。确认模型支持该语言;仅支持英语的 .en 模型不能覆盖其他语言。混合语言或不支持的语言需先制定经检查的方案。 whisper.cpp CLI 参考文档 说明了 -l、 -m、 -f、 -osrt、 -oj 和 -of;请对照所安装构建的帮助核查。不要启用其翻译选项。
WHISPER_CLI='/absolute/path/to/whisper-cli'
WHISPER_MODEL='/absolute/path/to/approved-model.bin'
LANGUAGE='en'
test -x "$WHISPER_CLI"
test -r "$WHISPER_MODEL"
"$WHISPER_CLI" --help
ffprobe -v error -show_entries format=duration:stream=index,codec_type,codec_name,width,height,sample_aspect_ratio -of json source.mp4运行前替换示例路径和语言。检查原片时长、媒体流、方向、音频及可用空间。确认已安装的 subtitles 滤镜支持 libass,并确认 scale 接受 force_original_aspect_ratio、 force_divisible_by 和 reset_sar。缺少必要功能时,按维护者的构建说明处理后重新检查。不要悄悄省略字幕。
创建五个有明确边界的项目技能
在可信项目中分别保存五个 .claude/skills/<name>/SKILL.md 文件。每个都需要自己的 name、 description、 disable-model-invocation: true,以及完整的输入、动作、输出和停止规则。按顺序手动调用: /video-transcribe、 /video-rank、 /video-cut、 /video-caption、 /video-vertical。不要添加 allowed-tools:Claude Code 表示,该字段会在调用时授予所列工具无需提示的使用权限,并非把技能限制在这些工具内。保留正常权限设置并主动审查访问。只读调用可能不提示,而写入和执行依实际账户控制运行。
使用以下完整技能内容,以及下文的共同运行记录。技能中的文字是给 Claude Code 的指令,并非强制执行的权限边界。
.claude/skills/video-transcribe/SKILL.md
---
name: video-transcribe
description: Transcribe the authorized local source for the five-short workflow.
disable-model-invocation: true
---
Input: rights.json, immutable source.mp4, checked source probe, verified language and local whisper.cpp executable/model. Confirm matching source and model hashes, usable audio and permitted access before any command.
Action: From the checked run directory, confirm source.wav and both transcript output paths do not exist. Extract mono 16 kHz 16-bit PCM source.wav with explicit first-audio mapping and no overwrite. Continue to whisper-cli only after a zero exit and valid WAV readback; use the verified model and explicit language, SRT and JSON output, and translation off. Inspect both outputs, parse source-relative times, and compare representative passages and uncertain names or quotes against source audio. Record a nonzero exit or uncertain output as a manifest blocker before any next stage.
Output: transcript/source.srt and transcript/source.json, recorded hashes, corrections or marked uncertainties, tool and model identity in manifest.json.
Stop: Missing rights, changed inputs, absent audio, empty or malformed transcript, or unverified relevant speech. Do not upload, publish or overwrite accepted files; ask the editor to settle uncertainty..claude/skills/video-rank/SKILL.md
---
name: video-rank
description: Suggest source moments for human selection of five distinct clips.
disable-model-invocation: true
---
Input: Checked source transcript and hash, immutable source hash and probe duration, rights.json, intended audience. Verify all identities and authorized transcript access.
Action: Suggest more than five moments with numeric source-second start/end, source words, surrounding context and editorial rationale. Treat ranking as a suggestion, never a viral forecast. Have the editor open each candidate in the original and check speaker, wording, facts, context and rights. Record exactly five distinct coherent approved intervals and a rejected-candidate log.
Output: approved-moments.json with order, source hash and five numeric bounds satisfying 0 <= start < end <= source duration.
Stop: Fewer than five permissible, meaningful moments, mismatched hashes, uncertain bounds or missing human approval. Do not invent a fifth excerpt..claude/skills/video-cut/SKILL.md
---
name: video-cut
description: Cut the five approved source intervals into separate local clips.
disable-model-invocation: true
---
Input: Immutable source.mp4, source hash/probe and five human-approved intervals. Verify hashes and calculate each duration as end minus start.
Action: For each 01-05, confirm its unique output path is unused, then transcode the approved source-relative interval with input -ss, -t duration, explicit first video/audio mapping, libx264, AAC and -n. Continue only on zero exit and file readback. Probe streams and duration, inspect first and last frames, and have the editor watch each whole cut for boundaries, sync and context. Record the exact command and output hash. Any failure or uncertain write is a manifest blocker; never pass that clip to captioning.
Output: Five accepted numbered clips, individual probe records and links to approved intervals in manifest.json.
Stop: Wrong bounds, absent stream, drift, misleading context, output collision or uncertain command result. Read back the existing path first; correct bounds with human approval and use a new filename. Never overwrite or reuse an old clip hash..claude/skills/video-caption/SKILL.md
---
name: video-caption
description: Create and check local captions from each accepted clip.
disable-model-invocation: true
---
Input: Five accepted clip hashes, verified language and local model identity. Reject stale clips or mismatched source links.
Action: For each actual numbered clip 01-05, verify its accepted hash and unused WAV/raw-SRT paths, then extract its own mono 16 kHz 16-bit PCM WAV with -n. Run whisper-cli only after zero exit and WAV readback, with the matching language and SRT output; translation stays off. Preserve raw SRT. Have the editor correct words, names, numbers, cue timing, overlaps and readability against the actual clip, then save a distinct .checked.srt. Use clip-local times, not source-offset cues. Record failures as blockers before rendering.
Output: Five checked SRTs with raw-ASR and exact clip hash links in manifest.json.
Stop: Any cue outside clip duration, uncertain speech, bad alignment or stale clip hash. Repair and replay before rendering; a recut requires matching new captions..claude/skills/video-vertical/SKILL.md
---
name: video-vertical
description: Render and review five captioned 1080x1920 MP4s.
disable-model-invocation: true
---
Input: Five accepted clip hashes/probes, matching checked SRT hashes, rights record and a human-approved crop or framing plan for each clip.
Action: Check decoded orientation and sample aspect ratio. Choose even integer crop width, height and x/y for each clip; require positive dimensions, nonnegative offsets and a rectangle within the decoded frame. A fixed crop does not track motion. Verify unique output and probe paths are unused. From the established run directory, render each separately with crop, aspect-preserving scale, pad, clip-local subtitles, explicit video/audio mapping, libx264, yuv420p, AAC and -n. Continue only on zero exit and saved-file readback. Create probe JSON without clobbering an existing path, reopen the MP4 and have the editor watch its entire video and audio, checking cut context, every caption, framing, sync, facts and rights. Record any failure or uncertain output as a blocker.
Output: Five distinct accepted 1080x1920 MP4s, hashes, probe JSON, exact source/clip/SRT lineage and UTC human acceptance notes.
Stop: Unknown orientation, invalid crop, missing filter, collision, unreadable file, silent audio, cut-off text, wrong duration, bad context or failed full playback. Inspect uncertain existing outputs; revise to a new filename, probe and watch again. No upload or publishing.每次运行保留一个 manifest.json 。每次交接记录权利记录、不可变原片 SHA-256、工具版本、模型 SHA-256、许可证及语言、带 SHA-256 的输入输出、获批的数字原片区间、完整命令和 UTC 决定。命名文件或哈希不同就停止,解决后再进入下个技能。
将下列每个 shell 代码块视为一个阶段,放在新的 zsh 脚本或受控 shell 中,使用 set -e 让命令失败时停止该阶段。运行前确认每条输出路径未被占用,并在清单中将非零退出、缺失文件或不确定写入记为阻塞。后续技能必须读取状态和输出哈希,不能因为旧片段还存在就接受失败的剪切。
1. 转录原片
根据 whisper.cpp 维护者的 README ,其 CLI 示例目前要求 16 位 WAV。确认原片音频可用后,从核实的项目目录运行以下命令。 -n 可防止 FFmpeg 覆盖现有 WAV。
set -e
test ! -e source.wav
test ! -e transcript/source.srt
test ! -e transcript/source.json
ffmpeg -i source.mp4 -map 0:a:0 -ar 16000 -ac 1 -c:a pcm_s16le -n source.wav
test -s source.wav
"$WHISPER_CLI" -m "$WHISPER_MODEL" -f source.wav -l "$LANGUAGE" -osrt -oj -of transcript/source
test -s transcript/source.srt
test -s transcript/source.json确认 transcript/source.srt 和 .json 都存在、包含带时间的语音,且时间不超出探测的原片时长。听取有代表性的段落,并对照原片核实不确定的人名、数字和引语。保留校正转录或明确标记不确定性。音频提取或转录为空时,先检查原片流、程序、语言和模型兼容性,再尝试使用新名称输出。
2. 在原片中选择五个时刻
调用 /video-rank ,提供已检查的转录和目标受众。要求多于五个候选,让编辑能淘汰薄弱节选。每个候选需给出从原片开头计算的数字起止秒数、原话、前后文以及可独立理解的理由。在原片中打开每个区间。编辑决定剪切是否仍保留说话者、措辞、画面上下文、事实和许可。将恰好五个独立获批区间保存到 approved-moments.json,包括顺序、原片哈希及 0 <= start < end <= source duration。转录段落只是定位线索。关于更小范围的时间定位任务,参见 编辑视频前找到说话时刻。
原片没有五个合理可用的时刻就停止。五文件任务仍未完成。
3. 剪切获批区间
调用 /video-cut。根据获批的数字边界,为每段计算 DURATION = END - START 。把下方尖括号占位符替换为实际数值;占位符本身不能运行。从 clip-02.mp4 到 clip-05.mp4分别重复。FFmpeg 文档介绍了输入定位、时长、显式流选择以及 不覆盖输出的行为。为实现所需切点,应转码而非直接复制媒体流。
set -e
test ! -e clips/clip-01.mp4
ffmpeg -ss <START_SECONDS> -i source.mp4 -t <DURATION_SECONDS> -map 0:v:0 -map 0:a:0 -c:v libx264 -c:a aac -n clips/clip-01.mp4
test -s clips/clip-01.mp4探测每段真实片段的流和时长,检查第一帧与最后一帧,再完整观看。记录其哈希和获批原片区间。错误剪切需要重新批准边界并使用新输出名称。命令失败或结果不确定时,重跑前先检查现有文件和探测结果;不要向同名文件重试。
4. 对照真实剪切校正字幕
调用 /video-caption。对每个接受的片段重新转录,因为字幕时间零点必须对应片段开头。片段 01 的命令如下:
set -e
test ! -e captions/clip-01.wav
test ! -e captions/clip-01.srt
ffmpeg -i clips/clip-01.mp4 -map 0:a:0 -ar 16000 -ac 1 -c:a pcm_s16le -n captions/clip-01.wav
test -s captions/clip-01.wav
"$WHISPER_CLI" -m "$WHISPER_MODEL" -f captions/clip-01.wav -l "$LANGUAGE" -osrt -of captions/clip-01
test -s captions/clip-01.srt对 02 至 05 使用对应的两位编号和不同路径重复。保留每份原始 captions/clip-NN.srt。编辑逐条对照片段校正词语、人名和数字,检查时间及可读性,再保存 captions/clip-NN.checked.srt。字幕条目超出片段时长就阻止渲染。记录每份 SRT 哈希与片段哈希的对应关系。剪切改变时,针对新文件重新生成或复查字幕。
5. 重新构图、渲染并验收五个文件
调用 /video-vertical。对每个接受的片段检查解码图像、方向、像素宽高比及运动。编辑为各片段分别选择偶数整数 CROP_W、 CROP_H、 CROP_X、 CROP_Y。裁剪矩形必须位于解码画面内。固定裁剪不会跟随移动主体;丢失关键信息时,选用经审查的缩放加留边方案或修改剪切。方向或裁剪坐标不明就停止渲染。 FFmpeg 滤镜手册 介绍 crop、scale、pad 以及基于 libass 的 subtitles 滤镜。
在确定的运行目录中,将 CLIP 设为实际两位编号,并将四个裁剪变量设为该片段获批的整数。这是命令模板,不是已测试示例。保留这里简单的字幕相对路径;文件名若含特殊字符,需要另行进行滤镜图转义。对 02 至 05 独立重复。
set -e
setopt noclobber
CLIP=01
CROP_W=<CHECKED_EVEN_INTEGER>
CROP_H=<CHECKED_EVEN_INTEGER>
CROP_X=<CHECKED_EVEN_INTEGER>
CROP_Y=<CHECKED_EVEN_INTEGER>
test ! -e "shorts/short-${CLIP}.mp4"
test ! -e "probes/short-${CLIP}.json"
ffmpeg -i "clips/clip-${CLIP}.mp4" -map 0:v:0 -map 0:a:0 -vf "crop=${CROP_W}:${CROP_H}:${CROP_X}:${CROP_Y},scale=1080:1920:force_original_aspect_ratio=decrease:force_divisible_by=2:reset_sar=1,pad=1080:1920:(ow-iw)/2:(oh-ih)/2,subtitles=captions/clip-${CLIP}.checked.srt" -c:v libx264 -pix_fmt yuv420p -c:a aac -n "shorts/short-${CLIP}.mp4"
test -s "shorts/short-${CLIP}.mp4"
ffprobe -v error -show_entries format=duration:stream=index,codec_type,codec_name,width,height,sample_aspect_ratio -of json "shorts/short-${CLIP}.mp4" > "probes/short-${CLIP}.json"
test -s "probes/short-${CLIP}.json"对五份 JSON 探测文件,均要求存在 1080 × 1920、像素宽高比 1:1 的视频流、音频流,以及与获批剪切在编码或帧舍入后相符的正时长。缺失或未知值都尚未解决。 ffprobe 的 JSON 输出 检查文件属性而非剪辑质量。重新打开并完整观看每个 MP4,对照原片区间、接受的剪切和核查过的 SRT。检查语句边界、字幕及安全位置、运动中的构图、音画同步、事实和权利。在清单中记录接受、修改或拒绝及 UTC 时间。恰好五个接受的文件,每个均关联原片哈希、获批区间、片段哈希、核查 SRT 哈希和探测 JSON,才算完成。四个不够。
限制与恢复
Claude Code 访问可能受订阅或 API 费用及用量限制影响。下载本地模型、转录、转码和多次修订都消耗存储与计算。账户提供费用时记录实际金额;未知费用不等于零。本流程未测得速度、准确率、字幕质量、节省或传播热度效果。
保留原片及已接受的产物。模型缺失、选项不兼容、转录错误、渲染失败或写入不确定时,修改前先检查精确输入哈希和已有文件。修复具体原因,为修订指定新路径,然后重新探测并完整播放。人工编辑接受内容和权利之前,不要上传或分享成片。



