How to add a glitch text with Claude

"NEW DROP" flickers in at the top as torn slices with pink and cyan ghosts pulled off each side, settles into clean dark letters, then breaks up again in short bursts.

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 a glitch 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 glitch 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.

SettingDefaultWhat it does
TEXTNEW DROPThe title.
Y0.12Center of the title (0 = top, 1 = bottom).
WIDTH0.8Title width as a share of the frame width.
COLOR(20, 16, 40)Title color.
LEFT_COPY, RIGHT_COPY(255, 30, 90), (0, 230, 255)Colors of the copies that split off to each side.
BURSTS[0.5, 2.2, 3.8, 5.2]Seconds each glitch burst starts; the first one brings the title in.
LENGTH0.3How long each burst lasts, in seconds.
SPLIT0.025How far each color copy moves off, as a share of the frame width.
TEAR0.04How far a torn slice can slide sideways, as a share of the frame width.
SEED3Change for a different (but repeatable) glitch.

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 glitch text to input.mp4: "NEW DROP" in a heavy bold font (Arial Black), dark navy (20, 16, 40), 80% of the frame width wide, centered horizontally with its middle 12% of the way down. It appears at 0.5 seconds and stays to the end. Glitch it in bursts of 0.3 seconds starting at 0.5, 2.2, 3.8 and 5.2 seconds; between bursts it sits still and clean with no colored copies. On every frame of a burst, draw a pink (255, 30, 90) copy of the text shifted left and a cyan (0, 230, 255) copy shifted right, each by a random 1.5% to 3.5% of the frame width, put the navy text on top, cut the text into horizontal slices 7% to 20% of its height and slide about a third of them sideways by up to 4% of the frame width, and jolt the whole title up to 2% of the frame width sideways and 1% of the frame height up or down. Only the text glitches: the video behind stays untouched, and nothing is added before 0.5 seconds. Draw the text with Python, Pillow and numpy (don't rely on ffmpeg's drawtext filter), keep the size and audio, and save it as output.mp4.

Run it without Claude

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

python3 glitch-text.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Glitch text: a dark title whose letters split into pink and cyan copies and tear sideways in short bursts.

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

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

TEXT = "NEW DROP"                       # the title
Y = 0.12                                # center of the title (0 = top, 1 = bottom)
WIDTH = 0.8                             # title width as a share of the frame width
COLOR = (20, 16, 40)                    # title color
LEFT_COPY = (255, 30, 90)               # color of the copy that splits off to the left
RIGHT_COPY = (0, 230, 255)              # color of the copy that splits off to the right
BURSTS = [0.5, 2.2, 3.8, 5.2]           # seconds each glitch burst starts (the first one brings the title in)
LENGTH = 0.3                            # seconds each burst lasts
SPLIT = 0.025                           # how far each color copy moves off, as a share of the frame width
TEAR = 0.04                             # how far a torn slice can slide sideways, as a share of the frame width
SEED = 3                                # change for a different (but repeatable) glitch
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 title_mask():
    """The title as a white-on-black mask, sized so it fills WIDTH, with room around it to shift."""
    probe_font = ImageFont.truetype(FONT_FILE, 100)
    font = ImageFont.truetype(FONT_FILE, round(100 * w * WIDTH / probe_font.getlength(TEXT)))
    pad = round(w * (SPLIT + TEAR))
    mask = Image.new("L", (round(font.getlength(TEXT)) + 2 * pad, round(font.size * 1.4)))
    ImageDraw.Draw(mask).text((mask.width / 2, mask.height / 2), TEXT, font=font, anchor="mm", fill=255)
    return np.asarray(mask, np.float32) / 255


def glitch_layer(rng):
    """One glitched frame of the title: pink and cyan copies pulled apart, then horizontal slices torn sideways."""
    split = round(w * SPLIT * rng.uniform(0.6, 1.4))
    left, right = np.roll(mask, -split, axis=1), np.roll(mask, split, axis=1)
    copies = (left[..., None] * LEFT_COPY + right[..., None] * RIGHT_COPY) / np.maximum(left + right, 1e-6)[..., None]
    rgb = copies * (1 - mask[..., None]) + mask[..., None] * np.array(COLOR, np.float32)
    alpha = np.maximum(mask, np.maximum(left, right))
    layer = np.dstack([np.clip(rgb, 0, 255), alpha * 255]).astype(np.uint8)
    y = 0
    while y < layer.shape[0]:
        band = rng.randint(layer.shape[0] // 14, layer.shape[0] // 5)
        if rng.random() < 0.35:
            layer[y:y + band] = np.roll(layer[y:y + band], rng.choice((-1, 1)) * round(w * TEAR * rng.uniform(0.3, 1)), axis=1)
        y += band
    return Image.fromarray(layer)


def overlay(t):
    img = Image.new("RGBA", (w, h))
    if t < BURSTS[0]:
        return img
    if any(start <= t < start + LENGTH for start in BURSTS):
        rng = random.Random(f"{SEED}-{round(t * fps)}")   # a fresh glitch on every frame of a burst
        title = glitch_layer(rng)
        jump = (round(w * 0.02 * rng.uniform(-1, 1)), round(h * 0.01 * rng.uniform(-1, 1)))
    else:
        title = clean
        jump = (0, 0)
    img.alpha_composite(title, (round((w - title.width) / 2) + jump[0], round(h * Y - title.height / 2) + jump[1]))
    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)
mask = title_mask()
clean = Image.fromarray(np.dstack([np.ones(mask.shape + (3,)) * np.array(COLOR), mask * 255]).astype(np.uint8))
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