Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

mimo-asr-skill

把音视频转成小米 MiMo ASR(mimo-v2.5-asr)可识别文字的 skill 代码库。

两个 skill 组成一条完整流水线:

mp4 / mkv / avi / mov / flac / ... 
        │  audio-extract(ffmpeg 提取)
        ▼
16kHz 单声道 mp3 / wav
        │  asr-transcribe(静音切片 + 逐段识别 + 拼接)
        ▼
        txt 转写文本

目录结构

mimo-asr-skill/
├── README.md
└── skills/
    ├── audio-extract/            # 音视频 → ASR 可用音频
    │   ├── SKILL.md
    │   └── scripts/extract.py
    └── asr-transcribe/           # MiMo ASR 切片转写
        ├── SKILL.md
        └── scripts/transcribe.py

适用环境

项目 说明
操作系统 Windows(脚本内含 Windows 路径探测;Linux/macOS 下 ffmpeg 在 PATH 中即可)
Shell PowerShell 5.1 / 任意可设环境变量的 shell
Python 3.8+(建议用 conda 独立环境)
Python 依赖 openai、httpx(见 requirements.txt)
ffmpeg 必需。脚本自动查找:系统 PATH → miniconda envs/study/Library/bin → miniconda Library/bin
网络 可访问 https://api.xiaomimimo.com/v1
认证 环境变量 MIMO_API_KEY(不内置任何 key)

安装

git clone git@github.com:Bulingfluorite/mimo-asr-skill.git
cd mimo-asr-skill
pip install -r requirements.txt

# 设置认证(必填,脚本不内置 key)
$env:MIMO_API_KEY = "你的 key"

快速开始

1. 音频提取(可选,仅当输入是视频/非 mp3/wav)

python skills\audio-extract\scripts\extract.py "video.mp4" --output "audio.mp3"

输出固定 16kHz 单声道 64kbps mp3(ASR 足够,文件更小)。

2. 转写

python skills\asr-transcribe\scripts\transcribe.py "audio.mp3" --language zh --output "out.txt"

长音频(>30 分钟)建议后台运行,避免阻塞:

Start-Process -FilePath "python" `
  -ArgumentList 'skills\asr-transcribe\scripts\transcribe.py','audio.mp3','--language','zh','--output','out.txt' `
  -RedirectStandardError "asr.log" -RedirectStandardOutput "asr.out" -NoNewWindow
# 轮询进度
Get-Content asr.log -Tail 5

工作原理

asr-transcribe 三阶段

  1. 切片:silencedetect 找静音点,按目标段长(默认 180s)切成小段,规避模型 8K input / 2K output token 限制。
  2. 识别:逐段调 mimo-v2.5-asr;429 指数退避重试;遇 context 超长自动对半再切递归。
  3. 拼接:按序拼接全部片段写 txt;分段结果缓存在 workdir,支持断点续跑。

关键约束(官方文档 + 模型卡)

  • 模型:mimo-v2.5-asr,base_url https://api.xiaomimimo.com/v1
  • 输入仅 wav/mp3,base64 后 ≤ 10MB
  • 上下文 8K input / 最大输出 2K tokens → 单段必须小,否则输出被截断
  • 单请求超时 600s

参数速查

extract.py

参数 说明
<input> 任意 ffmpeg 支持的视频/音频路径
--output 输出路径,默认同名 .mp3
--format mp3(默认)/ wav

transcribe.py

参数 说明
<audio> mp3/wav 输入
--language auto / zh / en,默认 zh
--segment 每段目标秒数,默认 180
--output 输出 txt,默认同名 .txt
--workdir 分段缓存目录,默认 <输出目录>\.asr_work_<名>

安全

  • 本仓库不含任何 API Key / 密钥。 认证统一走环境变量 MIMO_API_KEY。
  • 提交前请勿把带 key 的 .env / 配置 / 日志提交进仓库(见 .gitignore)。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages