360 Secure SkillHub
360 安全技能中心

raw-cut

双模式媒体粗剪技能:调用 Python 脚本与 ffmpeg,把单人口播原始录音或视频中的静音、长停顿、口误、重录和背景人声去掉,每句保留最佳一条,输出纯音频或帧同步视频,并附带重录挑选与成品校验流程。

分类:创作
rakibhasandeveloper0
热度 0.00
最近更新 2026-12-05 05:30:25

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add rakibhasandeveloper0/agent-video-editor/raw-cut
兼容性
通用兼容
联网要求
不联网
数据出网
可选出网
Metadata
name
raw-cut
description
Clean-cut a RAW single-speaker recording — supports BOTH Video Mode (talking-head / screen recording with frame-locked lip-sync) AND Audio-Only Mode (pure voiceover cut with zero video processing, even from an .mp4 input). Removes silences, long pauses, false starts, retakes, repeated lines, and background voices (TV/phone/people), keeping one best take of every line with short even pauses. Use when the user gives a raw video or voiceover and asks to "clean it", "cut the pauses", "fix retakes", "audio raw cut করো", "voice clean করো", "video raw cut করো", or wants the clean base before motion graphics. Bangla + English speech. Cut only — no graphics, captions, zoom, colour or background removal.

raw-cut — Dual-Mode (Audio & Video) Raw Take → Clean Cut

Output:

  • Video Mode (--mode video): one clean .mp4 where every line is said once, by the best take, with short even pauses (≈0.15–0.3 s by ear), frame-locked lip-sync, and nothing else changed.
  • Audio-Only Mode (--mode audio / --audio-only): one clean 48 kHz stereo PCM .wav (and/or .mp3 via --also-mp3) with zero video processing — never encodes master.mov, never builds video contact sheets, and never touches video streams even if the input is an .mp4!

Script: scripts/rawcut.py inside this skill folder (skills/raw-cut/scripts/rawcut.py in the full pipeline, or <skill-dir>/scripts/rawcut.py when installed standalone via npx skills add). Requires Python 3 + numpy + ffmpeg 7+ (Pillow needed only in video mode). Always set PYTHONIOENCODING=utf8 on Windows. Run long commands in the background.

Standalone vs. Full Pipeline Paths: Inside the full agent-video-editor workspace, write clean outputs to outputs/audio/clean_cuts/ or outputs/video/clean_cuts/ and cache to work/<slug>. When installed standalone as a skill in any other folder, write clean outputs next to the input file (for example <name>_clean.wav or <name>_clean.mp4) and cache in ./work/<slug>.

Skill Hygiene Rule: This skill folder contains instructions (SKILL.md) and scripts (scripts/rawcut.py) ONLY — never store media assets, outputs, or cache files inside skills/raw-cut/.


0. Pick the Right Mode (Audio vs Video)

User Request Flag Behavior Output Path
"শুধু audio raw cut করো" / "voice clean করো" / faceless video voiceover --mode audio (or --audio-only) 0% video work (source_audio.wav only, 5–10× faster, smooth audio crossfades, audio-only verify) outputs/audio/clean_cuts/<slug>_clean.wav (add --also-mp3 for .mp3 too)
"video সহ raw cut করো" / talking-head or screen-record clean cut --mode video Constant-30 fps master.mov, video contact sheets, xfade + acrossfade, 0-frame lip-sync verify outputs/video/clean_cuts/<slug>_clean.mp4
Mode not specified --mode auto (default) Audio output ext (.wav/.mp3/.m4a/.flac) OR audio input OR no video stream → audio; otherwise → video Routed automatically

1. Check the Machine — Once, Not Every Time

$env:PYTHONIOENCODING="utf8"
python skills/raw-cut/scripts/rawcut.py doctor
  • The result is cached for 30 days in the OS temp folder (never pollutes the skill folder). run calls it automatically. Use doctor --force only when something failed, or when you changed PC, key, or model.
  • Checks: ffmpeg/ffprobe, Pillow, CPU/RAM/disk, encode speed, API key + audio comprehension test, and latency.
  • FAIL → stop and tell the user the exact problem and fix. Never guess-cut with a broken setup.
  • WARN → tell the user once, then continue.

Transcription engine order (cheapest reliable option first):

# Engine When Setup
1 Local faster-whisper large-v3 NVIDIA GPU + faster-whisper installed pip install faster-whisper
2 Free API: Google AI Studio Gemini (gemini-flash-latest) Free key GEMINI_API_KEY=... (aistudio.google.com)
3 Router / paid API: OpenAI-compatible audio model Key set RAWCUT_BASE_URL+RAWCUT_API_KEY (+RAWCUT_MODEL)
– Local on CPU Last resort only Slow (~4× realtime) and weak on Bangla

