# Transcript Cleaner: SRT/VTT Subtitles to Text & RAG Chunks (`open-data-tools/srt-vtt-transcript-cleaner`) Actor

Clean SRT, VTT and transcript text: remove timestamps, fillers (um, uh), speaker labels, \[Music] tags and repeated YouTube caption lines. Get clean text, paragraphs or RAG chunks with token limit, overlap and timestamps. Reads transcript scraper datasets. $1 per 1,000.

- **URL**: https://apify.com/open-data-tools/srt-vtt-transcript-cleaner.md
- **Developed by:** [Open Data Tools](https://apify.com/open-data-tools) (community)
- **Categories:** AI, Developer tools, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 transcript cleaneds

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

## Transcript Cleaner: SRT/VTT Subtitles to Text & RAG Chunks

Turn messy transcripts and subtitle files into clean text you can read, search, summarize or embed. This transcript cleaner takes **SRT** and **VTT** subtitle files, YouTube "Show transcript" copies, Otter, Rev, Zoom and Teams exports, Whisper or AssemblyAI JSON, or the dataset of any **YouTube, TikTok, Loom or podcast transcript scraper**, and gives back clean text, paragraphs, or **token-limited RAG chunks** with start and end times.

What it removes:

- **Timestamps and cue numbers** (`00:01:23,456 --> 00:01:25,000`, `[00:12]`, `0:03` lines)
- **Repeated caption lines**: YouTube auto-captions and live captions repeat every line in the next cue, so a raw `.vtt` reads "hello everyone hello everyone and welcome". This keeps one copy of each line.
- **Filler words**: um, uh, erm, ah, hmm, plus any words or phrases you add ("you know", "I mean"). Commas and capital letters around them are fixed.
- **Speaker labels**: `Name:`, `Speaker 1 (00:00:05):`, Otter headers, VTT `<v Name>` tags and YouTube `>>` marks. Or keep them once per speaker turn.
- **Sound tags**: `[Music]`, `[Applause]`, `(laughs)`, `[inaudible]`, `♪ lyrics ♪`
- **Markup**: `<i>`, `<font>`, karaoke word timings `<00:00:01.000><c>`, `{\an8}` tags, HTML entities like `&amp;#39;`
- **Stutters**: "the the" becomes "the"

What you get:

- **Document mode**: one row per transcript with the clean text, paragraphs (with start time and speaker), word and token counts, and what was removed
- **Chunks mode**: one row per chunk for RAG and embeddings, with a token limit you set (cl100k_base or o200k_base), overlap, chunk index, a stable `chunkId` for upserts, start/end time, and for YouTube sources a **link that opens the video at that moment**
- A **clean .txt file** per transcript in the run's key-value store

### What people use it for

- **RAG and AI search over videos and podcasts**: run a YouTube transcript scraper, point this Actor at its dataset, and load the chunks into Pinecone, Qdrant, Weaviate or pgvector. Each chunk carries its timestamp link, so answers can cite the exact moment.
- **Readable transcripts** from `.srt` or `.vtt` files: meeting notes, interview write-ups, blog posts, show notes, course material
- **LLM prompts**: strip timestamps and repeats before sending a transcript to GPT or Claude, so you pay for fewer tokens (a raw YouTube auto-caption VTT repeats every line, so it is more than twice as long as the clean text)
- **Subtitle to text** for translation, search indexing or accessibility checks

### How it works

1. Give it any mix of inputs: file links (`.srt`, `.vtt`, `.txt`, `.json`; Google Drive, Dropbox and GitHub share links work), pasted text, or a **dataset ID** from another Actor run.
2. The format is detected for you. For datasets, the transcript field is found automatically: `transcript`, `data`, `timestamped`, `transcript_json`, `captions`, `segments`, `utterances`, `srt`, `vtt`, `text` and more. If it guesses wrong, set **Transcript field**.
3. Each transcript is cleaned, then split into paragraphs at speaker changes, pauses and every ~120 words at a sentence end.
4. In chunks mode the text is cut into chunks of at most N tokens, ending at a sentence where possible, with the overlap you choose.

It never visits YouTube or any other site on your behalf. It only reads the files and datasets you give it.

#### Use it after a transcript scraper

- **Once**: copy the dataset ID from the scraper run's Storage tab into **Dataset ID**.
- **Automatically**: on the scraper's task, add an Actor-to-Actor integration with this Actor and set `"datasetId": "{{resource.defaultDatasetId}}"` in its input. Every finished scraper run is then cleaned and chunked.

This Actor runs with limited permissions. It can read only the dataset you pick or name in **Dataset ID**, nothing else in your account.

### Input example

```json
{
  "transcriptUrls": ["https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt"],
  "datasetId": "",
  "outputMode": "chunks",
  "chunkTokens": 500,
  "chunkOverlapTokens": 50,
  "tokenizer": "cl100k_base",
  "removeFillers": true,
  "extraFillers": ["you know"],
  "speakerLabels": "remove"
}
```

### Output example

Chunks mode, one row per chunk:

```json
{
  "status": "ok",
  "source": "https://www.youtube.com/watch?v=VIDEO_ID",
  "sourceType": "dataset",
  "title": "How retrieval works",
  "docId": "3f1c0a9b2d4e",
  "chunkIndex": 3,
  "chunkCount": 12,
  "chunkId": "3f1c0a9b2d4e-0003",
  "text": "So the retriever looks at the question first. It pulls the five closest chunks...",
  "tokens": 487,
  "words": 371,
  "startSeconds": 412.5,
  "endSeconds": 538.1,
  "startTime": "00:06:52",
  "endTime": "00:08:58",
  "timestampUrl": "https://www.youtube.com/watch?v=VIDEO_ID&t=412s",
  "metadata": { "channel_name": "...", "language": "en" },
  "cleanTextUrl": "https://api.apify.com/v2/key-value-stores/.../records/clean-0000-3f1c0a9b2d4e.txt"
}
```

Document mode, one row per transcript:

```json
{
  "status": "ok",
  "source": "https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt",
  "format": "srt",
  "text": "This blade has a dark past. It has shed much innocent blood.\n\nYou're a fool for traveling alone...",
  "paragraphs": [{ "text": "This blade has a dark past. It has shed much innocent blood.", "startTime": "00:01:47", "startSeconds": 107.25 }],
  "paragraphCount": 7,
  "wordCount": 110,
  "tokenCount": 164,
  "originalWordCount": 110,
  "removedPercent": 0,
  "durationSeconds": 630,
  "removed": { "markup": 0, "soundTags": 0, "speakerLabels": 0, "fillers": 0, "duplicateLines": 0, "duplicateWords": 0, "stutters": 0 }
}
```

Inputs that fail (a dead link, a web page instead of a file, a scraper item that has no transcript) get a row with `status: "error"` and the reason. They are not charged.

### Pricing

Pay per event, **$0.001 per cleaned transcript** ($1 per 1,000), no start fee. The price is the same in document and chunks mode, however many chunks a transcript makes. Failed inputs are free. Apify platform usage is billed by Apify as usual; this Actor needs only 256 MB and finishes most transcripts in well under a second.

### Limits and notes

- Files up to 25 MB each. UTF-8, UTF-16 and Windows-1252 subtitle files are read correctly.
- Fillers are English by default. Turn **Remove filler words** off for other languages and add your own list.
- It does not add punctuation. YouTube auto-captions have none, so their clean text has none either; paragraphs then break at pauses.
- Repeated short lines are dropped only in rolling captions. In film and TV subtitles a repeated "No!" is kept, because it is dialogue.
- Token counts use OpenAI's tokenizers (via js-tiktoken). Other models count a little differently, so leave some headroom.
- Word times inside a cue are spread evenly across the cue, so chunk times are accurate to the cue, usually a few seconds.

### FAQ

**Can it get the transcript of a YouTube video for me?** No. Use any YouTube transcript scraper in the Store, then give this Actor that run's dataset ID.

**How do I convert SRT to text?** Paste the SRT or add its link, keep Output on Document, and run. The clean text is in the `text` field and in the `.txt` file.

**Which chunk size should I use?** 300-800 tokens with 10-15% overlap works for most embedding models. Use o200k_base if you count tokens for GPT-4o or later.

**Does it keep who said what?** Set **Speaker labels** to Keep. Each speaker turn then starts with `Name: `, paragraphs break at every change, and chunks list their `speakers`.

**Can I call it from code?** Yes, with the Apify API or client like any Actor. You can also pass an array `texts` of strings or objects (the same shapes as dataset items).

# Actor input Schema

## `transcriptUrls` (type: `array`):

Direct links to .srt, .vtt, .txt or .json transcript files (one per line). Google Drive, Dropbox and GitHub share links work. A JSON link that holds a list of records (a dataset export) is cleaned record by record.

## `text` (type: `string`):

Paste one SRT, VTT, YouTube 'Show transcript' copy, Otter/Rev/Zoom export or plain text.

## `datasetId` (type: `string`):

Clean every item in another Actor's dataset, for example a YouTube, TikTok, Loom or podcast transcript scraper run. Pick it from your storage, or paste its ID. The transcript field is found automatically (transcript, data, timestamped, transcript_json, captions, srt, vtt, text and more). In an Actor-to-Actor integration set it to {{resource.defaultDatasetId}}.

## `textField` (type: `string`):

Only if auto-detection picks the wrong field: the dataset field that holds the transcript. Dots go into nested objects, for example result.transcript.

## `outputMode` (type: `string`):

Document: one row per transcript with the clean text and paragraphs. Chunks: one row per RAG chunk with token count, start/end time and a YouTube timestamp link, ready for embeddings or a vector database.

## `chunkTokens` (type: `integer`):

Maximum tokens per chunk. Chunks end at a sentence where possible.

## `chunkOverlapTokens` (type: `integer`):

Tokens repeated from the end of one chunk at the start of the next (at most half the chunk size). Snaps to a sentence start when one fits.

## `tokenizer` (type: `string`):

How tokens are counted. cl100k_base matches OpenAI text-embedding-3 and GPT-4; o200k_base matches GPT-4o and later.

## `removeFillers` (type: `boolean`):

Removes um, uh, erm, ah, hmm and similar, and fixes the comma and capital letter around them.

## `extraFillers` (type: `array`):

Your own list, for example 'you know', 'I mean', 'like'. Matched as whole words, case-insensitive.

## `speakerLabels` (type: `string`):

Speaker names from 'Name:', 'Speaker 1 (00:01):', Otter-style headers, VTT <v Name> tags and YouTube '>>' marks. Remove them, or keep them once per speaker turn as 'Name: '.

## `removeDuplicates` (type: `boolean`):

YouTube auto-captions and live captions repeat each line in the next cue. This drops the repeats and overlapping words.

## `removeSoundTags` (type: `boolean`):

Removes \[Music], \[Applause], (laughs), \[inaudible], ♪ lyrics ♪ and other bracketed cues.

## `removeStutters` (type: `boolean`):

Turns 'the the' into 'the'.

## `paragraphs` (type: `boolean`):

Paragraph breaks at speaker changes, long pauses and blank lines, and every ~120 words at a sentence end. Off gives one line of text.

## `pauseSeconds` (type: `integer`):

A silence this long between cues starts a new paragraph. 0 turns it off.

## `maxParagraphWords` (type: `integer`):

Start a new paragraph at the next sentence end after this many words. 0 turns it off.

## `maxTranscripts` (type: `integer`):

Stop after this many transcripts. Empty means no limit.

## Actor input object example

```json
{
  "transcriptUrls": [
    "https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt"
  ],
  "outputMode": "document",
  "chunkTokens": 500,
  "chunkOverlapTokens": 50,
  "tokenizer": "cl100k_base",
  "removeFillers": true,
  "speakerLabels": "remove",
  "removeDuplicates": true,
  "removeSoundTags": true,
  "removeStutters": true,
  "paragraphs": true,
  "pauseSeconds": 2,
  "maxParagraphWords": 120
}
```

# Actor output Schema

## `rows` (type: `string`):

One row per transcript (document mode) or per chunk (chunks mode).

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

One clean .txt file per transcript.

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

Counts of transcripts, chunks, words and removed items.

# 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 = {
    "transcriptUrls": [
        "https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("open-data-tools/srt-vtt-transcript-cleaner").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 = { "transcriptUrls": ["https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt"] }

# Run the Actor and wait for it to finish
run = client.actor("open-data-tools/srt-vtt-transcript-cleaner").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 '{
  "transcriptUrls": [
    "https://durian.blender.org/wp-content/content/subtitles/sintel_en.srt"
  ]
}' |
apify call open-data-tools/srt-vtt-transcript-cleaner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,open-data-tools/srt-vtt-transcript-cleaner"
        }
    }
}
```

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/JxgPHYLUAvihfEBYI/builds/PwVCqA3cHQebZcnIS/openapi.json
