How to add a page curl with Claude

Clip A's bottom-right corner lifts and rolls up toward the top left like a turning page, its off-white back folding over the picture while clip B shows underneath in the curl's shadow.

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 page curl
    Length of the transition in seconds: 1.0
    Tilt of the curl's path: 0 rolls straight right to left, 90 bottom to top: 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 page curl.

Settings you can change

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

SettingDefaultWhat it does
D1.0Length of the transition in seconds.
ANGLE35Tilt of the curl's path: 0 rolls straight right to left, 90 bottom to top.
RADIUS0.10Radius of the rolled paper, as a share of the frame height.
PAPER(246, 243, 236)Color of the page's back.
SHOW_THROUGH0.12How much of the picture shows through the page's back (0-1).
SHADOW0.5Darkness of the shadow the curl casts on clip B (0-1).

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 second page curl transition that starts 1 second before A ends, so the result is A's length plus B's length minus 1 second (11 seconds here). Treat A's frame as a sheet of paper lying on top of B and roll it round a cylinder with a radius of 10% of the frame height. The fold line is perpendicular to a direction 35 degrees down from horizontal (pointing at the bottom-right corner) and sweeps, with a sine ease-in-out, from the bottom-right corner until the roll has passed the top-left corner, so the bottom-right corner lifts first and the page leaves at the top left. Where the paper has gone round the roll it lies face down on top of the rest of A: draw that back side as off-white paper (246, 243, 236) mixed with 12% of the picture, darkened to 80% where the roll meets it. The underside of the roll shows A's picture, darkened toward 55% as it turns away. Clip B plays underneath from its first frame, darkened by up to 50% in a soft shadow just past the roll that fades over a quarter of the roll's radius. Match B's size and frame rate (30fps) to A. Crossfade the audio over the same 1 second. Use Python with numpy and OpenCV (cv2.remap) for the warp and ffmpeg to read and write the video (draw anything with Pillow, not ffmpeg's drawtext), keep the audio and save it as output.mp4.

Run it without Claude

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

python3 page-curl.py clipA.mp4 clipB.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Page curl: clip A's bottom-right corner lifts and rolls up toward the top left like a turning page, showing clip B underneath.

Usage: python3 page-curl.py clipA.mp4 clipB.mp4 output.mp4  (both clips need an audio track)
Needs ffmpeg, OpenCV and numpy (pip install opencv-python-headless numpy).
"""
import json
import math
import subprocess
import sys
from itertools import islice

import cv2
import numpy as np

D = 1.0                       # transition length in seconds
FPS = 30                      # output frame rate
ANGLE = 35                    # tilt of the curl's path: 0 rolls straight right to left, 90 bottom to top
RADIUS = 0.10                 # radius of the rolled paper, as a share of the frame height
PAPER = (246, 243, 236)       # color of the page's back
SHOW_THROUGH = 0.12           # how much of the picture shows through the page's back (0-1)
SHADOW = 0.5                  # darkness of the shadow the curl casts on clip B (0-1)


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)


def ease(p):
    """Gentle start and finish (sine ease-in-out)."""
    return 0.5 - 0.5 * math.cos(math.pi * p)


def page_at(dist):
    """Where on page A each screen pixel's paper comes from, `dist` pixels further along the curl direction,
    and whether that spot is still on the page."""
    x, y = xs + nx * dist, ys + ny * dist
    return x.astype(np.float32), y.astype(np.float32), (x >= 0) & (x <= w - 1) & (y >= 0) & (y <= h - 1)


def curl(a, b, p):
    """One transition frame at progress p (0-1). The page wraps round a cylinder whose fold line sweeps from the
    bottom-right corner to past the top-left one; the paper that has gone round lies face down on top."""
    r = RADIUS * h
    fold = u_max - (u_max - u_min + r) * ease(p)
    u = xs * nx + ys * ny - fold                         # screen distance past the fold line
    on_roll = (u >= 0) & (u <= r)
    theta = np.arcsin(np.clip(u / r, 0, 1))

    # paper, back side up: the near-side of the roll (angle pi - theta) and the flat part laid over the page
    back_dist = np.where(u < 0, math.pi * r - 2 * u, r * (math.pi - theta) - u)
    bx, by, back_ok = page_at(back_dist)
    back_ok &= (u < 0) | on_roll
    # paper, picture side up: the underside of the roll (angle theta), seen past its edge
    fx, fy, front_ok = page_at(r * theta - u)
    front_ok &= on_roll & ~back_ok

    out = b.astype(np.float32)
    out *= (1 - SHADOW * np.exp(-np.clip(u - r, 0, None) / (0.25 * r)) * (u > -1e-3))[..., None]  # shadow past the roll
    flat = (u < 0) & ~back_ok
    out[flat] = a[flat]

    front = cv2.remap(a, fx, fy, cv2.INTER_LINEAR).astype(np.float32)
    front *= (0.55 + 0.45 * np.cos(theta))[..., None]   # the roll darkens as it turns away from the light
    out[front_ok] = front[front_ok]

    seen = cv2.remap(a, bx, by, cv2.INTER_LINEAR).astype(np.float32)
    back = (1 - SHOW_THROUGH) * np.array(PAPER, np.float32) + SHOW_THROUGH * seen
    light = np.where(on_roll, 0.8 + 0.2 * np.sin(theta), 1.0)        # soft crease where the roll meets the top
    back *= light[..., None]
    out[back_ok] = back[back_ok]
    return np.clip(out, 0, 255).astype(np.uint8)


A, B, out = sys.argv[1:4]
w, h, length = probe(A)
a = math.radians(ANGLE)
nx, ny = math.cos(a), math.sin(a)      # unit vector toward the bottom-right corner, where the curl starts
ys, xs = np.mgrid[0:h, 0:w].astype(np.float32)
u_all = xs * nx + ys * ny
u_min, u_max = float(u_all.min()), float(u_all.max())
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 f in islice(clip_a, cut_in):
    enc.stdin.write(f.tobytes())
for i, (fa, fb) in enumerate(zip(islice(clip_a, n), islice(clip_b, n))):
    enc.stdin.write(curl(fa, fb, (i + 0.5) / n).tobytes())
for f in clip_b:
    enc.stdin.write(f.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