# SRT Subtitle Generator — Subtitles from Any Video (`lergassy/srt-subtitle-generator`) Actor

Give it a video or audio file and get a finished SRT or WebVTT subtitle file back, with the timings already aligned. 90+ languages, optional translation to English, speaker labels, and the timed passages alongside the subtitle file. No API key to set up.

- **URL**: https://apify.com/lergassy/srt-subtitle-generator.md
- **Developed by:** [Matvey](https://apify.com/lergassy) (community)
- **Categories:** Videos, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $21.00 / 1,000 minute transcribeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

**SRT Subtitle Generator** takes a video or an audio file and hands back a finished subtitle file — SRT or WebVTT, timings already aligned, ready to drop next to the video or upload to YouTube. 90+ languages, optional translation to English, optional speaker labels, and no API key to set up.

### What it is for

Subtitling videos for social media and YouTube, making footage accessible, preparing translation-ready caption files, and adding captions in bulk to a library of recordings. Give it a list of URLs and every file comes back with its own subtitle track.

| What you give it | What you get back |
| --- | --- |
| A video URL | An SRT file with aligned timings |
| `subtitleFormat: vtt` | A WebVTT file instead |
| `translateToEnglish: true` | English subtitles for a foreign-language video |
| `diarize: true` | Speaker labels inside the captions |
| A three-hour file | One continuous subtitle file, timings unbroken |

Formats: MP4, MOV, WEBM, MP3, M4A, WAV, FLAC, OGG — from a public URL or an upload.

### What data does it return?

| Field | Example |
| --- | --- |
| `subtitles` | the complete SRT or WebVTT file, as text |
| `source`, `fileName` | `https://example.com/clip.mp4` · `clip.mp4` |
| `durationSeconds`, `durationMinutes` | `461.05` · `7.68` |
| `language`, `model`, `translatedToEnglish` | `English` · `accurate` · `false` |
| `transcript`, `wordCount`, `charCount` | the plain text behind the captions |
| `segments` | `[{"start": 0, "duration": 4.56, "text": "…", "speaker": "Speaker 1"}]` |
| `segmentCount`, `speakerCount`, `speakers` | `101` · `3` · `["Speaker 1", …]` |
| `status`, `errorCode`, `errorMessage` | `ok`, or why a file failed |

The subtitle file arrives as a field on the row, so you can save it straight to disk from the API or from an integration.

### How much does it cost?

| Event | Price | When it is charged |
| --- | --- | --- |
| Minute transcribed | $0.03 | Per started minute, using the built-in key |
| Minute with your own key | $0.012 | Per started minute when you supply a Groq key |
| Add-on: Speaker labels | $0.012 | Per started minute, only when speaker labels are on |
| File processed | $0.002 | Per file downloaded and prepared |

A ten-minute video costs about $0.30. A failed file is an error row and is never charged.

### Notes

Recognition is Whisper large v3 with a built-in key — nothing to sign up for. Timings come from the model's own segment boundaries, so captions break where the speaker pauses rather than at a fixed character count.

# Actor input Schema

## `urls` (type: `array`):

Direct links to media files: MP3, M4A, WAV, FLAC, OGG, MP4, MOV, WEBM and anything else ffmpeg can read. Video files are stripped to their audio track automatically.

## `file` (type: `string`):

Upload one audio or video file from your computer instead of giving a URL.

## `quality` (type: `string`):

Fast is the everyday choice. Accurate makes fewer mistakes on accents, noise and technical vocabulary, and costs more.

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

Two-letter code of the language spoken, for example <code>en</code>, <code>ru</code>, <code>id</code>. Leave empty to detect it automatically.

## `translateToEnglish` (type: `boolean`):

Return an English transcript no matter what language is spoken.

## `diarize` (type: `boolean`):

Mark who is speaking in each part of the recording. Every segment gets a speaker ("Speaker 1", "Speaker 2", …), the transcript is laid out as a conversation, and subtitles carry the names. Charged per minute on top of the transcription, and slow: the speaker model runs on the machine, so expect several minutes of processing per hour of audio, while a plain transcript is near-instant.

## `speakerCount` (type: `integer`):

How many people talk in the recording. Leave empty and the Actor works it out on its own; set it when you already know, for example two people in an interview.

## `vocabularyHint` (type: `string`):

Names, jargon or spellings that appear in the audio, comma separated. Helps the engine get proper nouns right.

## `includeSegments` (type: `boolean`):

Return every recognised passage with its start time and duration, alongside the full transcript.

## `subtitleFormat` (type: `string`):

Also return a ready-made subtitle file as text.

## `apiKey` (type: `string`):

Optional. Supply your own key and the per-minute price drops sharply; you then pay Groq directly for the recognition. Leave empty to use the built-in key with nothing to set up.

## `maxConcurrency` (type: `integer`):

How many files to transcribe at the same time.

## `maxFileSizeMb` (type: `integer`):

Files larger than this are skipped with an error row instead of being downloaded.

## `timeoutPerFileSecs` (type: `integer`):

How long one file may take to download and recognise before it is given up on.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/audio-samples/sample-5min.m4a"
  ],
  "quality": "fast",
  "translateToEnglish": false,
  "diarize": false,
  "includeSegments": true,
  "subtitleFormat": "srt",
  "maxConcurrency": 3,
  "maxFileSizeMb": 500,
  "timeoutPerFileSecs": 600
}
```

# Actor output Schema

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

Dataset with one row per audio or video file.

## `transcriptsInConsole` (type: `string`):

Browse the transcripts in the Apify Console.

# 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 = {
    "urls": [
        "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/audio-samples/sample-5min.m4a"
    ],
    "subtitleFormat": "srt"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lergassy/srt-subtitle-generator").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 = {
    "urls": ["https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/audio-samples/sample-5min.m4a"],
    "subtitleFormat": "srt",
}

# Run the Actor and wait for it to finish
run = client.actor("lergassy/srt-subtitle-generator").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 '{
  "urls": [
    "https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/audio-samples/sample-5min.m4a"
  ],
  "subtitleFormat": "srt"
}' |
apify call lergassy/srt-subtitle-generator --silent --output-dataset

```

## MCP server setup

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

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/7mAA6asPlKoEdX9Wd/builds/zEHXL8QbOcG3nDTCi/openapi.json
