mcpField
A
auto-editor

auto-editor

github.com/wyattblue创意与媒体5.6k796 次安装今天更新
代码仓库

关于 auto-editor

auto-editor 是面向媒体创作者的命令行编辑技能,可自动压缩录制内容,也支持手动定义编辑。它根据音频、画面变化、黑帧或字幕检测活动区段,并执行剪切等操作。

主要功能

  1. 01按活动区段自动剪切
  2. 02检测音频、动作和字幕
  3. 03自定义标签及对应操作
  4. 04按时间范围手动编辑
  5. 05控制节奏与渲染

适用场景

  1. 01删除录音中的静音
  2. 02按画面变化或字幕剪辑
  3. 03为检测到的区段设置不同速度
  4. 04渲染前预览剪辑结果

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/wyattblue/auto-editor --skill auto-editor

安装后在 Claude Code 中输入/auto-editor确认已加载。

详细介绍

使用 auto-editor 进行编辑

auto-editor 会分析媒体文件,将每个时间基区段标记为活跃 (例如有声音)或不活跃(例如静音),然后对每个区段应用操作。默认 设置:保持活跃区段不变,剪切不活跃区段。

auto-editor path/to/video.mp4          # writes video_ALTERED.mp4
auto-editor video.mp4 -o out.mp4       # choose the output name

运行已安装的 auto-editor,或在此仓库中运行 ./auto-editor。auto-editor info FILE 会显示流、编解码器和时长;--preview 会打印将要剪切的内容, 并在渲染前退出——长时间渲染前可用它检查结果是否合理。

录制和编辑麦克风音频

在 macOS、Windows 或 Linux 上,将 :mic 用作输入。按 Ctrl-C 正常停止采集; 随后 auto-editor 会像往常一样分析并编辑录音。

auto-editor :mic                                      # → mic_ALTERED.wav
auto-editor :mic --sample-rate 44.1kHz -o trimmed.m4a
auto-editor :mic --edit audio:threshold=6%

所有常规编辑、操作和渲染选项均适用。编辑器和时间线导出会将源采集内容单独 保留;有关录制编解码器和命名的详情,请使用 auto-editor-export 技能。

1. 选择哪些内容算作“活跃” — --edit METHOD

audio:threshold=0.04,stream=all 是默认值。阈值可使用 0–1 的小数 或 dB 值(区分大小写)。

方法满足以下条件时标记为活跃……关键参数(默认值)
audio最大采样值 ≥ 阈值threshold=0.04,stream=all
motion帧间变化 ≥ 阈值threshold=0.02,stream=0,width=400,blur=9
blackdetect帧大部分为黑色threshold=0.98,pixel-black=0.10(用 not 包裹即可剪切黑色画面)
subtitle/regex字幕行匹配 patternpattern(必需),ignore-case=#f
word字幕中出现完整单词value(必需),ignore-case=#t
1 / 0每个 / 没有时刻均为活跃(全部保留 / 全部剪切)别名 none / all;可作为手动范围的基础
auto-editor video.mp4 --edit audio:threshold=0.04
auto-editor video.mp4 --edit audio:-19dB            # dB form
auto-editor video.mp4 --edit motion:threshold=0.02
auto-editor video.mp4 --edit blackdetect            # cut to remove black: --edit "(not blackdetect:0.98)"

使用布尔运算符 or、and、xor、not 组合流或方法。在运算符内部, 必须以调用形式为方法指定显式参数(audio:0.04,而不是单独的 audio); 在此处单独使用方法会报错 Bad kind:

auto-editor multi.mov --edit "(or audio:stream=0 audio:threshold=10%,stream=1)"
auto-editor video.mp4 --edit "(or audio:0.03 motion:0.06)"   # threshold is always positional arg 1
auto-editor video.mp4 --edit "(not audio:0.04)"              # invert: keep the quiet parts
标签 — 不只是静音与有声(--edit:N、--when:N)

每个时刻都会标记一个整数标签(0–255),每个标签都有对应的操作。内置 两个标签:

