# Subtitle Checker & Fixer – SRT/VTT QC, CPS, Overlaps (`aleksejsg/subtitle-qc-fixer`) Actor

Validate SRT and WebVTT subtitle files against Netflix, BBC or festival style rules: characters per line, reading speed (CPS), duration, overlaps, gaps. Auto-fix overlaps and numbering, convert SRT to VTT. Batch, API, no install.

- **URL**: https://apify.com/aleksejsg/subtitle-qc-fixer.md
- **Developed by:** [Aleksej Sg](https://apify.com/aleksejsg) (community)
- **Categories:** Videos, Developer tools, For creators
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 subtitle file checkeds

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

## Subtitle Checker & Fixer – SRT / WebVTT Validator, Reading Speed (CPS) & SRT to VTT Converter

**Validate subtitle files before delivery** to a film festival, distributor, Netflix-style platform or client.
Paste text or give SRT/VTT URLs; get a per-cue error report, a **safely fixed SRT** and a **WebVTT (.vtt) export**.
Works in batch from the Apify API, Make, n8n or Zapier. No install, no subtitle editor needed.

Built by a professional subtitler and film editor (OpenSubtitles contributor since 2014).

### What it checks (per subtitle)

- **Characters per line (CPL)** and **number of lines**
- **Reading speed (CPS, characters per second)**
- **Minimum / maximum duration**, zero or negative durations
- **Overlapping subtitles** and **gaps shorter than 2 frames**
- Empty cues, broken numbering, malformed timecodes

### Auto-fix (never rewrites your text)

Removes overlaps, enforces the minimum gap, renumbers cues, normalises timecodes, and exports **SRT → VTT**.

### Presets (based on public style guides)

| Preset | CPL | Lines | CPS | Min / max duration |
|---|---|---|---|---|
| `festival-default` | 42 | 2 | 17 | 0.833 s / 7 s |
| `netflix-en` | 42 | 2 | 20 | 0.833 s / 7 s |
| `netflix-en-children` | 42 | 2 | 17 | 0.833 s / 7 s |
| `bbc` | 37 | 2 | 17 | 1 s / 7 s |
Every rule can be overridden. Always check your client's own spec.

### Great for

- Checking **AI / Whisper-generated subtitles** before publishing (auto captions often break CPS and overlaps)
- Festival submissions (FilmFreeway) that require English SRT
- Translators and subtitling agencies doing batch QC
- Developers needing an **SRT validator API** or **SRT to VTT converter API**

### Output (one row per file)

`cues`, `errors`, `warnings`, `issues[]` (cue number, rule, value, limit), `issues_after_fix`, `fixed_srt`, `fixed_vtt`.

### Pricing (pay per event)

**$0.01 per subtitle file checked** (fixed SRT and VTT included).

Keywords: subtitle checker, SRT validator, VTT validator, subtitle QC, subtitle quality check, reading speed checker,
CPS calculator, subtitle overlap fixer, fix SRT timing, SRT to VTT converter, WebVTT converter, Netflix subtitle guidelines,
closed captions QC, sottotitoli controllo, sous-titres vérification.

### Example

Input:

```json
{"subtitleUrls": ["https://example.com/my-film.en.srt"], "preset": "netflix-en", "fix": true}
```

Output (shortened):

```json
{"source": "https://example.com/my-film.en.srt", "cues": 812, "errors": 14, "warnings": 31,
 "issues": [{"cue": 57, "rule": "cps", "value": 23.4, "limit": 20}, {"cue": 58, "rule": "overlap", "value": -120, "limit": 0}],
 "issues_after_fix": 9, "fixed_srt": "1\n00:00:01,000 --> ...", "fixed_vtt": "WEBVTT\n\n00:00:01.000 --> ..."}
```

Download results as JSON, CSV or Excel from the dataset, or call the Actor via API and read `fixed_srt` directly.

### 🇮🇹 In italiano

**Controllo qualità sottotitoli SRT/VTT** prima della consegna a festival, distributori o piattaforme:
caratteri per riga, velocità di lettura (CPS), durata minima/massima, sovrapposizioni e gap. Correzione automatica
delle sovrapposizioni e della numerazione (il testo non viene mai modificato) ed esportazione SRT → VTT.
Ideale per verificare sottotitoli generati con AI/Whisper. Prezzo: **0,01 $ per file controllato**.

# Actor input Schema

## `subtitleUrls` (type: `array`):

Direct download links to .srt or .vtt files (one per line), e.g. a raw GitHub, S3, Dropbox ?dl=1 link. Each file is one billed event.

## `subtitleText` (type: `string`):

Alternatively paste the full content of one SRT or WebVTT file here. Counted as one file.

## `preset` (type: `string`):

Style rules to check against: festival-default (42 CPL, 17 CPS), netflix-en (42 CPL, 20 CPS), netflix-en-children (17 CPS), bbc (37 CPL). Override single rules below.

## `cpl` (type: `integer`):

Override the preset's maximum characters per line (CPL). Leave empty to use the preset.

## `cps` (type: `integer`):

Override the preset's maximum reading speed in characters per second (CPS). Leave empty to use the preset.

## `lines` (type: `integer`):

Override the maximum number of text lines per subtitle (usually 2).

## `min_ms` (type: `integer`):

Override the minimum subtitle duration in milliseconds (e.g. 833 = 20 frames at 24 fps).

## `max_ms` (type: `integer`):

Override the maximum subtitle duration in milliseconds (e.g. 7000).

## `gap_ms` (type: `integer`):

Override the minimum gap between consecutive subtitles in milliseconds (e.g. 83 = 2 frames at 24 fps).

## `fix` (type: `boolean`):

If enabled, each result also contains a fixed SRT (overlaps removed, gaps enforced, renumbered) and a WebVTT export. Text is never changed.

## `maxFiles` (type: `integer`):

Safety cap on how many files are processed (and billed) in one run.

## Actor input object example

```json
{
  "subtitleUrls": [
    "https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt"
  ],
  "subtitleText": "1\n00:00:01,000 --> 00:00:02,000\nHello, this subtitle is a bit too fast to read comfortably.\n\n2\n00:00:01,900 --> 00:00:04,000\nAnd this one overlaps the previous cue.\n",
  "preset": "festival-default",
  "fix": true,
  "maxFiles": 50
}
```

# Actor output Schema

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

One row per subtitle file: errors, warnings, per-cue issues and the fixed SRT/VTT text.

# 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 = {
    "subtitleUrls": [
        "https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt"
    ],
    "subtitleText": `1
00:00:01,000 --> 00:00:02,000
Hello, this subtitle is a bit too fast to read comfortably.

2
00:00:01,900 --> 00:00:04,000
And this one overlaps the previous cue.`
};

// Run the Actor and wait for it to finish
const run = await client.actor("aleksejsg/subtitle-qc-fixer").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 = {
    "subtitleUrls": ["https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt"],
    "subtitleText": """1
00:00:01,000 --> 00:00:02,000
Hello, this subtitle is a bit too fast to read comfortably.

2
00:00:01,900 --> 00:00:04,000
And this one overlaps the previous cue.
""",
}

# Run the Actor and wait for it to finish
run = client.actor("aleksejsg/subtitle-qc-fixer").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 '{
  "subtitleUrls": [
    "https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt"
  ],
  "subtitleText": "1\\n00:00:01,000 --> 00:00:02,000\\nHello, this subtitle is a bit too fast to read comfortably.\\n\\n2\\n00:00:01,900 --> 00:00:04,000\\nAnd this one overlaps the previous cue.\\n"
}' |
apify call aleksejsg/subtitle-qc-fixer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,aleksejsg/subtitle-qc-fixer"
        }
    }
}
```

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/Ex14iUInht2W4pDHT/builds/6zm3U3dw3qHdS6zvK/openapi.json
