Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
<!DOCTYPE html>
<html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>用 FunASR 做说话人分离:一次调用输出「谁在何时说了什么」 | FunASR</title><meta name="description" content="FunASR 一次 generate 调用即可同时输出语音转写、说话人标签和句级时间戳,无需 pyannote+Whisper 两件套、无需 HuggingFace 授权。实测 227 秒会议录音自动切分 77 句、区分 11 个说话人。"><meta name="keywords" content="说话人分离, speaker diarization, 说话人识别, pyannote 替代, 会议转写, 谁在说话, FunASR, cam++, 语音识别说话人, 会议纪要">
<link rel="icon" href="/logo.png"><meta property="og:title" content="用 FunASR 做说话人分离:一次调用输出「谁在何时说了什么」"><meta property="og:description" content="FunASR 一次 generate 调用即可同时输出语音转写、说话人标签和句级时间戳,无需 pyannote+Whisper 两件套、无需 HuggingFace 授权。实测 227 秒会议录音自动切分 77 句、区分 11 个说话人。">
<meta property="og:type" content="article"><meta property="og:url" content="https://www.funasr.com/blog/funasr-speaker-diarization.html"><meta property="og:image" content="https://www.funasr.com/logo.png">
<link rel="canonical" href="https://www.funasr.com/blog/funasr-speaker-diarization.html"><link rel="alternate" hreflang="en" href="https://www.funasr.com/en/blog/funasr-speaker-diarization.html"><link rel="alternate" hreflang="zh" href="https://www.funasr.com/blog/funasr-speaker-diarization.html"><link rel="alternate" hreflang="x-default" href="https://www.funasr.com/en/blog/funasr-speaker-diarization.html">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","headline":"用 FunASR 做说话人分离:一次调用输出「谁在何时说了什么」","description":"FunASR 一次 generate 调用即可同时输出语音转写、说话人标签和句级时间戳,无需 pyannote+Whisper 两件套、无需 HuggingFace 授权。实测 227 秒会议录音自动切分 77 句、区分 11 个说话人。","datePublished":"2026-06-17","dateModified":"2026-06-17","author":{"@type":"Organization","name":"FunASR / Tongyi Lab"},"publisher":{"@type":"Organization","name":"FunASR","logo":{"@type":"ImageObject","url":"https://www.funasr.com/logo.png"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://www.funasr.com/blog/funasr-speaker-diarization.html"},"image":"https://www.funasr.com/logo.png"}
</script>
<style>:root{--primary:#2563eb;--primary-dark:#1d4ed8;--bg:#fff;--surface:#f8fafc;--border:#e2e8f0;--text:#0f172a;--text-soft:#475569;--text-muted:#94a3b8;--radius:12px}
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Inter',-apple-system,sans-serif;color:var(--text);line-height:1.7}
a{color:var(--primary);text-decoration:none}a:hover{text-decoration:underline}
.container{max-width:800px;margin:0 auto;padding:0 24px}
.nav{position:fixed;top:0;left:0;right:0;z-index:100;background:rgba(255,255,255,0.9);backdrop-filter:blur(12px);border-bottom:1px solid var(--border);padding:14px 0}
.nav .container{max-width:1120px;display:flex;align-items:center;gap:24px}
.nav-logo{font-size:1.2rem;font-weight:800;color:var(--text)}.nav-logo span{color:var(--primary)}
.nav-links{display:flex;gap:20px;margin-left:auto;flex-wrap:wrap}
.nav-links a{font-size:0.85rem;font-weight:500;color:var(--text-soft)}
.nav-btn{padding:7px 16px;background:var(--primary);color:#fff;border-radius:7px;font-size:0.83rem;font-weight:600}
article{padding:120px 0 80px}
h1{font-size:2rem;font-weight:800;line-height:1.3;margin-bottom:14px}
h2{font-size:1.3rem;font-weight:700;margin:36px 0 14px;padding-top:16px;border-top:1px solid var(--border)}
h3{font-size:1.05rem;font-weight:700;margin:22px 0 10px}
p{margin-bottom:14px;color:var(--text-soft)}
ul,ol{margin:0 0 14px 22px;color:var(--text-soft)}li{margin-bottom:6px}
table{width:100%;border-collapse:collapse;margin:16px 0;font-size:0.86rem}
th,td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--border)}
th{font-weight:600;background:var(--surface);font-size:0.78rem;color:var(--text-muted)}
pre{background:#1e293b;color:#e2e8f0;padding:18px;border-radius:10px;overflow-x:auto;font-size:0.82rem;line-height:1.7;margin:14px 0}
code{font-family:ui-monospace,Menlo,monospace}
p code,li code{background:var(--surface);padding:2px 6px;border-radius:5px;font-size:0.85em;color:var(--primary-dark)}
.post-meta{color:var(--text-muted);font-size:0.85rem;margin-bottom:24px}
.cta{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:24px;margin:28px 0;text-align:center}
.cta a.btn{display:inline-block;padding:10px 24px;background:var(--primary);color:#fff;border-radius:8px;font-weight:600}
.post-list{list-style:none;margin:0;padding:0}
.post-list li{margin:0 0 8px}
.post-card{display:block;border:1px solid var(--border);border-radius:var(--radius);padding:20px 22px;margin-bottom:14px}
.post-card:hover{border-color:var(--primary);text-decoration:none}
.post-card h2{border:none;padding:0;margin:0 0 6px;font-size:1.15rem;color:var(--text)}
.post-card p{margin:0;color:var(--text-soft);font-size:0.9rem}
.post-card .date{color:var(--text-muted);font-size:0.8rem}
footer{background:#0f172a;color:#94a3b8;padding:28px 0;text-align:center;font-size:0.8rem}
footer a{color:#94a3b8}</style></head><body>
<nav class="nav"><div class="container"><a href="/" class="nav-logo">Fun<span>ASR</span></a><div class="nav-links"><a href="/#capabilities">核心能力</a><a href="/#usage">如何使用</a><a href="/#benchmark">性能</a><a href="/#demo">演示</a><a href="https://modelscope.github.io/FunASR/zh/" target="_blank">文档</a><a href="/quickstart.html">快速上手</a><a href="/models.html">模型</a><a href="/ecosystem.html">生态</a><a href="/blog/">技术博客</a><a href="/vs-whisper.html">对比 Whisper</a><a href="/donors.html">功德榜</a></div><a href="https://www.funasr.com/en/blog/funasr-speaker-diarization.html" style="font-size:0.83rem;font-weight:600;color:var(--text-soft)">EN</a><a href="https://github.com/modelscope/FunASR" target="_blank" class="nav-btn">GitHub ★</a></div></nav>
<article><div class="container">
<h1>用 FunASR 做说话人分离:一次调用输出「谁在何时说了什么」</h1>
<p class="post-meta">FunASR 技术博客 · 2026-06-17 · 教程</p>
<p>做会议纪要、客服质检、访谈整理时,你不只想知道<strong>说了什么</strong>,还想知道<strong>每句话是谁说的</strong>。这件事叫<strong>说话人分离(Speaker Diarization)</strong>。</p>
<p>常见做法是把两个工具拼起来:<strong>pyannote.audio</strong> 负责切分说话人 + <strong>Whisper</strong> 负责转写,再手动把时间轴对齐。这套流程要申请 HuggingFace 授权、装一堆依赖、自己写对齐逻辑,而且对中文不算友好。</p>
<p><strong>用 FunASR,一次 <code>generate()</code> 调用就够了。</strong>VAD、语音识别、标点、说话人嵌入(CAM++)被串成一条流水线,直接返回每一句的<strong>说话人编号、时间戳和文本</strong>。</p>
<h2>安装</h2>
<pre><code>pip install -U funasr modelscope</code></pre>
<h2>完整代码</h2>
<pre><code>from funasr import AutoModel
# One model handle = VAD + ASR + punctuation + speaker embedding (CAM++)
model = AutoModel(
model="paraformer-zh", # or "iic/SenseVoiceSmall"
vad_model="fsmn-vad",
punc_model="ct-punc",
spk_model="cam++", # speaker diarization
)
res = model.generate(input="meeting.wav", batch_size_s=300)
for s in res[0]["sentence_info"]:
print(f'[{s["start"]/1000:.1f}s-{s["end"]/1000:.1f}s] '
f'speaker {s["spk"]}: {s["sentence"]}')</code></pre>
<h2>输出长这样(示例)</h2>
<pre><code>[0.0s-3.2s] speaker 0: 大家好,今天的会议主要讨论第三季度的产品规划。
[3.5s-7.1s] speaker 1: 我先同步一下进度,核心功能已经完成了百分之八十。
[7.4s-9.9s] speaker 2: 测试这边可能还需要两周时间。
[10.2s-13.6s] speaker 0: 好的,那我们把上线时间往后调一周。</code></pre>
<p>每个 <code>sentence_info</code> 元素包含四个字段:</p>
<table><thead><tr><th>字段</th><th>含义</th></tr></thead><tbody>
<tr><td><code>spk</code></td><td>说话人编号,CAM++ 自动聚类得到,<strong>无需事先指定人数</strong></td></tr>
<tr><td><code>start</code> / <code>end</code></td><td>该句的起止时间(毫秒)</td></tr>
<tr><td><code>sentence</code></td><td>该句文本(已加标点)</td></tr>
</tbody></table>
<h2>实测效果</h2>
<p>我们在一段 <strong>227 秒的多人会议录音</strong>上实测:FunASR 自动切分出 <strong>77 个句子</strong>、区分出 <strong>11 个不同说话人</strong>,全程<strong>不需要预先告诉它有几个人</strong>。整条流水线只用一次 <code>generate()</code> 调用、一个 Python 依赖。</p>
<h2>为什么用 FunASR 而不是 pyannote + Whisper</h2>
<ul>
<li><strong>一个调用,不用对齐</strong>:转写和说话人标签天然对齐,不必自己拼时间轴。</li>
<li><strong>不需要 HuggingFace 授权</strong>:pyannote 的说话人模型是 gated 的,要申请、要 token;FunASR 模型公开可下载。</li>
<li><strong>中文更准</strong>:Paraformer / SenseVoice 在中文上 CER 显著低于 Whisper(<a href="/blog/funasr-vs-whisper-benchmark.html">实测对比</a>)。</li>
<li><strong>CPU 也能跑</strong>:没有 GPU 也能离线出结果。</li>
</ul>
<h2>进阶</h2>
<ul>
<li>把 <code>model="paraformer-zh"</code> 换成 <code>"iic/SenseVoiceSmall"</code> 即可用 SenseVoice(还自带情感/事件标签)。</li>
<li>遍历 <code>sentence_info</code> 即可导出 <strong>SRT 字幕</strong>或按说话人聚合成<strong>会议纪要</strong>。</li>
</ul>
<div class="cta"><p>FunASR 是通义实验室开源的工业级语音识别工具包,中文场景又快又准。</p><a class="btn" href="https://github.com/modelscope/FunASR" target="_blank">在 GitHub 上 Star FunASR ★</a></div>
<!--related-posts-->
<h2>相关文章</h2>
<ul class="post-list">
<li><a href="/blog/funasr-vs-whisper-benchmark.html">FunASR vs Whisper 实测对比</a></li>
<li><a href="/blog/sensevoice-deployment-guide.html">SenseVoice 部署指南</a></li>
<li><a href="/blog/fun-asr-nano-guide.html">Fun-ASR-Nano 使用指南</a></li>
<li><a href="/blog/sensevoice-emotion-language-detection.html">情感与语种检测</a></li>
<li><a href="/blog/funasr-realtime-streaming-asr.html">实时流式语音识别</a></li>
<li><a href="/blog/funasr-transcribe-long-audio.html">转写超长音频(1小时一次搞定)</a></li>
<li><a href="/blog/funasr-cli-transcribe-command-line.html">命令行转写(文本/JSON/SRT)</a></li>
<li><a href="/blog/self-hosted-openai-whisper-api-alternative.html">自托管 OpenAI Whisper API 替代</a></li>
<li><a href="/blog/generate-subtitles-srt-vtt-from-audio-video.html">自动生成字幕(SRT / VTT)</a></li>
<li><a href="/blog/speech-to-text-python-transcribe-audio.html">Python 语音转文字教程</a></li>
<li><a href="/blog/funasr-llama-cpp-whisper-cpp-alternative.html">FunASR 跑进 llama.cpp(whisper.cpp 替代)</a></li>
<li><a href="/blog/funasr-vs-faster-whisper-chinese.html">FunASR vs faster-whisper(中文/粤语)</a></li>
<li><a href="/blog/lightweight-speech-recognition-cpu.html">轻量语音识别(CPU 250MB)</a></li>
<li><a href="/blog/self-hosted-deepgram-assemblyai-alternative.html">自托管替代 Deepgram/AssemblyAI</a></li>
<li><a href="/blog/which-funasr-model.html">选哪个 FunASR 模型</a></li>
<li><a href="/blog/cantonese-speech-recognition.html">粤语语音识别(SenseVoice 原生粤语)</a></li>
<li><a href="/blog/japanese-speech-recognition.html">日语语音识别(SenseVoice 转写+标点+情感)</a></li>
<li><a href="/blog/voice-activity-detection-python.html">Python 语音活动检测(VAD)</a></li>
<li><a href="/blog/self-hosted-google-aws-azure-speech-to-text.html">自托管替代 Google/AWS/Azure 云语音 API</a></li>
<li><a href="/blog/chinese-speech-recognition.html">中文语音识别(普通话)实战</a></li>
<li><a href="/blog/punctuation-restoration-python.html">标点恢复 Python 实战</a></li>
<li><a href="/blog/speech-to-text-timestamps-python.html">语音识别带时间戳(字级)</a></li>
</ul>
</div></article>
<footer><div class="container">FunASR · 通义实验室开源语音识别 · <a href="https://github.com/modelscope/FunASR">GitHub</a></div></footer>
</body></html>