How to add highlighted word captions with Claude

Three words sit on screen at a time and the one being spoken turns yellow.

Get this effect

  1. Switch to Code in your Claude Desktop App

  2. Install the skill (once)

    Show the prompt
    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 highlighted word captions to input.mp4 using the word timings in words.json
    Words on screen at once: 3
    Color of the word being spoken: (255, 212, 0)

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 highlighted 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.

SettingDefaultWhat it does
CHUNK3Words on screen at once.
HIGHLIGHT(255, 212, 0)Color of the word being spoken.
SIZE0.085Text height as a share of the frame width. Long phrases shrink to fit.
Y0.70Where the line sits, from 0 (top) to 1 (bottom).

In other editors

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

Closest built-in: Karaoke · web

  1. Click Subtitles in the left menu, then choose Auto Subtitles.
  2. Pick the Karaoke animation style from the style options.
  3. Adjust the font, color and size to match your brand.
  4. Click Done and switch on burn subtitles before exporting.

VEED's page lists a Karaoke subtitle style but doesn't describe how it highlights words.

Source: Animated Subtitles - AI Subtitle Generator (VEED), 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.

Show the prompt
Add captions to input.mp4 using the word timings in words.json. Show the words three at a time in capitals, centered 70% of the way down, white bold text with a black outline, and turn the word being spoken yellow (255, 212, 0). Each group stays up from its first word's start to its last word's end. Use Python with Pillow to draw it and ffmpeg to put it on the video (don't rely on ffmpeg's drawtext filter), keep the audio, and save it as output.mp4.

Run it without Claude

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

python3 highlighted-word-captions.py input.mp4 words.json output.mp4
Show the script
#!/usr/bin/env python3
"""Highlighted word captions: short phrases on screen, with the word being spoken lit up in yellow.

Usage: python3 highlighted-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.085                # text height as a share of the frame width (shrinks to fit long phrases)
Y = 0.70                    # where the line sits (0 = top, 1 = bottom)
CHUNK = 3                   # words on screen at once
HIGHLIGHT = (255, 212, 0)   # color of the word being spoken
STROKE = 0.01               # 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
FONT_FILE = next((f for f in FONTS if Path(f).exists()), None) or sys.exit("No bold font found: add one to FONTS")


fonts = {}


def fitted_font(texts):
    """The largest font up to SIZE that fits the phrase in 90% of the frame width."""
    size = round(w * SIZE)
    while size > 12:
        font = fonts.get(size) or fonts.setdefault(size, ImageFont.truetype(FONT_FILE, size))
        if sum(font.getlength(s) for s in texts) + font.getlength(" ") * (len(texts) - 1) <= w * 0.9:
            return font
        size -= 2
    return font


def overlay(t):
    img = Image.new("RGBA", (w, h))
    draw = ImageDraw.Draw(img)
    for group in (words[i:i + CHUNK] for i in range(0, len(words), CHUNK)):
        if not group[0]["start"] <= t < group[-1]["end"]:
            continue
        spoken = [word for word in group if word["start"] <= t][-1]  # the word being said, or the last one said
        texts = [word["word"].strip().upper() for word in group]
        font = fitted_font(texts)
        space = font.getlength(" ")
        x = (w - sum(font.getlength(s) for s in texts) - space * (len(texts) - 1)) / 2
        for word, s in zip(group, texts):
            draw.text((x, h * Y), s, font=font, anchor="lm", fill=HIGHLIGHT if word is spoken else "white",
                      stroke_width=round(w * STROKE), stroke_fill="black")
            x += font.getlength(s) + space
    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)
render(src, out)

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