---
title: "How to add a 3D extruded text with Claude (tested prompt and script)"
description: "Thick yellow \"NEW DROP\" letters with solid red sides flip in from edge-on above the bottle, then keep swinging left and right in perspective, the nearer end growing and showing its red sides. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/extruded-3d-text
---

# How to add a 3D extruded text with Claude

Thick yellow "NEW DROP" letters with solid red sides flip in from edge-on above the bottle, then keep swinging left and right in perspective, the nearer end growing and showing its red sides.

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 3D extruded text to input.mp4
   Text: NEW DROP
   ```

## 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 3d extruded text 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                                                         |
| -------- | --------------- | -------------------------------------------------------------------- |
| `TEXT`   | `NEW DROP`      | The words.                                                           |
| `START`  | `0.5`           | Second the letters flip in.                                          |
| `SWING`  | `30`            | Degrees the letters turn either way.                                 |
| `PERIOD` | `3.0`           | Seconds for one full swing left, right and back.                     |
| `DEPTH`  | `0.09`          | How deep the letters are, as a share of the frame width.             |
| `CAMERA` | `1.2`           | Camera distance in frame widths: smaller means stronger perspective. |
| `FACE`   | `(255, 214, 0)` | Front face color.                                                    |
| `SIDE`   | `(215, 35, 55)` | Side color.                                                          |

## Without the skill

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

```
Add 3D extruded text to input.mp4: the words "NEW DROP" in a heavy font (Arial Black) 14% of the frame width tall, centered 50% across and 15% down. Treat the letters as a solid block 9% of the frame width deep. Draw it with Python, Pillow and numpy as a stack of flat copies of the letters (each thickened by a 3-pixel stroke), one every 2 pixels of depth, drawn from the back to the front: turn each copy around the text's vertical center line and project it in perspective from a camera 1.2 frame widths in front of the text (use Pillow's perspective transform), and also move each copy down 0.35 pixels per pixel of depth so the bottom sides show. Color the sides solid red (215, 35, 55), darkening to 45% of that toward the back, and 15% darker or brighter as they turn away from or toward a light on the left. On the front draw a 3-pixel dark red (120, 10, 30) outline and fill the letters yellow (255, 214, 0), slightly lighter at the top and deeper at the bottom. Animate the turn: at 0.5 seconds the text fades in over 0.15 seconds while flipping from 88 degrees (almost edge-on, right end toward the camera) to -30 degrees (left end toward the camera) over 0.8 seconds, easing out; from 1.3 seconds the angle is -30 * cos(2 * pi * (t - 1.3) / 3) degrees, so it swings smoothly to +30 and back every 3 seconds until the end. Draw any text with Pillow (don't rely on ffmpeg's drawtext filter), use ffmpeg to put it 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 `extruded-3d-text.py` and run:

