How to add a bounce transition with Claude

Clip B drops onto clip A from the top of the frame, flattens as it hits the bottom edge and hops up twice, lower each time, before it settles.

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 bounce transition
    Length of the transition in seconds: 0.8
    Seconds clip B takes to fall from above the frame to the bottom: 0.35

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 bounce transition.

Settings you can change

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

SettingDefaultWhat it does
D0.8Length of the transition in seconds.
FALL0.35Seconds clip B takes to fall from above the frame to the bottom.
BOUNCES[0.16, 0.04]Height of each bounce after the landing, as a share of the frame height.
SQUASH0.07How much clip B flattens on the first landing, as a share of its height.
FPS30Output frame rate.

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 0.8 second bounce transition that starts 0.8 seconds before A ends, with A still playing underneath. Clip B drops in over A from above the frame like a ball: over the first 0.35 seconds its bottom edge falls from the top of the frame to the bottom, accelerating (B's raise above its resting place is (1 - (t/0.35)^2) of the frame height). It then bounces up 16% of the frame height and lands again at 0.63 seconds, then bounces up 4% and lands at 0.77 seconds; each bounce is a parabola, so a bounce of height b lasts 2 * 0.35 * sqrt(b) seconds. It rests in place for the last frames. Wherever B doesn't cover the frame, A shows (no black, border or fade). On each landing B squashes against the bottom edge: within 0.06 seconds either side of the impact its height shrinks by up to 7% (on the first landing; 7% * sqrt(b) on later ones) and its width grows by the same share, kept centered and cropped to the frame. Under B's bottom edge, darken A with a soft shadow 3% of the frame height deep, 45% darker right at the edge fading to nothing. After the transition B plays full frame. Crossfade the audio over the same 0.8 seconds. Fit B to A's size first. The output is 11.2 seconds at 30fps, 540x960. Use ffmpeg with Python (numpy and Pillow for the per-frame positioning), keep the audio and save it as output.mp4.

Run it without Claude

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

python3 bounce-transition.py clipA.mp4 clipB.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Bounce transition: clip B drops in from the top over clip A, squashes as it lands and bounces twice before settling.

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

import numpy as np
from PIL import Image

D = 0.8                  # transition length in seconds (B drops, bounces, then rests)
FALL = 0.35              # seconds B takes to fall from above the frame to the bottom
BOUNCES = [0.16, 0.04]   # height of each bounce, as a share of the frame height
SQUASH = 0.07            # how much B flattens on the first landing (share of its height)
SHADOW = 0.03            # depth of the soft shadow B casts on A below its bottom edge (share of the frame height)
FPS = 30                 # output frame rate


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):
    """Decode a clip as w x h RGB frames at FPS, cropping it to fill the frame if its shape differs."""
    ff = subprocess.Popen(["ffmpeg", "-v", "error", "-i", path, "-vf",
                           f"scale={w}:{h}:force_original_aspect_ratio=increase,crop={w}:{h},fps={FPS}",
                           "-f", "rawvideo", "-pix_fmt", "rgb24", "-"], stdout=subprocess.PIPE)
    while True:
        data = ff.stdout.read(w * h * 3)
        if len(data) < w * h * 3:
            return
        yield np.frombuffer(data, np.uint8).reshape(h, w, 3)


# Each landing: (time it hits the bottom, squash there). A bounce of height b lasts 2 * FALL * sqrt(b), like a ball.
LANDINGS = [(FALL, SQUASH)]
for b in BOUNCES:
    LANDINGS.append((LANDINGS[-1][0] + 2 * FALL * math.sqrt(b), SQUASH * math.sqrt(b)))


def lift(t):
    """How far B is above its resting place at t seconds into the transition, as a share of the frame height."""
    if t < FALL:
        return 1 - (t / FALL) ** 2                      # falling, speeding up
    for (start, _), b in zip(LANDINGS, BOUNCES):
        half = FALL * math.sqrt(b)
        if t < start + 2 * half:
            return b * (1 - ((t - start - half) / half) ** 2)   # up and back down
    return 0.0


def squash(t):
    """How flat B is at t: a short dip around each landing, deepest at the moment of impact."""
    return max(amount * max(0.0, 1 - abs(t - at) / 0.06) for at, amount in LANDINGS)


def bounce(a, b, t):
    """One transition frame t seconds in: B over A, raised by lift(t), flattened by squash(t) against the bottom
    and casting a shadow on A."""
    s = squash(t)
    bh, bw = round(h * (1 - s)), round(w * (1 + s))   # flatter and wider, keeping its volume
    img_b = np.asarray(Image.fromarray(b).resize((bw, bh), Image.BICUBIC))[:, (bw - w) // 2:(bw - w) // 2 + w]
    bottom = h - round(h * lift(t))                   # frame row B's bottom edge sits on
    top = bottom - bh
    img = a.astype(np.float32)
    rows = np.arange(bottom, min(bottom + round(h * SHADOW), h))
    img[rows] *= (0.55 + 0.45 * (rows - bottom) / (h * SHADOW))[:, None, None]   # darkest right under B
    img[max(top, 0):bottom] = img_b[max(-top, 0):]
    return img.astype(np.uint8)


A, B, out = sys.argv[1:4]
w, h, length = probe(A)
cut_in = round((length - D) * FPS)   # first frame of the transition
n = round(D * FPS)                   # frames in the transition

enc = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{w}x{h}",
                        "-r", str(FPS), "-i", "-", "-i", A, "-i", B,
                        "-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)
clip_a, clip_b = frames(A), frames(B)
for a in islice(clip_a, cut_in):
    enc.stdin.write(a.tobytes())
for i, (a, b) in enumerate(zip(islice(clip_a, n), islice(clip_b, n))):
    enc.stdin.write(bounce(a, b, i / FPS).tobytes())
for b in clip_b:
    enc.stdin.write(b.tobytes())
enc.stdin.close()
if enc.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