Overrides: RAWCUT_ENGINE=local|api, RAWCUT_LOCAL_MODEL, RAWCUT_LANG (default bn). Put keys in env or .env. Never print a key.

A weak model is the #1 cause of missing lines: if speech coverage drops below 88% or any window fails, run prints TRANSCRIPT WEAK and stops safely.


2. Cut — One Command

Audio-Only Mode (Zero Video Processing)

python skills/raw-cut/scripts/rawcut.py run "inputs/raw_audio/<raw>.mp3" "outputs/audio/clean_cuts/<slug>_clean.wav" "work/<slug>" --mode audio --also-mp3

(Works identically even if <raw> is an .mp4 — --mode audio ignores the video track completely. Add --denoise if you want the cut taken from the denoised clean.wav instead of the untouched source_audio.wav.)

Video Mode (Frame-Locked A/V)

python skills/raw-cut/scripts/rawcut.py run "inputs/raw_video/<raw>.mp4" "outputs/video/clean_cuts/<slug>_clean.mp4" "work/<slug>" --mode video
  • Steps: prep → transcribe (24 s overlapping windows, parallel, cached) → takes (group retakes, pick defaults) → cut → verify.
  • Safe to re-run and resumable from work/<slug>.
  • Never overwrites an edited keep.json. Delete keep.json to re-pick defaults, or delete windows/ + phrases.json to re-transcribe.
  • Single steps: prep, transcribe, takes, cut W out [--denoise] [--also-mp3], verify W out [--quick].

3. Review Retakes (The Only Judgment Step)

  • Audio Mode: Review the printed retake groups and work/<slug>/takes.json (text, timing, dB, completeness). Default pick is the last complete, full-length take. Change work/<slug>/keep.json only if an earlier take is clearly cleaner or more complete, then re-run cut + verify.
  • Video Mode: Open each contact sheet printed by run (start | middle | end per attempt). Change the pick only if the default misses words/stumbles OR has eyes closed, hand over face, or big posture shift (prefer lower move; join breaks ties).

Always apply without being asked:

  • Drop non-content filler: "ok", "হয়ে গেছে", mic tests, talking off-camera.
  • Keep anything carrying new information, even if said once.
  • Never reorder lines unless the user asks.
  • Partial rescue (first half of one take + second half of another) only at a real pause — tell the user if you do it.

4. Verify — What Must Be True

Check Audio Mode Video Mode
Duration sync audio … edl … diff ≤ 50 ms video … audio … diff ≤ 33 ms
Lip-sync (skipped — audio-only) picture offset in frames: all 0
joins inside speech none none
clips < 0.35 s (stutter) none none
pauses > 0.4 s (clear speech) none (or one borderline) none (or one borderline)
Fresh transcript (unless --quick) Every line once, in order, nothing missing Every line once, in order, nothing missing

Report briefly to the user in their language: output path(s), final duration, final clean script, any non-obvious retake drops/choices, and (in video mode) any big head jumps worth hiding with a zoom later.


Why the Script Does What It Does (Don't Undo These)

  1. Audio-only isolation. Audio mode never decodes or encodes video, writes lossless 48 kHz stereo PCM WAV (source_audio.wav), and uses smooth 40 ms triangular acrossfade at silent soft joins so Remotion and DAWs get sample-accurate, click-free audio.
  2. Video sync. Phone video is VFR and often offsets video vs audio start time. Video prep makes a constant-30 fps master and trims both streams by time (never frame index).
  3. Transcribe in context. 24 s overlapping windows prevent hallucination; cut points always come from the loudness envelope, never raw transcript timestamps.
  4. Background voices. Any phrase ≥ 12 dB quieter than the speaker (or tagged background) is dropped.
  5. Pauses judged by ear. Clear speech (STRONG_DB 15) drives pause planning; short onset/tail (TAIL_IN 0.06 / TAIL_OUT 0.12 s) prevents clipped syllables; inner pauses > 0.30 s compress to ≈ 0.13 s.
  6. No clipped or leaking retakes. Cut points settle into silence and never cross a dropped neighbour attempt's quietest dip (lim_lo/lim_hi).
  7. No stutter clips. Joins removing < 0.15 s or leaving clips < 0.35 s merge back when the gap is pure silence.
  8. Dissolve joins (video). 4-frame xfade + acrossfade when gap < 3 s, head jump < 12, and both sides silent; hard cut otherwise.