AgentSkillsCN

audio-spliter

利用 FFmpeg,按指定时长将媒体文件(视频/音频)划分为多个音频片段,并在静音检测的基础上精准设置切割点。适用于用户需将长录音、播客、讲座或视频按固定时长分段处理的场景。支持批量处理,且兼容所有 FFmpeg 兼容的格式。

SKILL.md
--- frontmatter
name: audio-spliter
description: "Split media files (video/audio) into audio segments by duration with silence-aware cut points using FFmpeg. Use when users need to segment long recordings, podcasts, lectures, or videos into chunks. Supports batch processing and any FFmpeg-compatible format."
allowed-tools: [Bash(ffmpeg, ffprobe, bc, grep, sed, find)]

Audio Splitter

Segment media files into audio chunks with intelligent silence detection for clean cut points.

Quick Start

bash
# Single file (video or audio)
./scripts/segment_audio.sh video.mp4 1800

# Batch processing
./scripts/batch_segment.sh -d ./videos 1800

Scripts

ScriptPurpose
segment_audio.shSegment single file (video or audio)
batch_segment.shBatch wrapper for multiple files

segment_audio.sh

Segment a single media file into audio chunks.

bash
./scripts/segment_audio.sh [OPTIONS] <input_file> <segment_seconds>
OptionDefaultDescription
-w, --window10Search window ±N seconds
-n, --noise-60dBSilence threshold (dBFS)
-s, --silence2Min silence duration (seconds)
-o, --output-dirinput dirOutput directory

Examples:

bash
./scripts/segment_audio.sh video.mp4 1800              # 30-min segments
./scripts/segment_audio.sh podcast.mp3 1800
./scripts/segment_audio.sh -w 15 -n "-35dB" lecture.mkv 2700

batch_segment.sh (Batch)

Batch process multiple files in a directory.

bash
./scripts/batch_segment.sh -d [OPTIONS] <input_dir> <segment_seconds>
OptionDefaultDescription
-d, --dir-Enable batch mode
--depth3Directory traversal depth
-w, --window10Search window ±N seconds
-n, --noise-60dBSilence threshold
-s, --silence2Min silence duration
-o, --output-dirinput dirOutput directory

Examples:

bash
./scripts/batch_segment.sh -d ./lectures 1800
./scripts/batch_segment.sh -d ./podcasts --depth 5 3600
./scripts/batch_segment.sh -d ./videos -o ./output 1800

Output Format

{source_name}_{num}_[{start}-{end}].{ext}

Example: video.mp4video_01_[0-1800].aac, video_02_[1800-3595].aac

Supported Formats

  • Video: mp4, mkv, avi, mov, webm, flv, wmv, m4v
  • Audio: mp3, aac, flac, wav, ogg, opus, m4a, wma

Detection Settings

Audio TypeNoiseWindowSilence
Quiet studio-50dB5s0.5s
Default-60dB10s2s
Noisy recording-35dB15s1.5s

Dependencies

  • FFmpeg with ffprobe (brew install ffmpeg)

Related Skills

  • audio-extractor: Extract complete audio track from video (no segmentation)