# Voice Activity Detector - Speech & Silence Segments (VAD) (`freecamp008/voice-activity-detector`) Actor

Detect speech and silence in any audio or video URL with Silero VAD running on CPU. Get timestamped speech segments, speech ratio and pauses, or download the audio with silence removed or long pauses shortened. No external APIs.

- **URL**: https://apify.com/freecamp008/voice-activity-detector.md
- **Developed by:** [Camp8 fr0](https://apify.com/freecamp008) (community)
- **Categories:** AI, For creators, Developer tools
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 file processeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Voice Activity Detector (Silero VAD): Speech & Silence Detection, Silence Remover

Detect **where people speak** in any audio or video file. Paste links to MP3, WAV, M4A, MP4, WEBM or other media and get **timestamped speech segments**, the **speech-to-silence ratio**, every pause, leading and trailing silence, and optionally a **new audio file with the silence removed or the long pauses shortened**. The detection runs the open-source **Silero VAD** neural network inside the Actor on CPU, so no audio is sent to any third-party API.

### What does Voice Activity Detector do?

- Downloads each audio or video file from its URL and extracts the audio track with ffmpeg (16 kHz mono for analysis)
- Runs **Silero VAD v6** (ONNX) on every 32 ms frame to get a speech probability
- Turns the probabilities into clean **speech segments** with the same hysteresis logic as the official `get_speech_timestamps` (threshold, minimum speech and silence duration, padding, optional maximum segment length)
- Reports **speech ratio**, total speech and silence time, leading/trailing silence, longest pause and a full **silence list**
- Optionally renders a **silence-trimmed audio file** from the original-quality audio: *speech only*, or *long pauses shortened* to a length you choose, with short fades at every cut so there are no clicks

### Key features

- **Neural VAD, not a volume gate**: Silero VAD tells speech apart from music, noise, breathing and room tone, so it works on real recordings where a dB threshold fails
- **Any audio or video format** ffmpeg can read: MP3, WAV, M4A, AAC, OGG, OPUS, FLAC, MP4, MOV, MKV, WEBM, AVI...
- **Language-independent**: trained on speech in 6,000+ languages
- **Fast**: about 200x faster than real time on one CPU core (an hour of audio in about 20 seconds)
- **Silence remover / pause shortener** with MP3, M4A, Opus, FLAC or WAV output
- **Tunable**: threshold, min speech, min silence, padding and max segment length
- **Private**: everything runs inside the Actor container
- **HTTP API (Standby mode)**: call it like a REST endpoint and get the segments in the response
- **Fair billing**: pay per file and per audio minute; failed files are free

### Use cases

- **Speech-to-text pre-processing**: cut long recordings into speech chunks before Whisper or another ASR, skip silence and save compute
- **Podcast and video editing**: remove dead air and shorten long pauses automatically (jump-cut style)
- **Call center and meeting analytics**: talk time, silence ratio, longest pause, response gaps
- **Dataset cleaning**: drop clips without speech, trim leading/trailing silence, measure speech content of audio datasets
- **Voice-note and voicemail triage**: detect empty or silent recordings
- **Subtitle timing**: get speech regions to align captions
- **Lecture and e-learning**: shorten pauses in screen-recording voice-overs

### How to use Voice Activity Detector

#### In Apify Console

1. Click **Try for free** or **Start**.
2. Paste one or more **direct links to audio or video files** into *Audio / video URLs*.
3. Optionally choose an **Output audio file**: *Remove silence* or *Shorten long pauses*.
4. Click **Start**. Each file appears in the **Speech segments** table; trimmed audio files are listed under **Trimmed audio files**.

#### Via the Apify API

```bash
curl -X POST "https://api.apify.com/v2/acts/freecamp008~voice-activity-detector/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mediaUrls": ["https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"],
    "audioOutput": "shortenPauses",
    "maxPauseMs": 400,
    "outputFormat": "mp3"
  }'
```

Or use the [apify-client](https://docs.apify.com/api/client/js/) for JavaScript or Python and read the results from the run's default dataset.

#### Standby mode (instant HTTP endpoint)

The Actor also runs as a persistent web server, which saves the start-up time on every call. Send the input fields as query parameters (arrays comma-separated) or as a JSON body. The response is `{ "count": n, "items": [...] }`.

```bash
## GET
curl "https://freecamp008--voice-activity-detector.apify.actor/?token=YOUR_API_TOKEN&mediaUrls=https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav&threshold=0.5&includeSilences=false"

## POST
curl -X POST "https://freecamp008--voice-activity-detector.apify.actor/?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mediaUrls": ["https://example.com/episode.mp3"], "audioOutput": "removeSilence", "speechPadMs": 150}'
```

**AI agents** can call this Actor and pay per use with **x402** through Apify. No Apify account or subscription is needed: the agent pays for each call.

### Input example

```json
{
  "mediaUrls": [
    "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"
  ],
  "audioOutput": "shortenPauses",
  "maxPauseMs": 500,
  "outputFormat": "mp3",
  "threshold": 0.5,
  "minSpeechDurationMs": 250,
  "minSilenceDurationMs": 100,
  "speechPadMs": 30,
  "maxSpeechDurationSec": 0,
  "includeSilences": true,
  "maxDurationMinutes": 180
}
```

| Field | Description | Default |
|---|---|---|
| `mediaUrls` | Direct links to audio/video files | required |
| `audioOutput` | `none`, `removeSilence` (speech only) or `shortenPauses` | `none` |
| `maxPauseMs` | Pauses longer than this are shortened to it (`shortenPauses`) | `500` |
| `outputFormat` | `mp3`, `m4a`, `opus`, `flac` or `wav` | `mp3` |
| `threshold` | Speech probability threshold (0-1); speech ends below threshold - 0.15 | `0.5` |
| `minSpeechDurationMs` | Ignore speech bursts shorter than this | `250` |
| `minSilenceDurationMs` | Silence needed to end a segment | `100` |
| `speechPadMs` | Padding added around each segment | `30` |
| `maxSpeechDurationSec` | Split longer segments at the best pause (0 = off) | `0` |
| `includeSilences` | Add the `silences` array | `true` |
| `maxDurationMinutes` | Analyze and bill at most this many minutes per file | `180` |

### Output example

One dataset item per file (arrays shortened):

```json
{
  "mediaUrl": "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav",
  "durationSec": 11,
  "analyzedSec": 11,
  "billedMinutes": 1,
  "hasSpeech": true,
  "speechRatio": 0.673,
  "speechSec": 7.4,
  "silenceSec": 3.6,
  "segmentCount": 5,
  "firstSpeechSec": 0.29,
  "lastSpeechEndSec": 10.526,
  "leadingSilenceSec": 0.29,
  "trailingSilenceSec": 0.47,
  "longestSpeechSec": 2.33,
  "longestSilenceSec": 1.06,
  "averageSpeechSegmentSec": 1.48,
  "segments": [
    { "start": 0.29, "end": 2.27, "duration": 1.98, "confidence": 0.76 },
    { "start": 3.33, "end": 3.774, "duration": 0.444, "confidence": 0.47 }
  ],
  "silences": [
    { "start": 0, "end": 0.29, "duration": 0.29 },
    { "start": 2.27, "end": 3.33, "duration": 1.06 }
  ],
  "audioOutput": "shortenPauses",
  "outputAudioUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/pauses-shortened-8ff172c0ce31fce3",
  "outputFormat": "mp3",
  "outputDurationSec": 9.6,
  "outputSizeBytes": 193350,
  "removedSec": 1.4,
  "settings": { "threshold": 0.5, "minSpeechDurationMs": 250, "minSilenceDurationMs": 100, "speechPadMs": 30, "maxSpeechDurationSec": 0 },
  "processingSec": 1.47,
  "truncated": false,
  "truncatedReason": null
}
```

All times are in seconds from the start of the file. `confidence` is the mean speech probability inside the segment. `speechSec` includes the padding. When a file is longer than `maxDurationMinutes`, or the remaining run budget doesn't cover the whole file, only the beginning is analyzed and the item has `truncated: true`. When a file can't be downloaded or decoded, you get `{ "mediaUrl", "error", "isError": true }` for it, and that item is free.

### Pricing

This Actor uses **pay-per-event** pricing:

| Event | Price | Per 1,000 |
|---|---|---|
| `file-processed`: one audio or video file analyzed | $0.001 | **$1 per 1,000 files** |
| `audio-minute`: one started minute of analyzed audio (rounded up per file) | $0.002 | **$2 per 1,000 minutes** |

Examples: a 1-hour podcast costs 60 × $0.002 + $0.001 = **$0.121**, including the trimmed audio file. 1,000 voice notes of 20 seconds each cost 1,000 × ($0.002 + $0.001) = **$3**.

Failed downloads and unreadable files are not charged. Apify platform usage (compute units) is billed separately, according to the memory you choose and how long the run takes. 1 GB of memory is enough for most files.

### FAQ

**How accurate is it?**
Silero VAD is one of the most accurate open-source voice activity detectors and is widely used in front of Whisper and other speech recognizers. On clean speech, segment boundaries are within a few tens of milliseconds of the real speech edges. In our tests it found no speech in solo piano music and in synthetic noise, while matching the pauses of an old radio speech to within about 30 ms. Singing is often detected as speech, and loud background chatter counts as speech too: raise the `threshold` (0.6-0.8) if you only want a dominant foreground voice.

**How do I get sentence-level chunks instead of word groups?**
Increase `minSilenceDurationMs` to 500-1000 ms. To cap chunk length for speech-to-text (e.g. 30 s for Whisper), set `maxSpeechDurationSec`; long segments are then split at the best pause.

**What do "Remove silence" and "Shorten long pauses" produce?**
*Remove silence* keeps only the speech segments (with `speechPadMs` padding on each side) and joins them. *Shorten long pauses* keeps the whole recording but cuts every pause longer than `maxPauseMs` down to that length, which sounds natural. Both are cut sample-accurately from the original-quality audio (up to 48 kHz stereo) with 8 ms fades. Video inputs produce an audio-only file; the video track is not re-cut.

**What are the limits?**
Each file is capped at `maxDurationMinutes` (default 180, up to 600) and 2 GB when an output audio file is requested. Analysis takes roughly 5 ms of CPU per second of audio, so even multi-hour files finish quickly. The link must be a direct media URL; YouTube or podcast web pages that embed a player don't work.

**Which languages work?**
Any language. Silero VAD detects human speech, not words, and was trained on thousands of languages.

**Is my audio private?**
Yes. The Silero model runs inside the Actor container. Your audio is never sent to any third-party service; results and trimmed files are stored only in your own Apify storage.

**Which licenses apply?**
Silero VAD is MIT-licensed (snakers4/silero-vad). ffmpeg is used as a separate LGPL/GPL program from Debian, and onnxruntime is MIT.

**Is it legal to analyze audio and video?**
Detecting speech in media is legal when you own the content, have permission, or the content is public domain or openly licensed. Respect copyright and privacy laws, including consent rules for recorded conversations in your jurisdiction.

# Actor input Schema

## `mediaUrls` (type: `array`):

Direct links to audio or video files (MP3, WAV, M4A, AAC, OGG, OPUS, FLAC, MP4, MOV, MKV, WEBM, ...). Each file becomes one result with its speech segments. The link must return the media file itself, not a web page with a player.

## `audioOutput` (type: `string`):

<b>None</b>: only return the speech/silence timeline. <b>Remove silence</b>: save an audio file that contains only the detected speech (plus the speech padding). <b>Shorten long pauses</b>: keep everything but shorten every pause longer than <i>Max pause length</i>, for natural-sounding podcasts, voice-overs and lectures. Files are saved to the key-value store (<code>outputAudioUrl</code>).

## `maxPauseMs` (type: `integer`):

Used by <b>Shorten long pauses</b>: every silence longer than this is cut down to this length. Leading and trailing silence is cut to half of it.

## `outputFormat` (type: `string`):

Format of the trimmed audio file. MP3/M4A 160 kbps, Opus 96 kbps, FLAC/WAV lossless. Video inputs produce an audio-only file.

## `threshold` (type: `number`):

Speech probability (0-1) above which a 32 ms frame counts as speech. Lower it (0.3-0.4) for quiet or noisy recordings, raise it (0.6-0.8) to ignore background voices and noise. Speech ends when the probability falls below threshold - 0.15.

## `minSpeechDurationMs` (type: `integer`):

Speech bursts shorter than this are ignored (clicks, coughs, short noises).

## `minSilenceDurationMs` (type: `integer`):

A speech segment only ends after at least this much silence. Higher values merge words and sentences into longer segments (e.g. 500-1000 ms for sentence-level chunks).

## `speechPadMs` (type: `integer`):

Extra time added before and after every speech segment so that word onsets and endings are not clipped.

## `maxSpeechDurationSec` (type: `integer`):

Split speech segments longer than this at the best pause inside them (useful to make chunks for speech-to-text). 0 = no limit.

## `includeSilences` (type: `boolean`):

Add a <code>silences</code> array (all gaps between speech, including leading and trailing silence) to each result.

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

Only the first N minutes of each file are analyzed (and billed). Longer files are marked <code>truncated: true</code>.

## Actor input object example

```json
{
  "mediaUrls": [
    "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"
  ],
  "audioOutput": "none",
  "maxPauseMs": 500,
  "outputFormat": "mp3",
  "threshold": 0.5,
  "minSpeechDurationMs": 250,
  "minSilenceDurationMs": 100,
  "speechPadMs": 30,
  "maxSpeechDurationSec": 0,
  "includeSilences": true,
  "maxDurationMinutes": 180
}
```

# Actor output Schema

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

No description

## `audioFiles` (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 = {
    "mediaUrls": [
        "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("freecamp008/voice-activity-detector").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 = { "mediaUrls": ["https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"] }

# Run the Actor and wait for it to finish
run = client.actor("freecamp008/voice-activity-detector").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 '{
  "mediaUrls": [
    "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav"
  ]
}' |
apify call freecamp008/voice-activity-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,freecamp008/voice-activity-detector"
        }
    }
}
```

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/uZ9twf8hGJprWWJgx/builds/Mxpd9dKCeKPHhwu7o/openapi.json
