---
title: "How to add a squeeze transition with Claude (tested prompt and script)"
description: "Clip A squashes upward into a thin strip at the top of the frame while clip B stretches up from the bottom edge to fill the screen. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/squeeze-transition
---

# How to add a squeeze transition with Claude

Clip A squashes upward into a thin strip at the top of the frame while clip B stretches up from the bottom edge to fill the screen.

Made by the script on this page, from our own test clips.

## Get this effect

1. ### Switch to Code in your [Claude Desktop App](https://claude.com/download)

2. ### Install the skill (once)

   ```
   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 squeeze transition
   Length of the transition in seconds: 0.6
   Output frame rate: 30
   ```

## 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 squeeze transition.

## Settings you can change

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

| Setting | Default | What it does                         |
| ------- | ------- | ------------------------------------ |
| `D`     | `0.6`   | Length of the transition in seconds. |
| `FPS`   | `30`    | Output frame rate.                   |

## Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

```
Join clipA.mp4 and clipB.mp4 with a 0.6 second squeeze transition that starts 0.6 seconds before A ends. On each transition frame, with progress p going from 0 to 1 and eased e = p*p*(3-2p), squash the whole of A's frame (not a crop) into the top (1-e) of the frame height, full width, and squash the whole of B's frame into the remaining bottom e of the height, so at the halfway point A fills the top half and B the bottom half, each squeezed to half height. No gap, border, fade or black between them. Before the transition A plays normally; after it B plays full frame. Crossfade the audio over the same 0.6 seconds. Fit B to A's size first. The output is 11.4 seconds at 30fps, 540x960. Use ffmpeg with Python (numpy and Pillow for the per-frame resizing), keep the audio and save it as output.mp4.
```

## Run it without Claude

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

```
python3 squeeze-transition.py clipA.mp4 clipB.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Squeeze transition: over 0.6s clip A squashes up into a thin strip at the top while clip B stretches up from the bottom to fill the frame.

Usage: python3 squeeze-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 subprocess
import sys
from itertools import islice

import numpy as np
from PIL import Image

D = 0.6    # transition length in seconds
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)

def squeeze(a, b, p):
    """One transition frame at progress p (0-1): A squashed into the top, B stretched into the rest."""
    eased = p * p * (3 - 2 * p)       # smoothstep: starts and ends gently
    split = round(h * (1 - eased))    # rows A keeps; B fills the rest
    img = np.empty_like(a)
    if split:
        img[:split] = np.asarray(Image.fromarray(a).resize((w, split), Image.BICUBIC))
    if split < h:
        img[split:] = np.asarray(Image.fromarray(b).resize((w, h - split), Image.BICUBIC))
    return img

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(squeeze(a, b, i / n).tobytes())
for b in clip_b:
    enc.stdin.write(b.tobytes())
enc.stdin.close()
if enc.wait():
    sys.exit("ffmpeg failed")
```

## More transitions

- [Barn door transition **Barn door transition**](https://www.recharm.com/effects/barn-door)
- [Blinds transition **Blinds transition**](https://www.recharm.com/effects/blinds-transition)
- [Block dissolve **Block dissolve**](https://www.recharm.com/effects/block-dissolve)
- [Blur transition **Blur transition**](https://www.recharm.com/effects/blur-transition)
- [Bounce transition **Bounce transition**](https://www.recharm.com/effects/bounce-transition)

## 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](https://www.recharm.com/get-started)
