---
title: "How to add a seamless loop with Claude (tested prompt and ffmpeg command)"
description: "In the last second the orbit dissolves back into its own opening frames, so when the 5-second clip repeats, the camera keeps gliding with no jump at the loop point. Install one skill and ask Claude Code, or run the ffmpeg command we tested yourself."
url: https://www.recharm.com/effects/seamless-loop
---

# How to add a seamless loop with Claude

In the last second the orbit dissolves back into its own opening frames, so when the 5-second clip repeats, the camera keeps gliding with no jump at the loop point.

Made by the command on this page, from our own test clip.

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

   ```
   Add a seamless loop to input.mp4
   Seconds over which the end dissolves into the start; the output is this much shorter than the input: 1.0
   ```

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

Add a seamless loop to **@clip1.mp4**, put a sale badge on **@clip2.mp4**, give **@clip3.mp4** a VHS look, then join all three with crossfades.

## 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                                                                                         |
| ------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `BLEND` | `1.0`   | Seconds over which the end dissolves into the start; the output is this much shorter than the input. |

## Without the skill

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

```
Make input.mp4 (540x960, 30fps, 6 seconds) loop seamlessly with ffmpeg. The output is 5 seconds long: output 0-4s is input 1.0-5.0s played normally; over output 4.0-5.0s, input 5.0-6.0s fades out linearly while input 0.0-1.0s fades in over it (a 1-second crossfade, 50/50 at output 4.5s), so the last frame of the output is input 0.97s and leads straight into the first frame, input 1.0s. Crossfade the audio the same way (the input's audio from 1s to the end, with its last second crossfading into the first second of the input's audio). Don't crop, zoom, change colors or add any text. Keep the size, 30fps and audio, encode H.264 yuv420p, and save it as output.mp4.
```

## Run it without Claude

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

```
sh seamless-loop.sh input.mp4 output.mp4
```

```
#!/bin/sh
# Seamless loop: the clip's last second dissolves into its first, so the end flows straight back into the start.
# Usage: sh seamless-loop.sh input.mp4 output.mp4  (the output is BLEND seconds shorter than the input)
set -e
IN="$1"; OUT="$2"
BLEND=1.0   # seconds over which the end dissolves into the start

LEN=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$IN")
FPS=$(ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of csv=p=0 "$IN")
OFFSET=$(awk "BEGIN{print $LEN - 2 * $BLEND}")   # where the dissolve starts in the output
# The output plays the input from BLEND to the end, and over its last BLEND seconds fades into the input's
# first BLEND seconds. Those end on the frame the output opens with, so the last frame leads into the first.
ffmpeg -y -v error -i "$IN" -filter_complex "
  [0:v]fps=$FPS,format=yuv420p,setsar=1,split[v1][v2];
  [v1]trim=start=$BLEND,setpts=PTS-STARTPTS[body];
  [v2]trim=duration=$BLEND,setpts=PTS-STARTPTS[head];
  [body][head]xfade=transition=fade:duration=$BLEND:offset=$OFFSET[v];
  [0:a]asplit[a1][a2];
  [a1]atrim=start=$BLEND,asetpts=PTS-STARTPTS[abody];
  [a2]atrim=duration=$BLEND,asetpts=PTS-STARTPTS[ahead];
  [abody][ahead]acrossfade=d=$BLEND[a]" \
  -map "[v]" -map "[a]" -r "$FPS" -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a aac "$OUT"
```

## More motion and camera

- [2.5D parallax photo **2.5D parallax photo**](https://www.recharm.com/effects/2-5d-parallax-photo)
- [Back-and-forth loop **Back-and-forth loop**](https://www.recharm.com/effects/back-and-forth-loop)
- [Background blur **Background blur**](https://www.recharm.com/effects/background-blur)
- [Bullet time **Bullet time**](https://www.recharm.com/effects/bullet-time)
- [Cinemagraph **Cinemagraph**](https://www.recharm.com/effects/cinemagraph)

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