# Subtitle Generator: Video & Audio to SRT and VTT Subtitles (`spokentext/subtitle-generator`) Actor

Generate ready-to-use subtitle files from any video or audio. Paste a file link, a Google Drive or Dropbox share link, or upload a file, and download SRT and VTT subtitles with clean line breaks and accurate timing. 99+ languages, pay per minute.

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

## Pricing

from $3.00 / 1,000 audio minute subtitleds

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 Generator: Video & Audio to SRT and VTT Subtitles

Generate ready-to-use **SRT** and **VTT** subtitle files from any video or audio. Paste a file link, a **Google Drive** or **Dropbox** share link, or **upload a file**, and download subtitles with clean line breaks and accurate timing.

- **Real subtitles, not a raw transcript.** Lines are kept short, subtitles break at sentence ends and pauses, and nothing stays on screen too long.
- **Made for your format.** Choose the line length: 42 characters for landscape video, about 20 to 25 for Shorts, Reels and TikTok.
- **99+ languages** with automatic language detection (Whisper large-v3).
- **Pay per audio minute.** No subscription, and nothing charged for files that fail.
- **Fast.** One hour of video is typically ready in about a minute.

### What you can provide

| Input | Example |
|---|---|
| Direct file link | `https://example.com/video.mp4` |
| Google Drive share link | `https://drive.google.com/file/d/FILE_ID/view` |
| Dropbox share link | `https://www.dropbox.com/scl/fi/.../video.mp4?rlkey=...` |
| File upload | Use the **Or upload a file** field |

Any common format works: MP4, MOV, WEBM, MKV, MP3, M4A, WAV and more, up to 1.5 GB per file. Share links must be set to "anyone with the link can view".

### How to use

1. Get a link to your video or audio file: a direct file URL, or a Google Drive or Dropbox link shared with "anyone with the link". Or use **Or upload a file**.
2. Paste the link into **Video or audio file URLs**.
3. Optionally adjust the line length: keep 42 for landscape video, use 20 to 25 for vertical video.
4. Click **Start**. When the run finishes, open the **Output** tab and click the SRT or VTT link to download your subtitle file.

### Output

One dataset item per file, with download links to the two subtitle files:

```json
{
    "inputUrl": "https://example.com/video.mp4",
    "status": "ok",
    "fileName": "video.mp4",
    "language": "English",
    "durationSeconds": 20,
    "transcribedMinutes": 1,
    "truncated": false,
    "subtitleCount": 4,
    "srtUrl": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/001-video.srt",
    "vttUrl": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/001-video.vtt",
    "text": "We choose to go to the moon in this decade and do the other things..."
}
```

A generated SRT file looks like this:

```
1
00:00:00,000 --> 00:00:03,120
We choose to go to the moon in this decade
and do the other things,

2
00:00:03,120 --> 00:00:06,480
not because they are easy,
but because they are hard.
```

The files are also listed in the run's **Storage → Key-value store** tab. Turn on **Also include the SRT text in the results** to get the SRT content directly in each item, which is convenient from the API.

### Subtitle settings

| Setting | Default | Use it for |
|---|---|---|
| Maximum characters per line | 42 | Lower it (20 to 25) for vertical video |
| Maximum lines per subtitle | 2 | Set to 1 for single-line captions |
| Maximum seconds per subtitle | 6 | Lower it for fast-paced edits |

### Pricing

You pay for each minute of audio processed, rounded to the nearest minute (minimum one minute per file). Set **Maximum minutes per file** or the run's maximum charge to cap spending: the Actor stops before exceeding either, and marks a cut file with `"truncated": true`.

### Limits

- **Links must point to a file, not a web page.** YouTube, TikTok and other video-page links are not supported.
- Subtitles are written in the language spoken in the file. Translation is not included.
- No speaker labels.
- Videos up to about 2 hours. Cut longer videos into parts first.
- The subtitle files are text files to load into your editor or player. Subtitles are not burned into the video.

### FAQ

#### How do I generate SRT subtitles for a video?

Paste a link to the video file or upload it, then start the run. Each result contains a download link to an SRT file and a VTT file.

