---
title: "How to add a text behind subject with Claude (tested prompt and script)"
description: "A giant red \"GLOW\" rises up behind the serum bottle, and as the camera circles, the dropper cap stays in front, cutting through the middle of the word. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/text-behind-subject
---

# How to add a text behind subject with Claude

A giant red "GLOW" rises up behind the serum bottle, and as the camera circles, the dropper cap stays in front, cutting through the middle of the word.

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 a text behind subject to input.mp4
   Word: GLOW
   ```

## 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 a text behind subject 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                                                             |
| ------- | --------------- | ------------------------------------------------------------------------ |
| `WORD`  | `GLOW`          | The word behind the subject.                                             |
| `START` | `0.5`           | Second the word starts rising in.                                        |
| `RISE`  | `0.6`           | Seconds the rise and fade-in take.                                       |
| `LIFT`  | `0.06`          | How far below its place the word starts, as a share of the frame height. |
| `WIDTH` | `0.90`          | Word width as a share of the frame width.                                |
| `Y`     | `0.31`          | Word center, 0-1 down the frame; put it where the subject crosses it.    |
| `COLOR` | `(235, 45, 70)` | Word color.                                                              |

## Without the skill

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

```
Put text behind the subject in input.mp4 (540x960, the camera circles a serum bottle whose dropper cap sits around 22% to 41% down the frame). Draw the word "GLOW" in Arial Black (or another heavy sans-serif) in red (235, 45, 70), sized so it spans 90% of the frame width and centered horizontally at 31% down the frame. Nothing shows before 0.5 seconds; from 0.5 to 1.1 seconds the word rises into place from 6% of the frame height lower while fading in from transparent, with an ease-out, then stays to the end. On every frame from 0.5 seconds, cut the bottle out with rembg (u2net model) and layer the frame, then the word, then the cut-out bottle on top, so the cap covers part of the word. Use Python with Pillow and numpy (draw the text with Pillow, not ffmpeg's drawtext) and ffmpeg to read and write the video, keep the size, 30fps and the audio, and save it as output.mp4.
```

## Run it without Claude

This is the exact script we tested. Save it as `text-behind-subject.py` and run:

```
python3 text-behind-subject.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Text behind subject: a giant red word rises up behind the product, which stays in front and hides part of it.

Usage: python3 text-behind-subject.py input.mp4 output.mp4
Needs ffmpeg, Pillow, numpy and rembg to cut the product out of every frame
(pip install pillow numpy "rembg[cpu]"; rembg downloads its u2net model on first use).
"""
import json
import subprocess
import sys
from pathlib import Path

import numpy as np
from PIL import Image, ImageDraw, ImageFont
from rembg import new_session

WORD = "GLOW"            # the word behind the subject
START = 0.5              # second the word starts rising in
RISE = 0.6               # seconds the rise and fade-in take
LIFT = 0.06              # how far below its place the word starts, as a share of the frame height
WIDTH = 0.90             # word width as a share of the frame width
Y = 0.31                 # word center, 0-1 down the frame (behind the bottle's cap)
COLOR = (235, 45, 70)    # word color
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 heavy font found: add one to FONTS")

def word_layer():
    """The word in COLOR on a transparent frame-sized layer, sized so it spans WIDTH of the frame."""
    font = ImageFont.truetype(FONT_FILE, 100)
    x0, _, x1, _ = font.getbbox(WORD)
    font = ImageFont.truetype(FONT_FILE, round(100 * w * WIDTH / (x1 - x0)))
    img = Image.new("RGBA", (w, h))
    ImageDraw.Draw(img).text((w / 2, h * Y), WORD, font=font, fill=COLOR, anchor="mm")
    return np.asarray(img, np.float32) / 255

def text_at(t):
    """The word layer at time t: risen and faded in by an ease-out between START and START + RISE."""
    p = min(max((t - START) / RISE, 0), 1)
    p = 1 - (1 - p) ** 3
    shift = round(h * LIFT * (1 - p))
    layer = np.zeros_like(word)
    layer[shift:] = word[:h - shift]
    layer[:, :, 3] *= p
    return layer

def composite(rgb, t):
    """Frame, then the word, then the product cut out of the frame on top."""
    if t < START:
        return rgb
    subject = np.asarray(session.predict(Image.fromarray(rgb))[0], np.float32)[:, :, None] / 255
    layer = text_at(t)
    alpha = layer[:, :, 3:] * (1 - subject)
    return ((rgb / 255 * (1 - alpha) + layer[:, :, :3] * alpha) * 255).round().astype(np.uint8)

def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate", "-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)

def render(src, out):
    """Read src frame by frame, composite each one and save to out, keeping the audio."""
    reader = subprocess.Popen(["ffmpeg", "-v", "error", "-i", src, "-f", "rawvideo", "-pix_fmt", "rgb24", "-"],
                              stdout=subprocess.PIPE)
    writer = subprocess.Popen(["ffmpeg", "-y", "-v", "error",
                               "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                               "-i", src, "-map", "0:v", "-map", "1:a?", "-c:v", "libx264", "-crf", "18",
                               "-pix_fmt", "yuv420p", "-c:a", "copy", "-shortest", out], stdin=subprocess.PIPE)
    i = 0
    while raw := reader.stdout.read(w * h * 3):
        rgb = np.frombuffer(raw, np.uint8).reshape(h, w, 3)
        writer.stdin.write(composite(rgb, i / fps).tobytes())
        i += 1
    writer.stdin.close()
    if reader.wait() or writer.wait():
        sys.exit("ffmpeg failed")

src, out = sys.argv[1:3]
w, h, rate, fps = probe(src)
word = word_layer()
session = new_session("u2net")
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)
