# Speaker Diarization – Who Spoke When, Speaker Labels for Audio (`gazidev/speaker-diarization`) Actor

Who spoke when in interviews, podcasts, meetings and calls. Give audio or video URLs, get speaker turns with start/end times, talk time per speaker, RTTM and SRT/VTT with speaker tags, plus an optional Whisper transcript with speaker labels. Open-source models on CPU, no API key. $0.005 per minute.

- **URL**: https://apify.com/gazidev/speaker-diarization.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 audio minute diarizeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Speaker Diarization – Who Spoke When in Audio & Video (Speaker Labels, RTTM, SRT)

**Speaker diarization** answers *who spoke when*. Give this Actor links to interviews, podcasts, meetings, calls or videos and it returns every **speaker turn with start and end times**, the **talk time of each speaker**, and ready-to-use **RTTM, SRT and WebVTT files with speaker tags**. A **Whisper transcript with speaker labels** is optional.

It runs open-source models on CPU (no API key, no account anywhere else) and costs **$0.005 per audio minute**.

### What it does

- **Finds speech and skips silence:** Silero VAD finds the speech, so music beds and pauses are never labelled as a "speaker".
- **Tells voices apart:** SpeechBrain ECAPA-TDNN speaker embeddings (trained on VoxCeleb, Apache-2.0) feed a clustering step that **estimates the number of speakers automatically**. You can also fix the count (`numSpeakers`) or give a range (`minSpeakers` / `maxSpeakers`).
- **Speaker timeline:** you get turns `{speaker, start, end}` and per-speaker talk time, share and number of turns. It also flags `possibleOverlapSec`, the seconds where the voice evidence is split (crosstalk or unclear audio).
- **Files:** RTTM (NIST format, the standard input for diarization scoring tools), SRT and WebVTT with speaker tags, and the full JSON result. Each is saved to the run's key-value store and linked from the dataset row.
- **Optional transcript (`withTranscript`):** Whisper base, 99 languages, every line labelled "Speaker 1", "Speaker 2"…
- **Your own files:** works with direct links (mp3, m4a, wav, ogg, opus, flac, mp4, mov, webm, mkv…) and with Dropbox, Google Drive and OneDrive share links. You can also upload files in the Console.
- **Clear errors, never charged:** dead links, web pages, files with no audio, silent files and blocked platforms each get a row that explains the problem.

#### What it does not do

- **It does not identify people by name.** Speakers are labelled "Speaker 1", "Speaker 2"… in order of first appearance. Map them to names yourself, e.g. by checking who says the first line.
- **It does not download from YouTube, TikTok, Instagram, Spotify, Facebook, X, Vimeo or SoundCloud**: their terms do not allow it. Use a direct link to a recording you have the right to process. Private-network addresses are refused as well.
- **Overlapping speech gets one label.** When two people talk at once, the louder or longer voice wins that moment.

### How this differs from our other speech Actors

