# Audio Segmenter

Adopt this skill: https://proskills.md/skills/other/audio-segmenter

Page: https://proskills.md/skills/other/audio-segmenter
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .gitattributes
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/.gitattributes

Content is not inlined in the catalog. Read the upstream file: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/.gitattributes

## File: .gitignore
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/.gitignore

Content is not inlined in the catalog. Read the upstream file: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/.gitignore

## File: LICENSE
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/LICENSE

Content is not inlined in the catalog. Read the upstream file: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/LICENSE

## File: README.md
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/README.md

````text
# Audio-Segmenter 🎧

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python](https://img.shields.io/badge/Python-3.8%2B-green.svg)](https://www.python.org/)
[![OpenClaw](https://img.shields.io/badge/OpenClaw-Skill-orange.svg)](https://github.com/wangminrui2022)

**Audio-Segmenter** 是一款专为高效处理音频素材设计的智能切片工具。它支持单文件或海量文件夹的递归切片，能够自动处理复杂的依赖环境，并完美保留原始目录结构。

---

## 🌟 核心特性

* **⚡ 零配置启动**：集成 `env_manager` 与 `ensure_package`，首次运行自动创建虚拟环境并安装依赖，无需手动执行 `pip install`。
* **📦 自动 FFmpeg**：内置静默下载机制，自动匹配系统架构下载便携版 FFmpeg，彻底解决“找不到 ffmpeg”的环境痛点。
* **📂 结构化输出**：在递归模式下处理文件夹时，会自动在目标目录 **1:1 复刻** 源目录层级。
* **🛠️ 智能路径逻辑**：
    * **单文件模式**：默认输出至原文件所在目录。
    * **文件夹模式**：自动创建 `[原名]_sliced_audio` 文件夹进行汇总，确保目录整洁。

## 🚀 执行步骤

1. **环境准备**：确保系统安装了 Python 3.12+。
2. **解析目录**：识别用户的源路径（支持单个音频文件或整个文件夹）。
3. **调用命令**：使用以下兼容性命令启动脚本。脚本会自动执行环境检查、依赖安装并完成切片。

### **在 OpenClaw 聊天中**

你可以直接对你的 Agent 说：

请使用 audio-segmenter 技能，将 "F:\命理学-音频\猴哥说易\月支月令如何看一个人事业！.mp3" 文件进行切片，输出到 "F:\命理学-音频-切片"。

请使用 audio-segmenter 技能，将 "F:\命理学-音频" 目录下的所有MP3文件进行切片，输出到 "F:\命理学-音频-切片"，添加参数-d 10 -r。

## 📘 参数指南

| 参数简写 | 完整参数     | 是否必填 | 类型   | 默认值 | 说明 |
|----------|--------------|----------|--------|--------|------|
| `-i`     | `--input`    | 是       | String | 无     | 输入文件或文件夹的绝对/相对路径 |
| `-d`     | `--duration` | 否       | Int    | 60     | 每个切片的时长（单位：秒） |
| `-o`     | `--output`   | 否       | String | None   | 输出根目录，不填则根据输入方式自动生成 |
| `-r`     | `--recursive`| 否       | Flag   | 无     | 是否递归处理子目录 |

```bash
# 通用调用命令（优先使用 python3）
(python3 ./scripts/audio_slicer.py -i "<输入路径>" [-d <时长>] [-o "<输出目录>"] [-r]) || (python ./scripts/audio_slicer.py -i "<输入路径>" [-d <时长>] [-o "<输出目录>"] [-r])
````

## File: SKILL.md
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/SKILL.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/SKILL.md

## File: scripts
upstream: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/scripts

Content is not inlined in the catalog. Read the upstream file: https://github.com/wangminrui2022/audio-segmenter/blob/HEAD/scripts
