---
title: "How to add word-by-word captions with Claude (tested prompt and script)"
description: "Each word pops up alone in the middle of the screen at the moment it is spoken. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/word-by-word-captions
---

# How to add word-by-word captions with Claude

Each word pops up alone in the middle of the screen at the moment it is spoken.

Made by the script on this page, from our own test clip.

## Get this effect

1. ### Switch to Code in your [Claude Desktop App](https://claude.com/download)

2. ### Install the skill (once)

   ```
   Install the Recharm video effects skill: download https://recharm-growth-staging.s3.us-east-2.amazonaws.com/website/downloads/recharm-video-effects.zip and unzip it into ~/.claude/skills
   ```

3. ### Ask for the effect

   ```
   Add word-by-word captions to input.mp4 using the word timings in words.json
   Text height as a share of the frame width: 0.13
   Where the caption sits, from 0 (top) to 1 (bottom): 0.70
   ```

## Several videos, several effects, one ask

Put your clips in the folder, mention them with @, and ask for everything at once. Claude runs one tested script after another on each clip, then joins them.

Add word-by-word captions to **@clip1.mp4**, put a sale badge on **@clip2.mp4**, give **@clip3.mp4** a VHS look, then join all three with crossfades.

## Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

| Setting  | Default | What it does                                        |
| -------- | ------- | --------------------------------------------------- |
| `SIZE`   | `0.13`  | Text height as a share of the frame width.          |
| `Y`      | `0.70`  | Where the caption sits, from 0 (top) to 1 (bottom). |
| `STROKE` | `0.012` | Outline thickness. 0 removes the outline.           |

## In other editors

From each editor’s own help pages, in our words. We haven’t run these ourselves.

Closest built-in: **Dynamic Text**

1. From Agents & models, open Generative models, then Tools, and search Dynamic Text.
2. Browse the caption styles and pick one that suits your content.
3. Preview, fix the transcript if needed, then export.

The page says text syncs word by word as spoken, not that one word shows at a time.

Source: [Adding dynamic text to your videos](https://help.invideo.io/en/articles/14754637-adding-dynamic-text-to-your-videos) (InVideo), checked October 22, 2026.

## Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

```
Add word-by-word captions to input.mp4. words.json has the word timings. Show one word at a time in capitals, centered 70% of the way down, white bold text with a black outline, about 13% of the frame width tall, and only while that word is spoken. Keep the audio. Use Python with Pillow to draw the text and ffmpeg to put it on the video, and save it as output.mp4.
```

## Run it without Claude

This is the exact script we tested. Save it as `word-by-word-captions.py` and run:

```
python3 word-by-word-captions.py input.mp4 words.json output.mp4
```

```
#!/usr/bin/env python3
"""Word-by-word captions: one spoken word at a time, big and centered, on screen only while it is said.

Usage: python3 word-by-word-captions.py input.mp4 words.json output.mp4
words.json holds word timings, for example from Whisper:
  [{"word": "This", "start": 0.30, "end": 0.69}, {"word": "serum", "start": 0.77, "end": 1.13}, ...]
Needs ffmpeg and Pillow (pip install pillow).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

from PIL import Image, ImageDraw, ImageFont

SIZE = 0.13     # text height as a share of the frame width
Y = 0.70        # where the caption's center sits (0 = top, 1 = bottom)
STROKE = 0.012  # outline thickness as a share of the frame width
FONTS = ["/System/Library/Fonts/Supplemental/Arial Bold.ttf",     # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",  # Linux
         "C:/Windows/Fonts/arialbd.ttf"]                          # Windows

def overlay(t):
    """The caption layer for time t: the word being spoken, or nothing."""
    img = Image.new("RGBA", (w, h))
    for word in words:
        if word["start"] <= t < word["end"]:
            ImageDraw.Draw(img).text((w / 2, h * Y), word["word"].strip().upper(), font=font, anchor="mm",
                                     fill="white", stroke_width=round(w * STROKE), stroke_fill="black")
    return img

def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate:format=duration", "-of", "json", path]))
    s = info["streams"][0]
    num, den = s["r_frame_rate"].split("/")
    return s["width"], s["height"], s["r_frame_rate"], float(num) / float(den), float(info["format"]["duration"])

def render(src, out):
    """Draw overlay(t) on every frame of src and save to out, keeping the audio."""
    ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", src,
                           "-f", "rawvideo", "-pix_fmt", "rgba", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                           "-filter_complex", "[0:v][1:v]overlay=shortest=1,format=yuv420p[v]",
                           "-map", "[v]", "-map", "0:a?", "-c:v", "libx264", "-crf", "18", "-c:a", "copy", out],
                          stdin=subprocess.PIPE)
    for i in range(math.ceil(duration * fps)):
        ff.stdin.write(overlay(i / fps).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")

src, words_file, out = sys.argv[1:4]
words = json.loads(Path(words_file).read_text())
w, h, rate, fps, duration = probe(src)
font = ImageFont.truetype(next(f for f in FONTS if Path(f).exists()), round(w * SIZE))
render(src, out)
```

## More captions and text

- [AI chat reply animation **AI chat reply animation**](https://www.recharm.com/effects/ai-chat-typing)
- [Animated bar chart **Animated bar chart**](https://www.recharm.com/effects/animated-bar-chart)
- [Animated checklist **Animated checklist**](https://www.recharm.com/effects/animated-checklist)
- [Animated line graph **Animated line graph**](https://www.recharm.com/effects/animated-line-graph)
- [Animated pie chart **Animated pie chart**](https://www.recharm.com/effects/animated-pie-chart)

## Find 3x _winning ads_

Recharm cuts your ad footage into tagged, searchable clips: hooks, testimonials, product shots. Find the shots that win, add the effect with Claude, and ship 3x more ad edits.

[Start 14-day free trial](https://www.recharm.com/get-started)