| Actor | Sells | Speaker labels |
|---|---|---|
| **Speaker Diarization (this one)** | **The speaker timeline itself**: turns, talk time, RTTM. No transcript cost unless you want one | Always, $0.005/min |
| [Audio & Video Transcription](https://apify.com/gazidev/media-transcriber) | Transcripts, podcast RSS feeds, translation | Add-on, $0.008/min on top of $0.009/min |
| [Speech to Text](https://apify.com/gazidev/speech-to-text) | Cheapest plain transcripts ($0.006/min) | No |
| [Video to SRT](https://apify.com/gazidev/video-to-srt) | Subtitle files from video | No |
| [Add Subtitles to Video](https://apify.com/gazidev/video-auto-subtitles) | Burned-in captions | No |

Use this Actor when you need **who spoke when** and talk time: editing (cut by speaker), call and meeting analytics (talk ratio, interruptions), labelling training data, or splitting a podcast into host and guest parts. With `withTranscript: true` you get the transcript with speakers in the same run.

### Use cases

- **Podcast and video editing:** jump to each guest's answers; make per-speaker clips; find long monologues.
- **Sales calls and meetings:** talk-time ratio (how much did the rep vs. the customer talk?), number of turns, longest turn.
- **Interviews and research:** a speaker-labelled transcript for qualitative coding; RTTM for annotation tools.
- **Dataset building:** speaker segments for voice datasets or ASR fine-tuning.
- **AI agents:** give an LLM the speaker-labelled transcript to summarize "what each person said".

### Input example

```json
{
  "audioUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_Remarks_in_a_Telephone_Conversation_with_Astronaut_Shannon_Lucid_-_DPLA_-_e526320f91c66d774cde564cf1fb2dc1.mp3"
  ],
  "numSpeakers": 0,
  "withTranscript": false,
  "outputFormats": ["rttm", "srt"]
}
```

- `numSpeakers`: 0 = automatic. **If you know the number (2 for an interview), set it**: this gives the biggest accuracy gain.
- `minSpeakers` / `maxSpeakers`: bounds for the automatic count (defaults 1 and 10).
- `withTranscript`: adds a Whisper transcript with speaker labels (extra charge, see Pricing). `language`: `auto` or a code such as `en`, `de`, `es`.
- `outputFormats`: any of `json`, `rttm`, `srt`, `vtt`.
- `maxDurationMinutes` (default 120, max 180): longer files are processed up to that point and billed only for it.
- `uploadedFiles` + `uploadStore`: upload recordings in the Console (select the same key-value store in both fields).

### Output example

One row per file (shortened; from the pre-filled demo, a 1996 public-domain phone call between President Clinton and astronaut Shannon Lucid):

```json
{
  "type": "diarization",
  "url": "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_…_Shannon_Lucid_….mp3",
  "status": "ok",
  "durationSec": 169.09,
  "billableMinutes": 3,
  "speakerCount": 2,
  "speechSec": 103.8,
  "possibleOverlapSec": 0.0,
  "speakers": [
    {"label": "Speaker 1", "talkSec": 49.7, "talkShare": 0.453, "turns": 26},
    {"label": "Speaker 2", "talkSec": 60.0, "talkShare": 0.547, "turns": 16}
  ],
  "turnCount": 42,
  "turns": [
    {"speaker": "Speaker 1", "start": 0.0, "end": 0.6},
    {"speaker": "Speaker 1", "start": 3.8, "end": 6.7},
    {"speaker": "Speaker 2", "start": 7.1, "end": 11.8},
    {"speaker": "Speaker 1", "start": 12.7, "end": 16.8}
  ],
  "rttm": "SPEAKER 002-Audio-Recording-of-President-Clinton-s-R 1 0.000 0.600 <NA> <NA> speaker_1 <NA> <NA>\n…",
  "srt": "1\n00:00:00,000 --> 00:00:00,600\nSpeaker 1\n…",
  "rttmUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/002-Audio-Recording-of-President-Clinton-s-R.rttm",
  "srtUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/002-Audio-Recording-of-President-Clinton-s-R.srt",
  "error": null
}
```

With `withTranscript: true` the row also has `transcript` (paragraphs headed `Speaker 1: …`), `transcriptSegments` `[{start, end, text, speaker}]` and `language`, and the SRT/VTT cues hold the spoken text with `[Speaker N]` tags or `<v Speaker N>` voices.

The dataset has four views: **Speakers** (talk time), **Speaker turns**, **Transcripts** and **Errors**. The run's `OUTPUT` record summarizes files, minutes and timing.

### Pricing

Pay per event: you pay only for audio that was processed.

| Event | Price | When |
|---|---|---|
| `minute-diarized` | **$0.005** per started audio minute | Each file's minutes, after its result is saved |
| `minute-transcribed` | $0.006 per started audio minute | Only with `withTranscript: true` |
| Actor start | $0.00005 | Once per run |

**Free:** failed downloads, web pages, blocked platforms, files without audio, files with no speech, and minutes cut by `maxDurationMinutes`. The **Maximum cost per run** you set is respected: the Actor processes only the minutes it can still charge, then stops cleanly and lists the files it did not start.

Example: a 45-minute interview costs 45 × $0.005 = **$0.225** for speakers only, or **$0.495** with the transcript.

How that compares (Apify Store, 16 Nov 2026, free-tier prices):

| Actor | Diarization price |
|---|---|
| **This Actor** | **$0.005/min** (+$0.006/min if you also want the transcript) |
| amanatools/speaker-diarization | $0.007/min + $0.005 per file |
| tinplatelabs/transcriber | $0.007/min transcript + $0.003/min diarization (transcript required) |
| amanatools/whisper-transcriber | $0.008/min + $0.0025/min speaker labels + $0.005 per file |
| lergassy/speech-to-text | $0.009/min + $0.006/min speaker labels |

If you also need a transcript, the bundles of tinplatelabs and amanatools ($0.010–0.0105/min) are about the same as ours ($0.011/min). This Actor is cheaper when you need **only the speaker timeline**.

### Accuracy and limits (honest notes)

- Measured on our tests: on synthetic conversations of 1–5 different voices, it found the right number of speakers in 14 of 15 cases, with about 10% of speech time mislabelled (no forgiveness at turn edges). On real public-domain recordings it found 2 speakers in a 1996 phone call and in a noisy red-carpet interview, and 1 in single-narrator readings. It also missed cases: in two short studio language-course dialogues (French, German) with similar-sounding voices it found only 1 speaker, and even when forced to 2 the split was poor.
- **Hard cases:** very short turns (under ~1 s: "yes", "mm-hm") often go to the neighbouring speaker. So do voices that sound alike (same gender, same microphone), noisy archive recordings, and phone audio with music. Setting `numSpeakers` helps most.
- The timeline resolution is 0.1 s. Turns are cut at pauses and speaker changes; a speaker's pauses of up to 0.5 s are joined into one turn.
- Speed on Apify: about 6–8 CPU-seconds per audio minute without the transcript, plus model loading (a few seconds per run). Use **4 GB memory for files over about 1 hour** (2 GB default).

### FAQ

**Can it tell me the names of the speakers?** No. It labels voices consistently within one file (Speaker 1 = whoever speaks first). Labels are not linked across files.

**Which languages?** Diarization works on voices, so the language does not matter. The optional transcript supports Whisper's 99 languages.

**Can I use a YouTube link?** No: YouTube's terms forbid downloading with third-party tools. Upload your own file, or use a direct link (Dropbox, Google Drive, S3, your CDN, a podcast episode's .mp3).

**What is RTTM?** A plain-text format (one `SPEAKER` line per turn) used by diarization tools and scoring scripts such as `pyannote.metrics` and `dscore`.

**Is my audio stored?** Downloaded files are deleted after processing. Only the results (JSON, RTTM, SRT, VTT) are saved in your run's storage.

### Use with AI agents / Apify MCP

- **Apify MCP server:** add the Actor to Claude Desktop, Cursor or VS Code with `https://mcp.apify.com?actors=gazidev/speaker-diarization`. An agent can call it with `{"audioUrls":["https://…/meeting.m4a"],"numSpeakers":3,"withTranscript":true}` and summarize what each speaker said, or compute talk-time ratios from `speakers`.
- **API:** `POST https://api.apify.com/v2/acts/gazidev~speaker-diarization/run-sync-get-dataset-items?token=…` with the input JSON returns the rows directly for short files; use the asynchronous run API for long recordings.
- **Automation:** connect the run to Make, Zapier, n8n or a webhook. The fields `speakers`, `turns` and `transcript` are LLM-friendly.

### More from the toolkit

- [Audio & Video Transcription](https://apify.com/gazidev/media-transcriber): Whisper transcripts, podcast RSS feeds, translation to English.
- [Speech to Text](https://apify.com/gazidev/speech-to-text): low-cost plain transcripts.
- [Video to SRT](https://apify.com/gazidev/video-to-srt) and [Add Subtitles to Video](https://apify.com/gazidev/video-auto-subtitles): subtitle files and burned-in captions.
- [Extract Audio from Video](https://apify.com/gazidev/extract-audio-from-video): turn a video into an mp3 or m4a first.

# Actor input Schema

## `audioUrls` (type: `array`):

Direct links to audio or video files: mp3, m4a, wav, ogg, opus, flac, aac, mp4, mov, webm, mkv and more. S3/CDN links, Dropbox, Google Drive ('Anyone with the link') and OneDrive share links work. **YouTube, TikTok, Instagram, Spotify, Facebook, X, Vimeo and SoundCloud page links are rejected** (their terms forbid downloading), and so are private-network addresses. Only submit recordings you have the right to process. The demo: a one-narrator LibriVox reading and a public-domain two-person phone call (President Clinton and astronaut Shannon Lucid, 1996).

## `numSpeakers` (type: `integer`):

If you know how many people talk (e.g. 2 for an interview), set it: this is the single biggest accuracy gain. 0 = estimate the count per file.

## `minSpeakers` (type: `integer`):

Lower bound for the automatic count. Ignored when 'Number of speakers' is set.

## `maxSpeakers` (type: `integer`):

Upper bound for the automatic count. Ignored when 'Number of speakers' is set.

## `withTranscript` (type: `boolean`):

Also transcribe the speech (Whisper base, 99 languages) and label every line with its speaker. Charged as an extra event per minute (see Pricing). Off = speaker timeline only.

## `language` (type: `string`):

Only used with the transcript. 'auto' detects it; or a code such as en, es, de, fr, pt, it, nl, tr, ru, ja, zh, ar, hi.

## `outputFormats` (type: `array`):

Saved to the run's key-value store; each row links to them. The dataset row always holds the turns, the RTTM and the SRT text.

## `maxDurationMinutes` (type: `integer`):

Longer files are processed up to this point (and billed only for it). Use 4 GB memory for files over about 1 hour.

## `maxFileSizeMB` (type: `integer`):

Larger downloads are refused (free error row).

## `downloadTimeoutSecs` (type: `integer`):

Per file.

## `uploadedFiles` (type: `array`):

This Actor runs with limited permissions, so ALSO select the store you uploaded into in 'Key-value store with your uploads'. When you upload files, the pre-filled demo URLs are ignored.

## `uploadStore` (type: `string`):

Grants this run read access to that store only. If 'uploadedFiles' points into it, only those files are processed; otherwise every media file in the store is (up to 1,000).

## Actor input object example

```json
{
  "audioUrls": [
    "https://archive.org/download/spc141_1503_librivox/spc141_spiderandfly_lcw_64kb.mp3",
    "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_Remarks_in_a_Telephone_Conversation_with_Astronaut_Shannon_Lucid_-_DPLA_-_e526320f91c66d774cde564cf1fb2dc1.mp3"
  ],
  "numSpeakers": 0,
  "minSpeakers": 1,
  "maxSpeakers": 10,
  "withTranscript": false,
  "language": "auto",
  "outputFormats": [
    "rttm",
    "srt"
  ],
  "maxDurationMinutes": 120,
  "maxFileSizeMB": 2000,
  "downloadTimeoutSecs": 900
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `turns` (type: `string`):

No description

## `transcripts` (type: `string`):

No description

## `errors` (type: `string`):

No description

## `files` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "audioUrls": [
        "https://archive.org/download/spc141_1503_librivox/spc141_spiderandfly_lcw_64kb.mp3",
        "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_Remarks_in_a_Telephone_Conversation_with_Astronaut_Shannon_Lucid_-_DPLA_-_e526320f91c66d774cde564cf1fb2dc1.mp3"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/speaker-diarization").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "audioUrls": [
        "https://archive.org/download/spc141_1503_librivox/spc141_spiderandfly_lcw_64kb.mp3",
        "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_Remarks_in_a_Telephone_Conversation_with_Astronaut_Shannon_Lucid_-_DPLA_-_e526320f91c66d774cde564cf1fb2dc1.mp3",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gazidev/speaker-diarization").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "audioUrls": [
    "https://archive.org/download/spc141_1503_librivox/spc141_spiderandfly_lcw_64kb.mp3",
    "https://upload.wikimedia.org/wikipedia/commons/7/77/Audio_Recording_of_President_Clinton%27s_Remarks_in_a_Telephone_Conversation_with_Astronaut_Shannon_Lucid_-_DPLA_-_e526320f91c66d774cde564cf1fb2dc1.mp3"
  ]
}' |
apify call gazidev/speaker-diarization --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/speaker-diarization"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1Gz8AD8VZWvWIBNSB/builds/GV0ROVIPSwuQIQfYd/openapi.json
