# Auto Captions & Subtitle Generator for TikTok, Reels, Shorts (`ingeniela/auto-captions-subtitle-generator`) Actor

Add animated word-by-word captions to any video with Whisper AI. TikTok, Reels and Shorts styles, 18 animations, 26 fonts, batch videos and SRT/VTT/ASS export. Works with OpenAI or OpenRouter.

- **URL**: https://apify.com/ingeniela/auto-captions-subtitle-generator.md
- **Developed by:** [Ingeniela](https://apify.com/ingeniela) (community)
- **Categories:** Videos, AI, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.00 / 1,000 video minutes

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

## Auto Captions & Subtitle Generator for TikTok, Reels and Shorts

Add animated, word-by-word subtitles to any video. The Actor transcribes the audio with Whisper (through OpenAI or OpenRouter), times every caption to the exact moment each word is spoken, and returns an MP4 with the captions burned in, plus SRT, VTT, ASS and a JSON transcript.

![Animated word-by-word captions made by this Actor: each word lights up as it is spoken](https://api.apify.com/v2/key-value-stores/RXaOr7FspyrQ4JP88/records/auto-captions-word-highlight-demo-en.gif)

*Real output of this Actor: a 20-second voice clip, transcribed and captioned on Apify in about 20 seconds with the TikTok viral preset. [Download the full captioned MP4](https://api.apify.com/v2/key-value-stores/RXaOr7FspyrQ4JP88/records/auto-captions-sample-output-en.mp4).*

#### Four looks, one click

![The same video with the TikTok viral, Energetic pop, YouTube and Minimalist presets](https://api.apify.com/v2/key-value-stores/RXaOr7FspyrQ4JP88/records/auto-captions-style-presets-en.jpg)

Pick a style preset, or set every detail yourself: font, size, colors, outline, position and animation. Turn on **Style preview only** to see the result on a frame of your video in a few seconds before captioning the whole thing.

### Tutorial (1 minute)

![Step-by-step tutorial: what to fill in, click Start, the real result and the price](https://api.apify.com/v2/key-value-stores/RXaOr7FspyrQ4JP88/records/auto-captions-tutorial.gif)

*Every result in this tutorial comes from a real run.*

### What it does

- **Word-accurate timing.** Captions and highlights follow Whisper's word timestamps, not an even split of each sentence.
- **Natural pacing.** A caption ends at the end of a sentence or a pause, so two sentences never share one caption.
- **18 animations.** Word highlight, karaoke, pop, fade, slide, bounce, typewriter and more.
- **26 fonts built in.** Montserrat, Bebas Neue, Poppins, Anton, Oswald, Bangers, Permanent Marker… Commercial fonts (Arial, Helvetica, Impact, Futura, Avenir) render with a free look-alike. You can also upload your own TTF/OTF.
- **Same size on any resolution.** A font size of 36 looks the same on 720p, 1080p or 4K, vertical or horizontal.
- **Style presets.** TikTok viral, Energetic pop, YouTube professional, Minimalist, Professional business.
- **Brand-name fixes.** Give a vocabulary hint (for example `Pepfine, niacinamida`) and whole-word replacements (`{"pepfain": "Pepfine"}`).
- **Batch runs.** Paste many URLs; every video becomes one row in the results.
- **Subtitles-only mode.** Turn off burn-in to get just SRT/VTT/ASS/JSON (works with audio files too).
- **Free re-styling.** The transcript is cached, so captioning the same video again with another style does not pay for transcription twice.
- **Style preview.** Test mode renders one frame with sample captions in about 10 seconds.

### Smart extras

- **Translate**: speak Spanish, post in English. Captions are translated line by line and timed to the original speech.
- **Keywords and emojis**: the AI colors the words that matter and adds an emoji now and then, like the big creators do.
- **Remove silences**: pauses are cut before captioning, so the video is tighter and the captions stay in sync.
- **Make it vertical**: a horizontal video (podcast, webinar, YouTube) becomes 1080×1920 with a blurred background or a center crop.

```json
{ "videoUrls": [{"url": "https://example.com/podcast-clip.mp4"}], "stylePreset": "tiktok_viral",
  "translateTo": "en", "keywords": true, "emojis": true, "removeSilences": true, "reframe": "vertical-blur" }
```

The result also tells you what was done: `extras.silenceRemovedSeconds`, `extras.translatedTo`, `extras.keywords`, `extras.emojis`.

### Input

Only the video URL is required. Everything else has sensible defaults.

```json
{
  "videoUrls": [{ "url": "https://your-cdn.com/video.mp4" }],
  "stylePreset": "tiktok_viral",
  "language": "es",
  "vocabularyHint": "Pepfine, Trybello Hair Helper",
  "wordReplacements": { "pepfain": "Pepfine" }
}
```

Direct file links work best. Dropbox and Google Drive share links are converted to direct downloads automatically. Pages that need a login (private Drive files, Instagram/TikTok post pages) cannot be downloaded.

| Field | What it does | Default |
| --- | --- | --- |
| `videoUrls` | Video or audio files to caption | — |
| `transcriptionProvider` | `auto`, `openai` or `openrouter` | `auto` |
| `openaiApiKey` | Your own OpenAI key (optional, see Pricing) | built-in |
| `openrouterApiKey` | Your own OpenRouter key, instead of OpenAI (optional) | built-in |
| `language` | Spoken language (ISO code, e.g. `es`, `en`) | auto-detect |
| `vocabularyHint` | Names and words to spell correctly | — |
| `wordReplacements` | `{"wrong": "Right"}`, whole words, case-insensitive | `{}` |
| `stylePreset` | Ready-made look; overrides the style fields | `custom` |
| `fontName`, `fontSize`, `bold`, `textCase` | Font settings | Montserrat, 28, bold, normal |
| `primaryColour`, `highlightColour`, `outlineColour`, `outline`, `borderStyle`, `shadow` | Colors and outline (ASS `&HBBGGRR&` or `#RRGGBB` via API) | white, yellow, black |
| `verticalPosition`, `alignment` | Where captions sit (0 % = bottom) | 15 %, bottom center |
| `wordsPerSegment`, `maxWordsPerLine` | Words per caption, words per line | 3, auto |
| `animationStyle` | One of 18 animations | `none` |
| `translateTo` | Translate the captions (17 languages), timed to the original speech | no |
| `keywords`, `keywordColour` | Color the words that carry the message | off, green |
| `emojis` | Add a fitting emoji next to some captions | off |
| `removeSilences`, `silenceMinSeconds` | Cut pauses (jump cuts) before captioning | off, 0.6 s |
| `reframe` | Make a horizontal video vertical: `vertical-blur` or `vertical-crop` | `none` |
| `burnCaptions` | MP4 with captions, or subtitle files only | `true` |
| `relativeFontSize` | Scale size with the video resolution | `true` |
| `testMode` | One preview image instead of a full run | `false` |

### Output

One dataset row per video. Files live in the run's key-value store with public links.

```json
{
  "success": true,
  "sourceUrl": "https://your-cdn.com/video.mp4",
  "videoUrl": "https://api.apify.com/v2/key-value-stores/…/records/captioned_ab12cd34.mp4",
  "srtUrl": "…/captions_ab12cd34.srt",
  "vttUrl": "…/captions_ab12cd34.vtt",
  "assUrl": "…/captions_ab12cd34.ass",
  "transcriptUrl": "…/transcript_ab12cd34.json",
  "language": "spanish",
  "durationSeconds": 44.5,
  "billedMinutes": 1,
  "wordsCount": 118,
  "transcript": "Hola chicas, hoy les muestro…",
  "fromCache": false
}
```

The transcript JSON includes every word with its start and end time, which is useful for your own editing tools.

### How to use it

1. Upload your video somewhere with a direct link (Dropbox, Google Drive with "anyone with the link", your CDN or an Apify key-value store) and paste it in **Video URLs**. Add as many as you want.
2. Pick a **Style preset** (start with *TikTok viral*) and set the **Spoken language**.
3. Optional: turn on **Style preview only** and click **Start** to see the look on one frame in a few seconds. Adjust, then turn it off.
4. Click **Start**. A 1-minute video takes about 1 minute.
5. Download the MP4 (and SRT/VTT if you need them) from the links in the results table.

### Pricing

Pay per event:

| Event | Price | When it is charged |
| --- | --- | --- |
| `caption-minute` | US$0.03 | Each started minute of processed media |
| `transcription-minute` | US$0.01 | Each started minute transcribed with the built-in Whisper key. Not charged when you bring your own OpenAI or OpenRouter key, or when the transcript comes from the cache |
| `style-preview` | US$0.005 | Each test-mode preview image |
| `ai-caption-extras` | US$0.01 | Translation, keywords or emojis for one video with the built-in AI (not charged with your own key) |

**Examples:** a 45-second Reel costs US$0.04 (1 minute of captions + 1 minute of transcription). Ten 1-minute videos cost US$0.40, or US$0.30 with your own OpenAI or OpenRouter key. Captioning the same video again in another style costs only the US$0.03, because the transcript is reused.

Set **Maximum cost per run** in the run options. The Actor stops before a video it can no longer pay for.

### Limits

- Files up to 500 MB.
- Long videos work: the audio is sent in chunks (10 minutes on OpenAI, 3 minutes on OpenRouter) and the timestamps are merged.
- On OpenRouter the vocabulary hint is ignored (OpenRouter does not pass it to Whisper); use word replacements for brand names.
- The video keeps its original resolution; it is re-encoded once (H.264, CRF 20) to draw the captions.

### OpenAI or OpenRouter

Both run the same Whisper model (`whisper-1` on OpenAI, `openai/whisper-1` on OpenRouter) at about US$0.006 per minute, with word-level timestamps. Use OpenRouter if you already have OpenRouter credits and no OpenAI account. Get a key at openrouter.ai/keys and paste it in **OpenRouter API key**.

### Tips

- Run with **Style preview only** first, then caption the full video.
- For TikTok/Reels: preset *TikTok viral*, or 2–3 words per caption, uppercase, word highlight.
- For YouTube: preset *YouTube professional*, 6–10 words per caption.
- Set the language on short clips: auto-detection can confuse Spanish and Portuguese in the first seconds.

### FAQ

**Can I paste a TikTok or Instagram link?** No, it needs the video file itself. Download the video first (or use a TikTok/Instagram downloader Actor) and pass the file link.

**A brand name comes out wrong.** Add it to **Word replacements**, for example `{"pepfain": "Pepfine"}`. With OpenAI you can also put it in **Vocabulary hint**.

**Can I edit the captions afterwards?** Yes. Download the SRT or ASS file, fix it in any subtitle editor (CapCut, Premiere, DaVinci, Aegisub) and re-export.

**My video is horizontal. Does it work?** Yes. Sizes scale with the video, so the same settings look right on 16:9, 9:16 or 1:1.

**Is my video stored?** Only in your own run storage on Apify, with the retention of your Apify plan.

### API example

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("YOUR_USERNAME/auto-captions-subtitle-generator").call(run_input={
    "videoUrls": [{"url": "https://your-cdn.com/video.mp4"}],
    "stylePreset": "tiktok_viral",
    "language": "es",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["videoUrl"], item["srtUrl"])
```

The single-field input `{"videoUrl": "…"}` from version 2 still works.

### Development

```bash
python -m pytest tests -q                      # unit tests, offline
python scripts/smoke_test.py ./tmp-smoke fonts # full pipeline with a fake transcript
apify run                                      # local run (needs OPENAI_API_KEY)
apify push                                     # build and deploy to Apify
```

`.actor/Dockerfile` builds the Apify image (FFmpeg, libass, fonts). The root `Dockerfile` is the separate Railway web API (`src/api.py`), which runs the same pipeline through `ACTOR_INPUT_FILE`.

***

Built by [Ingeniela](https://ingeniela.com): automation and AI integrations for businesses.

# Actor input Schema

## `videoUrls` (type: `array`):

Direct links to video or audio files (MP4, MOV, WebM, MKV, MP3, WAV, M4A...). Dropbox and Google Drive share links are converted automatically. Add as many as you like: each one becomes a row in the results.

## `videoUrl` (type: `string`):

Single video URL. Kept for older API integrations; use Video URLs instead.

## `transcriptionProvider` (type: `string`):

Where the speech is transcribed. Both run Whisper with word-level timestamps. Leave Automatic unless you add both keys.

## `openaiApiKey` (type: `string`):

Optional. Your own OpenAI key (platform.openai.com). OpenAI bills you for Whisper and the per-minute transcription fee is not charged.

## `openrouterApiKey` (type: `string`):

Optional. Your own OpenRouter key (openrouter.ai/keys) instead of OpenAI. Same Whisper model and price through OpenRouter credits. Leave both keys empty to use the built-in transcription (billed per minute).

## `transcriptionModel` (type: `string`):

Leave empty for Whisper (whisper-1 on OpenAI, openai/whisper-1 on OpenRouter). Another OpenRouter model only works if it returns word timestamps.

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

Setting the language avoids wrong auto-detection on short clips and improves accuracy.

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

Brand names, product names or unusual words, spelled the way you want them (e.g. 'Pepfine, Trybello Hair Helper, niacinamida'). Whisper uses this as a spelling guide. (Used by OpenAI; OpenRouter ignores it, so also add word replacements.)

## `wordReplacements` (type: `object`):

Fix words the transcription keeps getting wrong: {"wrong": "Right"}. Whole words only, case-insensitive. Example: {"pepfain": "Pepfine"}.

## `stylePreset` (type: `string`):

Pick a ready-made look, or 'Custom' to use the font, color, position and animation settings below. A preset overrides those settings.

## `fontSelection` (type: `string`):

Choose between pre-installed fonts or upload your own custom TTF font file

## `fontName` (type: `string`):

Font for the captions. Commercial fonts (Arial, Helvetica, Impact, Futura, Avenir...) are rendered with a free look-alike.

## `fontTtfUrl` (type: `string`):

Direct URL to your .ttf or .otf font file (only used if 'Upload Custom TTF Font' is selected above).

## `fontSize` (type: `integer`):

Caption size. With 'Same size on any resolution' on (default), 28-40 works for TikTok/Reels and 22-30 for YouTube.

## `bold` (type: `integer`):

Make text bold for better readability

## `primaryColour` (type: `string`):

Main color of the caption text

## `highlightColour` (type: `string`):

Color for highlighted/emphasized words (only used with 'Word-by-Word Highlight' animation)

## `outline` (type: `integer`):

Thickness of text outline/stroke. Higher values = more visible on any background. Recommended: 2-4

## `outlineColour` (type: `string`):

Color of the text outline/stroke. Black works best for light text, white for dark text

## `borderStyle` (type: `string`):

Choose how captions appear over video. Outline is cleaner, Background Box is more readable

## `shadow` (type: `integer`):

Add depth to text with a shadow effect. Only works with 'Outline + Drop Shadow' style

## `verticalPosition` (type: `integer`):

Where captions appear vertically. 0% = very bottom, 15% = slightly above bottom (recommended), 50% = middle, 100% = top

## `alignment` (type: `string`):

Horizontal and vertical alignment of captions on screen

## `wordsPerSegment` (type: `integer`):

Maximum words shown together. A caption also ends early at the end of a sentence or a pause. 2-3 for TikTok/Reels, 6-10 for YouTube, 0 = Whisper's natural sentences.

## `maxWordsPerLine` (type: `integer`):

Maximum words on one line before breaking to next line. Set to 0 for automatic line breaking, or 2-4 for short punchy lines

## `textCase` (type: `string`):

Transform how text appears. UPPERCASE is popular for social media captions

## `animationStyle` (type: `string`):

Choose how captions appear and animate. 'Word-by-Word Highlight' and 'Pop' are popular for social media

## `translateTo` (type: `string`):

Captions in another language, timed to the original speech. One small AI call per video with your OpenAI/OpenRouter key, or the built-in one (US$0.01 per video).

## `keywords` (type: `boolean`):

AI picks the words that carry the message (numbers, key nouns, strong verbs) and colors them.

## `keywordColour` (type: `string`):

\#RRGGBB. Empty = green (pink if your highlight is green).

## `emojis` (type: `boolean`):

AI adds a fitting emoji next to some captions (about one every two lines), in a clean one-color style.

## `removeSilences` (type: `boolean`):

Cuts pauses longer than the value below before captioning, for a faster, tighter video.

## `silenceMinSeconds` (type: `string`):

Shorter = more cuts. A little breathing room is kept on each side of every cut.

## `reframe` (type: `string`):

Turns a horizontal video into 1080×1920 for TikTok, Reels and Shorts. Vertical videos are left as they are.

## `textModel` (type: `string`):

Empty = anthropic/claude-haiku-5.5 on OpenRouter or gpt-6-luna-pro on OpenAI.

## `burnCaptions` (type: `boolean`):

On: get an MP4 with the captions drawn on it, plus subtitle files. Off: only SRT, VTT, ASS and transcript files (faster, works with audio files).

## `relativeFontSize` (type: `boolean`):

Font size, outline and position scale with the video, so a value of 36 looks the same on 720p, 1080p or 4K. Turn off to use raw video pixels (older behaviour).

## `testMode` (type: `boolean`):

Make one preview image of a frame with sample captions (about 10 seconds, no transcription). Use it to tune the style before captioning the full video.

## Actor input object example

```json
{
  "videoUrls": [
    {
      "url": "https://api.apify.com/v2/key-value-stores/lYhzUaQnLmzci34BM/records/muestra-captions-es.mp4"
    }
  ],
  "transcriptionProvider": "auto",
  "language": "",
  "wordReplacements": {},
  "stylePreset": "custom",
  "fontSelection": "preset",
  "fontName": "Montserrat",
  "fontSize": 28,
  "bold": 1,
  "primaryColour": "&HFFFFFF&",
  "highlightColour": "&H00FFFF&",
  "outline": 2,
  "outlineColour": "&H000000&",
  "borderStyle": "1",
  "shadow": 0,
  "verticalPosition": 15,
  "alignment": "bottom_center",
  "wordsPerSegment": 3,
  "maxWordsPerLine": 0,
  "textCase": "normal",
  "animationStyle": "none",
  "translateTo": "",
  "keywords": false,
  "emojis": false,
  "removeSilences": false,
  "silenceMinSeconds": "0.6",
  "reframe": "none",
  "burnCaptions": true,
  "relativeFontSize": true,
  "testMode": false
}
```

# 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 = {
    "videoUrls": [
        {
            "url": "https://api.apify.com/v2/key-value-stores/lYhzUaQnLmzci34BM/records/muestra-captions-es.mp4"
        }
    ],
    "wordReplacements": {}
};

// Run the Actor and wait for it to finish
const run = await client.actor("ingeniela/auto-captions-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 = {
    "videoUrls": [{ "url": "https://api.apify.com/v2/key-value-stores/lYhzUaQnLmzci34BM/records/muestra-captions-es.mp4" }],
    "wordReplacements": {},
}

# Run the Actor and wait for it to finish
run = client.actor("ingeniela/auto-captions-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 '{
  "videoUrls": [
    {
      "url": "https://api.apify.com/v2/key-value-stores/lYhzUaQnLmzci34BM/records/muestra-captions-es.mp4"
    }
  ],
  "wordReplacements": {}
}' |
apify call ingeniela/auto-captions-subtitle-generator --silent --output-dataset

```

## MCP server setup

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