How to add a brush stroke transition with Claude

Five streaky marigold paint strokes swipe across clip A from top to bottom, alternating direction, and clip B is left showing wherever the brush has passed.

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

    Join clipA.mp4 and clipB.mp4 with a brush stroke transition
    Length of the transition in seconds: 1.2
    Number of paint strokes, painted top to bottom: 5

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.

Put a sale badge on @clip1.mp4, give @clip2.mp4 a VHS look, then join them with a brush stroke transition.

Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

SettingDefaultWhat it does
D1.2Length of the transition in seconds.
STROKES5Number of paint strokes, painted top to bottom.
STAGGER0.1Delay between one stroke and the next, as a share of D.
SWEEP0.6Time one stroke takes to cross the frame, as a share of D.
THICK1.4Stroke thickness as a multiple of the frame height divided by STROKES.
TILT0.06Slope of the strokes, in pixels down per pixel across.
PAINT(250, 190, 40)Paint color.
HEAD0.45Length of the paint before clip B shows, as a share of the frame width.
BRISTLES0.12How ragged the tip and tail are, as a share of the frame width.
ROUND0.12How far the tip's and tail's corners curve back, as a share of the frame width.
SEED3Change it for different bristles.

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
Join clipA.mp4 and clipB.mp4 with a 1.2 second brush stroke transition over the last 1.2 seconds of A, so the result is 10.8 seconds long. Five horizontal paint strokes, each 1.4 times a fifth of the frame height thick, centered at 10%, 30%, 50%, 70% and 90% of the way down and sloping 0.06 pixels down per pixel across, sweep across the frame one after another from top to bottom: the first, third and fifth go left to right, the second and fourth right to left. Each starts 0.12 seconds after the one before and takes 0.72 seconds to cross, easing in and out. Each stroke's front is marigold paint (250, 190, 40), streaked lighter and darker along its length like bristles, 45% of the frame width long; behind the paint clip B shows through. Make the strokes look hand-painted: ragged top and bottom edges, and a tip and tail that are rounded and frayed into bristles, up to 12% of the frame width back. By the end all the paint has left the frame and only B shows. Fit B to A's size and 30fps, crossfade the audio over the same 1.2 seconds, use Python with numpy and Pillow for the frames and ffmpeg to read and write the video (draw anything with Pillow, not ffmpeg's drawtext), and save it as output.mp4.

Run it without Claude

This is the exact script we tested. Save it as brush-stroke-transition.py and run:

python3 brush-stroke-transition.py clipA.mp4 clipB.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Brush stroke transition: five thick marigold paint strokes sweep across clip A, top to bottom, leaving clip B behind them.

Usage: python3 brush-stroke-transition.py clipA.mp4 clipB.mp4 output.mp4  (both clips need an audio track)
Needs ffmpeg, Pillow and numpy (pip install pillow numpy).
"""
import json
import subprocess
import sys

import numpy as np
from PIL import Image

D = 1.2                  # transition length in seconds
STROKES = 5              # number of strokes, painted top to bottom, alternating left-to-right and right-to-left
STAGGER = 0.1            # delay between one stroke and the next, as a share of D
SWEEP = 0.6              # time one stroke takes to cross the frame, as a share of D
THICK = 1.4              # stroke thickness, as a multiple of the frame height / STROKES (over 1 so they overlap)
TILT = 0.06              # how much the strokes slope (pixels down per pixel across)
PAINT = (250, 190, 40)   # paint color, a marigold yellow
HEAD = 0.45              # length of the paint before clip B shows through, as a share of the frame width
BRISTLES = 0.12          # how ragged the stroke's tip and tail are, as a share of the frame width
ROUND = 0.12             # how far the corners of the tip and tail curve back, as a share of the frame width
SEED = 3                 # change for different bristles
FPS = 30


def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height:format=duration", "-of", "json", path]))
    return info["streams"][0]["width"], info["streams"][0]["height"], float(info["format"]["duration"])


def frames(path):
    """Every frame of a clip, fitted to A's size at 30fps, as a float RGB array."""
    fit = f"scale={w}:{h}:force_original_aspect_ratio=increase,crop={w}:{h},fps={FPS}"
    ff = subprocess.Popen(["ffmpeg", "-v", "error", "-i", path, "-vf", fit, "-f", "rawvideo", "-pix_fmt", "rgb24", "-"],
                          stdout=subprocess.PIPE)
    while True:
        chunk = ff.stdout.read(w * h * 3)
        if not chunk:
            break
        yield np.frombuffer(chunk, np.uint8).reshape(h, w, 3).astype(np.float32)


def wander(n, rng):
    """A wandering line of n values between 0 and 1: broad clumps of bristles plus single fine ones."""
    line = np.zeros(n)
    for cells, amp in [(4, 0.45), (18, 0.35), (90, 0.2)]:
        knots = rng.uniform(0, 1, cells + 1)
        line += amp * np.interp(np.linspace(0, cells, n), np.arange(cells + 1), knots)
    return line


def stroke_shapes():
    """For each stroke: where it covers, the distance along it of every pixel, how far back each bristle row's tip and
    tail sit, and a streaky shade for the paint."""
    rng = np.random.default_rng(SEED)
    band = h / STROKES
    thick = THICK * band
    y, x = np.mgrid[0:h, 0:w].astype(np.float32)
    shapes = []
    for i in range(STROKES):
        across = y - ((i + 0.5) * band + TILT * (x - w / 2))       # distance from the stroke's center line
        edge = thick / 2 * (0.9 + 0.1 * wander(w, rng))[None, :]    # ragged top and bottom edges
        inside = np.clip(edge - np.abs(across) + 0.5, 0, 1)
        row = np.clip(across + thick / 2, 0, thick - 1).astype(int)  # which bristle row each pixel is in
        tip, tail, streak = (wander(round(thick), rng)[row] for _ in range(3))
        curve = (across / (thick / 2)) ** 2 * ROUND * w  # rounds the tip and tail like a brush head
        along = x if i % 2 == 0 else w - 1 - x
        shade = 0.84 + 0.2 * streak
        shapes.append((inside, along, tip * BRISTLES * w + curve, tail * BRISTLES * w + curve, shade[..., None]))
    return shapes


def brush(a, b, p):
    """Frame at progress p (0-1): each stroke's paint covers what's under it, and clip B shows behind the paint."""
    img = a
    paint = np.array(PAINT, np.float32)
    for i, (inside, along, tip, tail, shade) in enumerate(shapes):
        s = np.clip((p - i * STAGGER) / SWEEP, 0, 1)
        s = s * s * (3 - 2 * s)                                       # ease in and out
        front = s * (w + (HEAD + 2 * BRISTLES + ROUND) * w + 2)  # how far the stroke's tip has got
        painted = (np.clip(front - along - tip, 0, 1) * inside)[..., None]
        shown = (np.clip(front - HEAD * w - BRISTLES * w - along - tail, 0, 1) * inside)[..., None]
        img = img * (1 - painted) + np.minimum(paint * shade, 255) * painted
        img = img * (1 - shown) + b * shown
    return img


a_path, b_path, out = sys.argv[1:4]
w, h, a_len = probe(a_path)
shapes = stroke_shapes()
start = round((a_len - D) * FPS)    # first frame of the transition
steps = round(D * FPS)
ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{w}x{h}",
                       "-r", str(FPS), "-i", "-", "-i", a_path, "-i", b_path,
                       "-filter_complex", f"[1:a][2:a]acrossfade=d={D}[au]", "-map", "0:v", "-map", "[au]",
                       "-c:v", "libx264", "-crf", "18", "-pix_fmt", "yuv420p", "-c:a", "aac", out], stdin=subprocess.PIPE)
b_frames = frames(b_path)
for i, a in enumerate(frames(a_path)):
    if i >= start:
        a = brush(a, next(b_frames), (i - start + 1) / steps)
    ff.stdin.write(np.clip(a, 0, 255).astype(np.uint8).tobytes())
for b in b_frames:
    ff.stdin.write(b.astype(np.uint8).tobytes())
ff.stdin.close()
if ff.wait():
    sys.exit("ffmpeg failed")

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