rgj1980298/obsidian_sync_public/asr-transcribe

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

语音识别(ASR)。将音频文件转为文字,支持 SiliconFlow API、OpenAI API、本地 faster-whisper 三种方式。

Install

npx vskill@latest install rgj1980298/obsidian_sync_public/asr-transcribe

SKILL.md

语音识别 (ASR)

将音频文件转为文字。支持三种方式:SiliconFlow API(免费)、OpenAI API、本地 faster-whisper。

使用场景

  • 音频/视频转文字
  • 会议录音、课程视频字幕生成
  • 「把这个音频转成文字」「语音转文本」「视频字幕提取」

前置条件

API Key 存储在 ~/.config/agent-skills/api-keys.json:

json
{
"asr": {
"api_base": "https://api.siliconflow.cn/v1",
"api_key": "sk-xxx",
"model": "FunAudioLLM/SenseVoiceSmall",
"language": "zh"
}
}

执行 ASR 前先读取此文件获取 API Key。

三选一:

方式需要特点
SiliconFlow APIAPI Key免费额度,推荐
OpenAI APIAPI Key需付费
本地 faster-whisperGPU 推荐离线可用,首次需下载模型

输出位置

默认输出 .txt 到输入音频所在目录。如需指定输出路径,问用户确认。

方式 A:SiliconFlow API(推荐)

认证
bash
# API Key 从 https://cloud.siliconflow.cn/ 获取
调用
bash
curl -X POST "https://api.siliconflow.cn/v1/audio/transcriptions" \
-H "Authorization: Bearer {API_KEY}" \
-F "model=FunAudioLLM/SenseVoiceSmall" \
-F "language=zh" \
-F "file=@{音频文件路径}"
参数
字段必需说明
model是FunAudioLLM/SenseVoiceSmall
language否zh 中文 / en 英文 / 省略自动检测
file是音频文件(WAV/MP3/M4A/FLAC/OGG/AAC)
响应
json
{"text": "识别出的文字内容..."}
Python 调用
python
import httpx
with httpx.Client(timeout=600.0) as client:
with open("audio.wav", "rb") as f:
resp = client.post(
"https://api.siliconflow.cn/v1/audio/transcriptions",
headers={"Authorization": "Bearer {API_KEY}"},
data={"model": "FunAudioLLM/SenseVoiceSmall", "language": "zh"},
files={"file": ("audio.wav", f, "audio/wav")},
)
text = resp.json()["text"]

方式 B:OpenAI Whisper API

bash
curl -X POST "https://api.openai.com/v1/audio/transcriptions" \
-H "Authorization: Bearer {OPENAI_API_KEY}" \
-F "model=whisper-1" \
-F "language=zh" \
-F "file=@{音频文件路径}"

响应格式与 SiliconFlow 相同。

方式 C:本地 faster-whisper

安装
bash
pip install faster-whisper
调用
python
from faster_whisper import WhisperModel
model = WhisperModel("large-v3-turbo", device="cuda", compute_type="float16")
segments, info = model.transcribe(
"audio.wav",
language="zh",
initial_prompt="以下是普通话的句子,使用正确的标点符号,包括句号、逗号、问号等。",
)
text = "".join(seg.text for seg in segments)
print(text)
模型选择
模型大小速度质量
tiny~75MB最快一般
base~150MB快可用
small~500MB中等较好
large-v3-turbo~1.5GB较慢最佳
initial_prompt 的作用

initial_prompt 是提示词,引导模型输出风格。上面的提示词让模型倾向输出中文标点和完整句子,避免碎片化断句。

设备选择
python
# 自动检测
import ctranslate2
device = "cuda" if ctranslate2.get_cuda_device_count() > 0 else "cpu"
compute_type = "float16" if device == "cuda" else "int8"

批量处理

python
import os, httpx
files = [f for f in os.listdir("audio") if f.endswith((".wav", ".mp3"))]
os.makedirs("text", exist_ok=True)
with httpx.Client(timeout=600.0) as client:
for f in files:
with open(f"audio/{f}", "rb") as af:
resp = client.post(
"https://api.siliconflow.cn/v1/audio/transcriptions",
headers={"Authorization": "Bearer {API_KEY}"},
data={"model": "FunAudioLLM/SenseVoiceSmall", "language": "zh"},
files={"file": (f, af, "audio/wav")},
)
text = resp.json()["text"]
out = f"text/{os.path.splitext(f)[0]}.txt"
with open(out, "w", encoding="utf-8") as wf:
wf.write(text)
print(f"Done: {f} -> {out} ({len(text)} chars)")

常见问题

401 Unauthorized

API Key 无效或过期。

500 Internal Server Error

音频文件可能损坏或格式不支持。确保是有效音频文件。

识别结果乱码
  • 确保音频是有效格式(WAV 最佳)
  • 本地 Whisper 设置 initial_prompt 引导中文标点
  • 音频质量差可先降噪:ffmpeg -i in.wav -af "highpass=f=200,lowpass=f=3000" out.wav
API 超时

音频太长,加大 timeout 或分段处理。

本地模型下载慢

设置 HuggingFace 镜像:

bash
export HF_ENDPOINT=https://hf-mirror.com

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/rgj1980298/obsidian_sync_public/asr-transcribe/badge)](https://verified-skill.com/skills/rgj1980298/obsidian_sync_public/asr-transcribe)

Something wrong with this skill or its page? Tell us.