---
title: "How to add a zig-zag wipe with Claude (tested prompt and ffmpeg command)"
description: "A row of six saw teeth points into clip A and sweeps it off to the right, with clip B filling in behind the jagged edge. Install one skill and ask Claude Code, or run the ffmpeg command we tested yourself."
url: https://www.recharm.com/effects/zigzag-wipe
---

# How to add a zig-zag wipe with Claude

A row of six saw teeth points into clip A and sweeps it off to the right, with clip B filling in behind the jagged edge.

Made by the command 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 zig-zag wipe
   Length of the transition in seconds: 0.8
   Number of teeth down the height of the frame: 6
   ```

## 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 zig-zag wipe.

## Settings you can change

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

| Setting | Default | What it does                                                                  |
| ------- | ------- | ----------------------------------------------------------------------------- |
| `D`     | `0.8`   | Length of the transition in seconds.                                          |
| `TEETH` | `6`     | Number of teeth down the height of the frame.                                 |
| `DEPTH` | `0.25`  | How far each tooth points ahead of the edge, as a share of the frame's width. |

## Without the skill

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

```
Join clipA.mp4 and clipB.mp4 with a 0.8 second zig-zag wipe that starts 0.8 seconds before A ends. Clip B is revealed behind a saw-tooth edge that moves from the left side to the right side. The edge has 6 teeth down the height of the frame, with a tooth tip at the very top and bottom and every 1/6 of the height in between; each tip points right, 25% of the frame's width ahead of the notches. At the start the tips sit on the left edge; at the end the notches reach the right edge. Ease the movement out: progress = 1 - (1 - t/0.8)^2. Soften the edge over one pixel so the slanted sides aren't jagged. Crossfade the audio over the same 0.8 seconds. Match B's size and frame rate to A. Use ffmpeg (xfade with a custom expression works) and save it as output.mp4.
```

## Run it without Claude

This is the exact command we tested. Save it as `zigzag-wipe.sh` and run:

```
sh zigzag-wipe.sh clipA.mp4 clipB.mp4 output.mp4
```

```
#!/bin/sh
# Zig-zag wipe: a saw-tooth edge sweeps left to right over 0.8s, swapping clip A for clip B. The sound crossfades underneath.
# Usage: sh zigzag-wipe.sh clipA.mp4 clipB.mp4 output.mp4  (both clips need an audio track)
set -e
A="$1"; B="$2"; OUT="$3"
D=0.8       # transition length in seconds
TEETH=6     # teeth down the height of the frame
DEPTH=0.25  # how far each tooth points ahead of the edge, as a share of the frame's width

LEN=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$A")
OFFSET=$(echo "$LEN - $D" | bc)
SIZE=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "$A")
FPS=$(ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of csv=p=0 "$A")
W=${SIZE%x*}; H=${SIZE#*x}
# xfade's P runs from 1 to 0, so 1-P*P is the progress, easing out. The edge's x position is a
# triangle wave down the frame: tips (B furthest ahead) at the top, bottom and every H/TEETH between.
# It starts with the tips at the left edge and ends with the notches at the right one. Pixels within
# half a pixel of the edge mix A and B, which keeps the slanted sides smooth.
TOOTH="abs(2*mod(Y*$TEETH/H,1)-1)"
EDGE="((1-P*P)*(1+$DEPTH)-$DEPTH+$DEPTH*$TOOTH)*W"
ZIGZAG="A+(B-A)*clip($EDGE-X+0.5,0,1)"
# xfade needs both clips at the same size and frame rate, so B is fitted to A first
ffmpeg -y -i "$A" -i "$B" -filter_complex "\
[0:v]fps=$FPS,format=yuv420p,setsar=1[a];\
[1:v]scale=$W:$H:force_original_aspect_ratio=increase,crop=$W:$H,fps=$FPS,format=yuv420p,setsar=1[b];\
[a][b]xfade=transition=custom:expr='$ZIGZAG':duration=$D:offset=$OFFSET[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"
```

## 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)