标签含义设置所属标签设置操作(默认值)
0静音 / 不活跃(--edit 未匹配的内容)--when-inactive = -w:0 = --when:0(cut)
1普通 / 活跃--edit EXPR(即 --edit:1 EXPR)--when-active = -w:1 = --when:1(nil)

因此,单独使用 --edit audio 等同于 --edit:1 audio:匹配的时刻变为标签 1, 其余时刻仍为 0。-w:0/-w:1 只是 --when:0/--when:1 的简写。

使用 --edit:N EXPR(N = 2–255)添加自定义类别,并通过 --when:N ACTION 为每个类别指定自己的操作(默认为 nil = 保留)。类别重叠时, 较大的标签优先:

# Cut silence (0) and keep speech (1) as usual, but also zoom wherever there's motion (2)
auto-editor video.mp4 --edit:2 motion:0.02 --when:2 zoom:2
auto-editor video.mp4 -e:2 motion:0.1 -w:2 speed:2        # -e/-w short forms

# Three tiers: cut silence, keep quiet speech at 1x, speed up the loud parts
auto-editor talk.mp4 --edit audio:-30dB --edit:2 audio:-12dB --when:2 speed:1.5

--edit:0 不被接受——标签 0 是隐式静音类别;如需对静音时刻执行操作,请使用 --when:0。(上面的 --edit 1 / --edit 0 值与此无关: 它们会将标签 1 的表达式设为全真 / 全假常量。)

2. 设置节奏 — --margin 和 --smooth

auto-editor video.mp4 --margin 0.2sec        # default: pad each kept section by 0.2s both sides
auto-editor video.mp4 --margin 0.3s,1.5sec   # 0.3s before, 1.5s after (avoids clipped words)
auto-editor video.mp4 --smooth 0.2s,0.1s     # min-cut 0.2s, min-clip 0.1s (default); --smooth 0 = off

3. 手动编辑 — 范围语法

--cut、--keep、--set-speed、--set-action 接受 START,STOP 范围。 起点包含在范围内,终点不包含。默认单位是时间基;添加 sec (s/second)可使用秒。变量 start/end;负数从末尾开始计数。 范围可与自动编辑结合使用,也可用 --edit 0/--edit 1 仅进行手动编辑。

auto-editor video.mp4 --cut 0,30 -10sec,end    # drop first 30 frames and last 10s
auto-editor video.mp4 --keep 0,30sec           # force-keep first 30s regardless of loudness
auto-editor video.mp4 --set-speed 2,0,30       # SPEED,START,STOP: 2x over frames 0–29
auto-editor video.mp4 --edit 1 --cut 0,5sec    # no auto cuts, just drop first 5s
auto-editor video.mp4 --edit 0 --keep 0,5sec   # keep only the first 5s

4. 反转编辑 — 查看哪些内容会被剪切

auto-editor video.mp4 --when-active cut --when-inactive nil   # keep the silence, cut the loud parts

5. 渲染与文件大小

auto-editor video.mp4 -c:v hevc -b:v 0       # variable bitrate
auto-editor video.mp4 -b:v 230k              # target a bitrate to shrink the file
auto-editor video.mp4 -crf 23 -preset medium # quality-based encoding
auto-editor video.mp4 --scale 0.5            # halve the resolution
auto-editor video.mp4 -anorm ebu             # EBU R128 loudness normalize (or peak:-3)

文件大小超出预期通常是因为自动码率过高——请设置 -b:v 或 -crf。auto-editor cache 会列出分析缓存;cache clear 会清除缓存。

进一步探索

  • 创意效果(速度/缩放/叠加层/动画)→ auto-editor-effects 技能
  • 导出到 Premiere/Resolve/Final Cut、片段序列或 .v1/.v2/.v3 时间线 → auto-editor-export 技能
  • 转录音频并按口述词语剪辑 → auto-editor-transcribe 技能
  • 完整选项列表:auto-editor --help 或 https://auto-editor.com/ref/options.md

评论

支持 Markdown