```
python3 extruded-3d-text.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""3D extruded text: thick yellow letters with solid red sides flip in from edge-on and keep turning in depth.

Usage: python3 extruded-3d-text.py input.mp4 output.mp4
Needs ffmpeg, Pillow and numpy (pip install pillow numpy).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

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

TEXT = "NEW DROP"
START = 0.5                # second the letters flip in, from edge-on
ENTER = 0.8                # seconds the flip-in takes
FADE = 0.15                # seconds the letters take to fade in as they flip
SWING = 30                 # degrees the letters then turn either way
PERIOD = 3.0               # seconds for one full turn left, right and back
SIZE = 0.14                # letter height as a share of the frame width
X, Y = 0.5, 0.15           # text center (0-1 across and down the frame)
DEPTH = 0.09               # extrusion depth as a share of the frame width
DROP = 0.35                # how far the sides also run downward per pixel of depth (we look from slightly above)
CAMERA = 1.2               # camera distance in frame widths: smaller means stronger perspective
FACE = (255, 214, 0)       # front face color
SIDE = (215, 35, 55)       # side color where it meets the face; it darkens toward the back
EDGE = (120, 10, 30)       # thin outline around the front face
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 letters(stroke):
    """The text as a mask over the rows it covers (band_y to band_y + band_h), thickened by `stroke` pixels."""
    mask = Image.new("L", (w, h))
    font = ImageFont.truetype(FONT_FILE, round(w * SIZE))
    ImageDraw.Draw(mask).text((w * X, h * Y), TEXT, font=font, anchor="mm", fill=255,
                              stroke_width=stroke, stroke_fill=255)
    return mask.crop((0, band_y, w, band_y + band_h))

def project(mask, a, z):
    """The mask as a flat card turned `a` radians around its vertical center line and pushed `z` pixels back,
    seen in perspective from CAMERA frame widths away, then dropped z * DROP pixels."""
    f, c, s = CAMERA * w, math.cos(a), math.sin(a)
    cx, cy = w * X, h * Y - band_y
    to_card = np.array([[1, 0, -cx], [0, 1, -cy - z * DROP], [0, 0, 1]])
    unproject = np.array([[1 + z * c / f, 0, -z * s], [0, c + z / f, 0], [s / f, 0, c]])
    to_mask = np.array([[1, 0, cx], [0, 1, cy], [0, 0, 1]])
    m = to_mask @ unproject @ to_card            # output pixel -> mask pixel
    m = m / m[2, 2]
    return np.asarray(mask.transform(mask.size, Image.PERSPECTIVE, tuple(m.flat[:8]), Image.BILINEAR), np.float32) / 255

def angle(t):
    """Turn in degrees around the vertical axis: 88 is nearly edge-on, 0 faces the camera."""
    p = (t - START) / ENTER
    if p < 1:
        return 88 + (-SWING - 88) * (1 - (1 - p) ** 3)   # flip in, easing out
    return -SWING * math.cos(2 * math.pi * (t - START - ENTER) / PERIOD)

def overlay(t):
    img = np.zeros((h, w, 4), np.uint8)
    if t < START:
        return img
    a = math.radians(angle(t))
    depth = round(DEPTH * w)
    side, nearest = np.zeros((band_h, w), np.float32), np.zeros((band_h, w), np.float32)
    for z in range(depth, 0, -2):   # back to front, so nearer slices cover farther ones
        s = project(body_mask, a, z)
        side = np.maximum(side, s)
        nearest = np.where(s > 0.5, z, nearest)
    body, face = project(body_mask, a, 0), project(face_mask, a, 0)
    side = np.maximum(side, body)
    light = 0.85 - 0.15 * math.sin(a)                   # light from the left: sides facing it are brighter
    shade = (light * (1 - 0.55 * nearest / depth))[..., None]
    rgb = np.array(SIDE, np.float32) * shade
    rgb = rgb * (1 - body[..., None]) + np.array(EDGE, np.float32) * body[..., None]
    rgb = rgb * (1 - face[..., None]) + face_color * face[..., None]
    fade = min((t - START) / FADE, 1)
    img[band_y:band_y + band_h, :, :3] = rgb.clip(0, 255).astype(np.uint8)
    img[band_y:band_y + band_h, :, 3] = (side * fade * 255).astype(np.uint8)
    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]
w, h, rate, fps, duration = probe(src)
band_y = round(h * Y - w * SIZE * 1.4)                    # rows the turning text and its sides can cover
band_h = round(w * SIZE * 2.8 + DEPTH * w * DROP)
face_mask, body_mask = letters(0), letters(3)
rows = np.linspace(0, 1, band_h)[:, None, None]           # face shades from light yellow at the top to deeper below
face_color = np.array(FACE, np.float32) + np.array([0, 20, 60], np.float32) * (0.5 - rows)
render(src, out)
```

## More text and titles

- [Animated text frame **Animated text frame**](https://www.recharm.com/effects/animated-text-frame)
- [Brush stroke text reveal **Brush stroke text reveal**](https://www.recharm.com/effects/brush-stroke-text-reveal)
- [Burning text **Burning text**](https://www.recharm.com/effects/burning-text)
- [Drop shadow text **Drop shadow text**](https://www.recharm.com/effects/drop-shadow-text)
- [Echo text **Echo text**](https://www.recharm.com/effects/echo-text)

## 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)
