# SRT & VTT Subtitle Generator for Video and Audio (`karimel/subtitle-generator`) Actor

Generate SRT and VTT subtitle files for any video or audio file from a direct link. Accurate timings, 100 languages, long files supported. Pay per audio minute.

- **URL**: https://apify.com/karimel/subtitle-generator.md
- **Developed by:** [Karim EL ALLAME](https://apify.com/karimel) (community)
- **Categories:** AI, Videos, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.50 / 1,000 audio minutes

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?

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

## SRT & VTT Subtitle Generator — subtitles for any video or audio file

Give the Actor a link to a video or audio file and get back ready-to-use subtitle files: **SRT** for video editors and players, **VTT** for the web, plus a plain-text transcript.

You pay per minute of audio. Files that fail are not charged.

### Input

```json
{
  "urls": ["https://example.com/my-video.mp4"]
}
```

Links must point directly at a media file (MP4, MOV, MKV, WEBM, MP3, WAV, M4A and anything else FFmpeg reads). To subtitle a file from your computer, upload it to any storage that gives a direct link, for example an Apify key-value store.

| Field | What it does |
|---|---|
| `language` | Force the spoken language; detected automatically by default |
| `wordTimestamps` | Add start and end times for every word, for karaoke-style captions |
| `maxMinutesPerFile` | Only the first N minutes, handy for a cheap test |
| `podcastFeeds` | Subtitle the latest episodes of a podcast feed instead of single files |

### Output

One item per file, with links to the generated files:

```json
{
  "fileName": "my-video.mp4",
  "status": "succeeded",
  "language": "en",
  "durationSeconds": 157.9,
  "srtUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-my-video.srt",
  "vttUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-my-video.vtt",
  "txtUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-my-video.txt",
  "segments": [{ "start": 23.72, "end": 31.38, "text": "Four score and seven years ago..." }],
  "billedMinutes": 3
}
```

The SRT file looks like this:

```
1
00:00:23,720 --> 00:00:31,380
Four score and seven years ago our fathers brought forth on this continent a new nation,
```

### Good to know

- Around 100 languages are supported and detected automatically. Subtitles are in the spoken language; translation is not provided.
- Long files are split at natural pauses and stitched back together, so timings stay continuous.
- Subtitle lines follow the natural phrasing of the speech; they are not re-wrapped to a fixed character count.
- Speaker labels are not provided.
- Accuracy depends on audio quality; heavy music and crosstalk reduce it.

### Where your audio goes

Files are converted with FFmpeg and sent to Groq's hosted Whisper large-v3 models for recognition. The audio is therefore processed by a third party (Groq); do not submit recordings you are not allowed to share with a processor. Downloaded files are deleted as soon as each file is done.

This Actor is a focused edition of [Audio & Video Transcriber](https://apify.com/karimel/audio-video-transcriber).

# Actor input Schema

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

Direct links to audio or video files (MP3, WAV, M4A, MP4, MOV, WEBM, OGG, FLAC and anything else FFmpeg reads). One result per file. Leave empty if you only use podcast feeds.

## `podcastFeeds` (type: `array`):

Podcast RSS feed URLs or Apple Podcasts show links. The most recent episodes of each show are transcribed.

## `maxEpisodesPerFeed` (type: `integer`):

How many of the most recent episodes to transcribe for each podcast feed.

## `episodeTitleContains` (type: `string`):

Optional. Transcribe only episodes with this text in the title.

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

Leave on automatic unless detection picks the wrong language.

## `subtitleFiles` (type: `boolean`):

Saves ready-to-use subtitle and text files and returns their links.

## `wordTimestamps` (type: `boolean`):

Adds start and end times for every word. Slower.

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

Only transcribe the first N minutes of each file. Leave empty for the whole file.

## Actor input object example

```json
{
  "urls": [
    "https://www.archive.org/download/gettysburg_johng_librivox/gettysburg_address_64kb.mp3"
  ],
  "maxEpisodesPerFeed": 1,
  "language": "",
  "subtitleFiles": true,
  "wordTimestamps": false
}
```

# Actor output Schema

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

One item per file: status, language, full text, timed segments and links to SRT, VTT and TXT files.

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

SRT, VTT and TXT files for every transcribed file.

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

Files processed and minutes billed.

# 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://www.archive.org/download/gettysburg_johng_librivox/gettysburg_address_64kb.mp3"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("karimel/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://www.archive.org/download/gettysburg_johng_librivox/gettysburg_address_64kb.mp3"] }

# Run the Actor and wait for it to finish
run = client.actor("karimel/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://www.archive.org/download/gettysburg_johng_librivox/gettysburg_address_64kb.mp3"
  ]
}' |
apify call karimel/subtitle-generator --silent --output-dataset

```

## MCP server setup

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