---
title: "How to add bold highlighted captions with Claude (tested prompt and script)"
description: "Chunky uppercase captions fill two lines at a time, and the longest word on each line sits in a yellow box with black letters. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/bold-highlighted-captions
---

# How to add bold highlighted captions with Claude

Chunky uppercase captions fill two lines at a time, and the longest word on each line sits in a yellow box with black letters.

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 bold highlighted captions to input.mp4
   Text height as a share of the frame width: 0.10
   Where the first line's center sits, from 0 (top) to 1 (bottom): 0.72
   ```

## 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 bold highlighted 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.10`          | Text height as a share of the frame width. Long lines shrink to fit. |
| `Y`        | `0.72`          | Where the first line's center sits, from 0 (top) to 1 (bottom).      |
| `LINE_GAP` | `1.6`           | Distance between line centers, in text heights.                      |
| `PER_LINE` | `2`             | Words on each line.                                                  |
| `LINES`    | `2`             | Lines on screen at once.                                             |
| `BOX`      | `(255, 212, 0)` | Keyword box color.                                                   |
| `BOX_TEXT` | `(0, 0, 0)`     | Keyword text color.                                                  |
| `PAD`      | `0.18`          | Box padding around the keyword, in text heights.                     |
| `STROKE`   | `0.012`         | Outline on the other words, as a share of the frame width.           |

## Without the skill

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

```
Add bold highlighted captions to input.mp4. Transcribe its voice with faster-whisper (model base.en, device cpu, compute_type int8, word_timestamps=True) to get each word's start and end time. Uppercase the words and strip punctuation. Show them four at a time as two lines of two words, in Arial Black (or another heavy bold font) with the text 10% of the frame width tall, shrinking it if needed so every line fits in 90% of the width. Center each line horizontally; the first line's center sits 72% of the way down the frame and the second line's center 1.6 text heights below it. On each line, the longest word is the keyword: draw it in black (0, 0, 0) on a yellow (255, 212, 0) rounded box padded 18% of the text height on every side, with corner radius equal to that padding, and leave that padding as extra room on both sides of the box. The other words are white with a black outline 1.2% of the frame width thick. Each group of four stays up from its first word's start to its last word's end, and nothing shows after the last word. Use Python with Pillow to draw the text and boxes (don't use ffmpeg's drawtext filter) and ffmpeg to put them on the video, keep the audio, and save it as output.mp4.
```

## Run it without Claude

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

```
python3 bold-highlighted-captions.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Bold highlighted captions: chunky uppercase captions, two lines at a time, with each line's keyword in a yellow box.

Usage: python3 bold-highlighted-captions.py input.mp4 output.mp4
Whisper transcribes the voice for the word timings, so no subtitle file is needed. The keyword on each line is its
longest word. Needs ffmpeg, faster-whisper and Pillow (pip install faster-whisper pillow); the first run downloads
Whisper's base.en model (about 140 MB).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

from faster_whisper import WhisperModel
from PIL import Image, ImageDraw, ImageFont

SIZE = 0.10                 # text height as a share of the frame width (shrinks to fit long lines)
Y = 0.72                    # where the first line's center sits (0 = top, 1 = bottom)
LINE_GAP = 1.6              # distance between line centers, in text heights
PER_LINE = 2                # words on each line
LINES = 2                   # lines on screen at once
BOX = (255, 212, 0)         # keyword box color
BOX_TEXT = (0, 0, 0)        # keyword text color
PAD = 0.18                  # box padding around the keyword, in text heights
STROKE = 0.012              # outline on the other words, as a share of the frame width
FONTS = ["/System/Library/Fonts/Supplemental/Arial Black.ttf",          # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",       # Linux
         "C:/Windows/Fonts/ariblk.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")

def transcribe(path):
    """Every spoken word with its start and end time, uppercased and without punctuation."""
    model = WhisperModel("base.en", device="cpu", compute_type="int8")
    segments, _ = model.transcribe(path, word_timestamps=True)
    return [{"text": w.word.strip().strip(".,!?;:\"").upper(), "start": w.start, "end": w.end}
            for s in segments for w in s.words]

def fitted_font(lines):
    """The largest font up to SIZE that fits every line, boxes included, in 90% of the frame width."""
    size = round(w * SIZE)
    while True:
        font = ImageFont.truetype(FONT_FILE, size)
        widest = max(font.getlength(" ".join(line)) for line in lines) + 2 * PAD * size
        if widest <= w * 0.9 or size <= 12:
            return font
        size -= 2

def draw_caption(draw, lines):
    font = fitted_font(lines)
    size, space, pad = font.size, font.getlength(" "), PAD * font.size
    for row, line in enumerate(lines):
        keyword = max(range(len(line)), key=lambda i: len(line[i]))
        x = (w - font.getlength(" ".join(line)) - 2 * pad) / 2
        y = h * Y + row * LINE_GAP * size
        for i, word in enumerate(line):
            if i == keyword:
                x += pad
                left, top, right, bottom = draw.textbbox((x, y), word, font=font, anchor="lm")
                draw.rounded_rectangle((left - pad, top - pad, right + pad, bottom + pad), radius=pad, fill=BOX)
                draw.text((x, y), word, font=font, anchor="lm", fill=BOX_TEXT)
                x += pad
            else:
                draw.text((x, y), word, font=font, anchor="lm", fill="white",
                          stroke_width=round(w * STROKE), stroke_fill="black")
            x += font.getlength(word) + space

def overlay(t):
    img = Image.new("RGBA", (w, h))
    chunk = PER_LINE * LINES
    for group in (words[i:i + chunk] for i in range(0, len(words), chunk)):
        if group[0]["start"] <= t < group[-1]["end"]:
            texts = [word["text"] for word in group]
            draw_caption(ImageDraw.Draw(img), [texts[i:i + PER_LINE] for i in range(0, len(texts), PER_LINE)])
    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, out = sys.argv[1:3]
words = transcribe(src)
w, h, rate, fps, duration = probe(src)
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)