#### What is the difference between SRT and VTT?

Both hold the same subtitles and timings. SRT is the format most video editors and players import (Premiere Pro, DaVinci Resolve, CapCut, VLC, YouTube). VTT is the format used by web video players and HTML5 video.

#### How do I make subtitles for Shorts, Reels or TikTok?

Set **Maximum characters per line** to about 20 to 25 and **Maximum lines per subtitle** to 1 or 2. Subtitles then stay short enough to read on a vertical screen.

#### How accurate are the timings?

Subtitles are timed from the moment each word is spoken, and break at sentence ends and pauses. Text accuracy is that of Whisper large-v3: very good on clear speech, with possible mistakes on names, jargon and noisy audio.

#### How long does it take and how much does it cost?

A one-hour video typically takes about a minute and costs $0.18. Price is $0.003 per minute, with nothing charged for files that fail.

#### Can it translate subtitles into another language?

Not yet. Subtitles are written in the language spoken in the file.

#### Can I add subtitles to a YouTube or TikTok link?

No. Links must point to a file. Export or download your video first, then upload it or share it through Google Drive or Dropbox.

#### What happens to my file?

The file is downloaded during the run, its audio is sent to our speech-to-text provider (Groq) to be transcribed, and it is deleted when the run ends. Subtitle files are stored only in your own Apify account.

### Related

For plain transcripts with timestamps, use [Audio & Video to Text](https://apify.com/spokentext/audio-video-to-text). For podcasts, use [Spotify Podcast Transcript](https://apify.com/spokentext/spotify-podcast-transcript).

# Actor input Schema

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

Direct links to video or audio files (mp4, mov, webm, mp3, m4a, wav...), or Google Drive and Dropbox share links. Share links must be open to anyone with the link.

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

Upload one video or audio file from your computer instead of pasting a link.

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

Two-letter code of the language spoken in the file (en, fr, es, de...). Leave empty to detect it automatically. Subtitles are written in the spoken language.

## `maxCharsPerLine` (type: `integer`):

42 is the broadcast standard for landscape video. Use about 20 to 25 for vertical video (Shorts, Reels, TikTok).

## `maxLines` (type: `integer`):

How many lines a single subtitle may use.

## `maxSecondsPerSubtitle` (type: `integer`):

A subtitle is split when it would stay on screen longer than this.

## `includeSrt` (type: `boolean`):

Adds the SRT content as a text field in each result, convenient when calling the Actor from the API.

## `maxMinutesPerFile` (type: `integer`):

Longer files are cut at this length, so a single run can never cost more than you expect.

## Actor input object example

```json
{
  "urls": [
    "https://api.apify.com/v2/key-value-stores/kyR7mGkrVQ6H3xQe8/records/jfk-we-choose-the-moon.mp3?signature=1IsTRMMS6FEWC0SVKQvL6"
  ],
  "maxCharsPerLine": 42,
  "maxLines": 2,
  "maxSecondsPerSubtitle": 6,
  "includeSrt": false,
  "maxMinutesPerFile": 300
}
```

# Actor output Schema

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

No description

## `files` (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 = {
    "urls": [
        "https://api.apify.com/v2/key-value-stores/kyR7mGkrVQ6H3xQe8/records/jfk-we-choose-the-moon.mp3?signature=1IsTRMMS6FEWC0SVKQvL6"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("spokentext/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://api.apify.com/v2/key-value-stores/kyR7mGkrVQ6H3xQe8/records/jfk-we-choose-the-moon.mp3?signature=1IsTRMMS6FEWC0SVKQvL6"] }

# Run the Actor and wait for it to finish
run = client.actor("spokentext/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://api.apify.com/v2/key-value-stores/kyR7mGkrVQ6H3xQe8/records/jfk-we-choose-the-moon.mp3?signature=1IsTRMMS6FEWC0SVKQvL6"
  ]
}' |
apify call spokentext/subtitle-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,spokentext/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/1jQBWTjiarrhzMKjd/builds/nDxh1zzpI6SMBQVda/openapi.json
