SuperAPI AI Directory

smart-cut

Office & productivity

View repository

Updated 10-16 00:20

About this skill

smart-cut: Smart cut talking-head

When to trigger

The user provides a raw mp4/mov/mkv/webm video and asks for:

  • Cut talking-head, remove silence, cut out the parts with no sound
  • Auto-edit, automatically remove pauses like CapCut does
  • "First cut out the filler segments"

How it works

Detect segments in the audio where the volume is below a threshold → cut them out → concat the remaining segments back into one video. CapCut's "Smart Cut Talking-Head" is this kind of algorithm. This Skill uses the open-source auto-editor as a wrapper.

Prerequisites

# 第一次使用要裝
pip install auto-editor
ffmpeg -version  # auto-editor 內部會呼叫 ffmpeg

Default parameters (already-tuned sweet spot)

Parameter Value Why
--margin 0.2s Keep 0.2 seconds before and after each speech segment to avoid cutting too tightly
--edit audio:threshold=0.04 Volume threshold 4%, suitable for general talking-head
--export default(cut out silence) Not speed-up, but cutting out directly

Slow speaker/many pauses → adjust --margin to 0.3s. Lots of noise → raise threshold to 0.06。

Standard call

python "skills/smart-cut/scripts/smart_cut.py" \
  "raw/<影片代號>/原始.mp4" \
  --out "working/<影片代號>/<影片代號>.cut.mp4"

Inside the script it will:

  1. Check whether auto-editor is installed; if not, prompt
  2. Run auto-editor and print progress in real time
  3. Report "how many seconds were cut / original length / new length / compression rate"

Output

  • <影片代號>.cut.mp4 — the video after silence removal
  • A one-line stats report: for example 原長 18:42 → 新長 12:15(剪掉 34.6%)

Connection with other Skills

  1. smart-cut(this Skill) → produces the cut video
  2. → extract audio (ffmpeg -i x.cut.mp4 -vn -ar 16000 x.cut.wav)
  3. → audio-to-srt Skill: transcribe subtitles for the cut audio (timecodes will align with the cut video, not the original file)
  4. → subsequent cover, copy, title

Pitfalls

  • VFR (variable frame rate) source files will make auto-editor output black frames(EP07 tested: all black after 2:37, only sound remains, common in screen recordings).smart_cut.py already has built-in protection: before editing, use ffprobe to compare avg_frame_rate and r_frame_rate, if inconsistent it is judged as VFR, first use ffmpeg -fps_mode cfr -r 30 -c:v libx264 -preset veryfast -crf 18 -c:a copy to convert to a temporary CFR file before feeding it to auto-editor (audio copy, edit points and timeline unchanged), after completion automatically delete the temporary file and print "VFR detected, converted to CFR first".
  • Do not transcribe subtitles on the "original file" and then cut the video: the timecodes will be misaligned.Cut first, then transcribeis the correct alignment.
  • Cutting out even very short pauses makes it sound rushed: raise --margin to 0.3s or higher.
  • Music segments will be misjudged as silence: if the video contains background music segments, mark the segments first, and for that part use --cut-out reverse protection or manually add it back afterward.
  • Output file too large: auto-editor uses lossless concat by default. If compression is needed, post-process with ffmpeg -c:v libx264 -crf 23。

File structure

skills/smart-cut/
├── SKILL.md           # 本檔
└── scripts/
    └── smart_cut.py   # auto-editor 包裝腳本