skilltta-task-guidance
Temporary guidance for the video silence/opening remover task, focusing on robust silence detection, correct interval-merging semantics, and consistent compression reporting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- skilltta-task-guidance
- description
- Temporary guidance for the video silence/opening remover task, focusing on robust silence detection, correct interval-merging semantics, and consistent compression reporting.
03 SKILL.md 正文
Task Guidance: Video Silence Remover
Goal
Produce compressed_video.mp4 and compression_report.json by removing (a) the unnecessary static/noisy opening and (b) long silent pauses (> 2s), while preserving teaching content.
Pipeline
- Probe duration with
ffprobe(seconds, float). - Extract mono 16 kHz WAV:
ffmpeg -i input_video.mp4 -ac 1 -ar 16000 -vn tmp.wav. - Detect silence with
ffmpeg -af silencedetect=noise=-30dB:d=0.5and parsesilence_start/silence_endpairs. Lower threshold (e.g. -35 dB) if too little is detected, raise (e.g. -25 dB) if too much. - Detect the opening: look for a leading region (first ~30–60s) that is either silent or has near-constant frames. For audio-only heuristic, treat any silent/low-energy run that starts at (or very near) t=0 as part of the opening and extend
endto the first speech onset. - Build the removal interval list:
- Include opening removal
[0, speech_start]only ifspeech_start > 1.0s. - Include every silent run with
duration > 2.0s. Trim 0.15–0.25s padding on each side so cuts don’t clip speech.
- Include opening removal
- Merge/clean intervals (see Interval Merging below).
- Build keep intervals = complement of removal within
[0, duration]. - Cut and concatenate with ffmpeg (prefer re-encode for frame-accurate cuts):
- Use
-ss/-toper segment + concat demuxer, or a singleselect/aselectfilter withsetpts/asetpts.
- Use
- Write report JSON with the exact schema requested.
Interval Merging Convention (critical)
The segment-combiner convention and video-processor checks must agree:
- Intervals are half-open
[start, end)in seconds, floats. - Sort by
startascending. - Merge two intervals when
next.start - current.end <= GAP_EPS(useGAP_EPS = 0.2s). Do NOT merge only on strict overlap; small gaps between adjacent silences should coalesce so you don't leave sub-second speech islands. - After merging, drop any interval with
duration < MIN_REMOVE = 2.0s(except the opening removal, which is always kept if present). - Clamp to
[0, total_duration]; discard empty/negative intervals. - Validate: for every consecutive pair
a, bensurea.end < b.start(strictly), otherwise re-merge.
Consistency Checks (video-processor side)
Before writing output, assert:
sum(keep_durations) + sum(removed_durations) ≈ original_durationwithin 0.5s.compressed_duration ≈ sum(keep_durations)within 0.5s (measure with ffprobe on the output too).compression_percentage = removed / original * 100, rounded to 2 decimals.- Each reported segment satisfies
end > start,duration == end - start, and segments are non-overlapping and sorted. - Expected compression for a ~10 min teaching video is typically 5–30%. If outside, re-tune
silencedetectthreshold rather than silently shipping.
Report Schema (exact keys)
{
"original_duration_seconds": 0,
"compressed_duration_seconds": 0,
"removed_duration_seconds": 0,
"compression_percentage": 0,
"segments_removed": [
{"start": 0, "end": 0, "duration": 0}
]
}
All numbers are floats (seconds); compression_percentage is a percentage number (e.g. 12.34), not a ratio.
Patterns Borrowed From Prior Examples
- Schema-first JSON writing (like the dict→JSON example): assemble a plain dict with the required keys and
json.dumpit; don’t post-hoc patch the file. - Filter-then-aggregate (like the DataFrame filtering examples): first filter raw silence events by
duration > 2sand opening rule, then aggregate/merge, then compute summary stats — never compute stats on unfiltered events. - Guard empty inputs: if no silence events survive filtering, still emit a valid report with
segments_removed: []andcompressed_duration == original_duration, and copy the input video tocompressed_video.mp4.
Common Pitfalls to Avoid
- Using closed intervals
[a, b]on one side and half-open on the other → double-counted frames andoriginal ≠ compressed + removed. - Merging only on overlap: leaves 0.3–1.5s speech slivers between back-to-back silences, causing audible stutter.
- Forgetting to clamp the final interval to
total_duration(silencedetect sometimes reportssilence_endbeyond EOF). - Using stream copy (
-c copy) for cuts: keyframe snapping desyncs audio/video; prefer re-encode or use-avoid_negative_ts make_zerowith concat demuxer on re-encoded parts. - Reporting
compression_percentageas a 0–1 ratio instead of 0–100.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms