Get this effect
Switch to Code in your Claude Desktop App
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/skillsAsk for the effect
Add an animated underline to input.mp4 using the word timings in words.json Key: cleared
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 an animated underline 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 |
|---|---|---|
KEY | cleared | The word that gets underlined. |
DRAW | 0.4 | Seconds the line takes to draw, starting when the word is spoken. |
LINE | 3 | Words per caption line. |
HOLD | 0.5 | Seconds the caption stays after the last word. |
SIZE | 0.085 | Text height as a share of the frame width. |
UNDERLINE | (255, 214, 0) | Underline color. |
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 a caption with an animated underline to input.mp4 using the word timings in words.json. Show the whole spoken sentence in white bold text with a black outline, 46 px tall, three words per line, the block centered horizontally and 70% of the way down, from the first word's start until 0.5 seconds after the last word's end. When the word "cleared" starts being spoken, draw a yellow (255, 214, 0) rounded underline 7 px thick with a thin black outline just below that word, growing left to right across the word's width over 0.4 seconds, and keep it there until the caption goes. Nothing is underlined before that. 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 animated-underline.py and run:
python3 animated-underline.py input.mp4 words.json output.mp4Show the script
#!/usr/bin/env python3
"""Animated underline: a yellow line draws itself under one key word of the caption as it is spoken.
Usage: python3 animated-underline.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
KEY = "cleared" # the word that gets underlined
DRAW = 0.4 # seconds the line takes to draw, starting when the word is spoken
LINE = 3 # words per caption line
HOLD = 0.5 # seconds the caption stays after the last word
SIZE = 0.085 # text height as a share of the frame width
Y = 0.70 # where the caption's center sits (0 = top, 1 = bottom)
UNDERLINE = (255, 214, 0) # underline color
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")
def overlay(t):
img = Image.new("RGBA", (w, h))
if not words[0]["start"] <= t < words[-1]["end"] + HOLD:
return img
draw = ImageDraw.Draw(img)
names = [word["word"].strip() for word in words]
lines = [names[i:i + LINE] for i in range(0, len(names), LINE)]
step = font.size * 1.5
edge = round(font.size * 0.08) # black outline around the text and the line
for row, line in enumerate(lines):
text = " ".join(line)
base = h * Y + (row - (len(lines) - 1) / 2) * step + font.size * 0.35 # this line's baseline
draw.text((w / 2, base), text, font=font, anchor="ms", fill="white", stroke_width=edge, stroke_fill="black")
if KEY in line:
spoken = next(word["start"] for word in words if word["word"].strip() == KEY)
p = min(1, (t - spoken) / DRAW)
if p > 0:
x = w / 2 - font.getlength(text) / 2 + font.getlength(" ".join(line[:line.index(KEY)] + [""]))
top, thick = base + font.size * 0.16, font.size * 0.16
draw.rounded_rectangle([x, top, x + max(thick, font.getlength(KEY) * p), top + thick],
radius=thick / 2, fill=UNDERLINE, outline="black", width=edge // 2)
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(FONT_FILE, round(w * SIZE))
render(src, out)





