How to add a spin transition with Claude

Clip A whips round clockwise in a motion-blurred full turn, flipping to clip B halfway, and lands upright on B.

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 spin transition
    Length of the transition in seconds: 0.6
    Degrees the frame turns, clockwise; clip B takes over halfway round: 360

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 spin 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.6Length of the transition in seconds.
TURN360Degrees the frame turns, clockwise; clip B takes over halfway round.
BLUR24Motion-blur samples per frame (more is smoother and slower).
SHUTTER1.0How far the motion blur spreads, as a share of one frame's turn.

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.6 second spin transition, overlapping the clips by 0.6 seconds (the output is 11.4 seconds). Over the last 0.6 seconds of A, turn the frame a full 360 degrees clockwise about its center with a cubic ease-in-out (slow start, fast middle, slow landing): the first half of the turn shows A, the second half shows the first 0.6 seconds of B, so B lands upright at the end. At each angle, scale the frame up just enough that no corner of the frame shows (scale = max(|cos a| + |sin a| * height/width, |cos a| + |sin a| * width/height)). Add motion blur by averaging 24 evenly spaced moments across each frame's turn. Before the transition the output is A untouched, after it B carries on from 0.6 seconds in. Crossfade the audio over the same 0.6 seconds. Match B's size and frame rate to A, use Python with Pillow and numpy for the frames and ffmpeg for the rest, and save it as output.mp4 (H.264, yuv420p, 30fps).

Run it without Claude

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

python3 spin-transition.py clipA.mp4 clipB.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Spin transition: clip A whips round a full turn with motion blur, swapping to clip B halfway, over 0.6s.

Usage: python3 spin-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 math
import subprocess
import sys

import numpy as np
from PIL import Image

D = 0.6          # transition length in seconds
TURN = 360       # degrees the frame turns, clockwise; B takes over halfway round
BLUR = 24        # motion-blur samples per frame (more is smoother and slower)
SHUTTER = 1.0    # motion blur spread, as a share of one frame's turn


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 frames(path, start):
    """The transition's frames from path, starting at `start` seconds, fitted to A's size and frame rate."""
    raw = subprocess.check_output(["ffmpeg", "-v", "error", "-ss", f"{start:.3f}", "-i", path, "-frames:v", str(n),
                                   "-vf", f"scale={w}:{h}:force_original_aspect_ratio=increase,crop={w}:{h},fps={rate}",
                                   "-f", "rawvideo", "-pix_fmt", "rgb24", "-"])
    return [Image.frombuffer("RGB", (w, h), raw[i * w * h * 3:(i + 1) * w * h * 3]) for i in range(n)]


def ease(p):
    """Slow start, fast middle, slow landing (cubic ease-in-out)."""
    return 4 * p ** 3 if p < 0.5 else 1 - (-2 * p + 2) ** 3 / 2


def spun(img, degrees):
    """img turned about its center and scaled up just enough that no corner of the frame ever shows."""
    a = math.radians(degrees)
    c, s = abs(math.cos(a)), abs(math.sin(a))
    scale = max(c + s * h / w, c + s * w / h)
    cos, sin = math.cos(a) / scale, math.sin(a) / scale
    # maps each output pixel back to the source pixel it shows
    return img.transform((w, h), Image.AFFINE, (cos, sin, w / 2 - cos * w / 2 - sin * h / 2,
                                                -sin, cos, h / 2 + sin * w / 2 - cos * h / 2), Image.BILINEAR)


def spin_frame(i):
    """Frame i of the transition: the average of BLUR moments across its shutter, which smears the turn."""
    acc = np.zeros((h, w, 3), np.float32)
    for k in range(BLUR):
        p = min(max((i + SHUTTER * (k / (BLUR - 1) - 0.5)) / (n - 1), 0), 1)
        acc += np.asarray(spun(a_frames[i] if p < 0.5 else b_frames[i], TURN * ease(p)), np.float32)
    return (acc / BLUR).astype(np.uint8)


a_path, b_path, out = sys.argv[1:4]
w, h, rate, fps, a_len = probe(a_path)
n = round(D * fps)
offset = a_len - D
a_frames, b_frames = frames(a_path, offset), frames(b_path, 0)

# A up to the transition, the spun frames, then B from where the transition ends; the sound crossfades over D
ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", a_path, "-i", b_path,
                       "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                       "-filter_complex",
                       f"[0:v]trim=end={offset:.4f},setpts=PTS-STARTPTS,fps={rate},format=yuv420p,setsar=1[a];"
                       f"[1:v]scale={w}:{h}:force_original_aspect_ratio=increase,crop={w}:{h},fps={rate},"
                       f"trim=start={D},setpts=PTS-STARTPTS,format=yuv420p,setsar=1[b];"
                       f"[2:v]format=yuv420p,setsar=1[s];"
                       f"[a][s][b]concat=n=3:v=1:a=0[v];[0:a][1:a]acrossfade=d={D}[au]",
                       "-map", "[v]", "-map", "[au]", "-c:v", "libx264", "-crf", "18", "-pix_fmt", "yuv420p",
                       "-c:a", "aac", out], stdin=subprocess.PIPE)
for i in range(n):
    ff.stdin.write(spin_frame(i).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