# Normalize Clips Before xfade — effect skill for transitions

> **For AI agents:** find the right skill in one call — `curl -s "https://varg.ai/how-to/api/search?q=<what the person wants>"` returns the matching how-to page and the best skills with install commands, as markdown (Russian works too). Full index: https://varg.ai/how-to/llms.txt. Every page has a markdown twin: add `.md` to its path. Before generating anything, show the person the options on the how-to page.

The #1 xfade failure: inputs differ in size, fps or timebase. Normalize every input first.

- **Type:** [Effect](https://varg.ai/how-to/effects.md) · [Transitions](https://varg.ai/how-to/browse/skills/transitions.md)
- **Slug:** `ffmpeg-normalize-before-xfade`
- **Status:** live
- **Publisher:** varg (varg, verified)
- **License:** MIT
- **Source:** https://github.com/vargHQ/skills/blob/main/varg-video-edit-library/references/transitions.md#ffmpeg-normalize-before-xfade
- **Works in:** Claude Code, Claude.ai, Codex, Cursor, OpenClaw, Gemini CLI, Any MCP client, varg Studio
- **Requires:** ffmpeg
- **Cost:** Free — the take renders locally; generated footage, if any, bills by the model

## What it does

No visual change; it makes the filter graph valid.

**When:** Every time clips come from different sources (phone + screen recording + AI video).

**Watch out:** Fixing only fps: `fps=30` alone still leaves a different timebase (1/30 vs 1/15360) and xfade still fails.

**Timing:** Applies before any transition

**Also called:** timebase mismatch, xfade error, do not match, settb AVTB, fps normalize

### In FFmpeg

Errors you will see (reproduced with ffmpeg 8.1):
- `First input link main parameters (size 1280x720) do not match the corresponding second input link xfade parameters (size 1920x1080)`
- `First input link main timebase (1/15360) do not match the corresponding second input link xfade timebase (1/12800)`

Normalize each input (video and audio):
```bash
[i:v]fps=30,scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2,\
setsar=1,format=yuv420p,settb=AVTB,setpts=PTS-STARTPTS[vi];
[i:a]aresample=48000,aformat=channel_layouts=stereo,asetpts=PTS-STARTPTS[ai];
```
Also: variable-frame-rate phone video needs `fps=` first; still images need `-loop 1 -t <dur>` (or `loop`) to become video; clips without audio need `anullsrc` for acrossfade.

### Where this comes from

- [FFmpeg filters: xfade](https://ffmpeg.org/ffmpeg-filters.html#xfade)
- [FFmpeg filters: settb](https://ffmpeg.org/ffmpeg-filters.html#settb_002c-asettb)

## Use when

- Every time clips come from different sources (phone + screen recording + AI video).

## Not for

- Fixing only fps: `fps=30` alone still leaves a different timebase (1/30 vs 1/15360) and xfade still fails.

## Install

- Claude Code: `claude plugin marketplace add vargHQ/skills && claude plugin install varg@varg`
- Codex: `npx skills add vargHQ/skills --skill varg-video-edit-library -a codex -y`
- Cursor: `npx skills add vargHQ/skills --skill varg-video-edit-library -a cursor -y`

## Example output

https://s3.varg.ai/how-to/previews/147026e355ac/take-ffmpeg-normalize-before-xfade.mp4 — dissolve between two shots, with the timeline strip of the edit. Footage: Tears of Steel (2012), (CC) Blender Foundation | mango.blender.org, CC BY 3.0; WING IT! (2023), Blender Studio | studio.blender.org, CC BY 4.0. (credit: Rendered by varg · Tears of Steel (2012) + WING IT! (2023))

## More transitions skills

- [editly](https://varg.ai/how-to/skills/editly.md): Declarative JSON5 video editing CLI/API: clips, titles, transitions, audio mixing, rendered with ffmpeg.
- [Mix (Cross Dissolve)](https://varg.ai/how-to/skills/mix-dissolve.md): The two shots blend through each other. The quietest transition: "time passes" or "this continues".
- [Dip to Black](https://varg.ai/how-to/skills/black-fade.md): A fades to black, then B fades up. Marks the end of a section or a bigger jump in time.
- [White Flash](https://varg.ai/how-to/skills/white-flash.md): The frame blows out to white for a moment and opens on the next shot. Energy, memory or a camera snap.
- [Pull In (Zoom In)](https://varg.ai/how-to/skills/pull-in-zoom.md): The camera rushes into shot A and lands, still moving forward, in shot B. The signature short-form transition.
- [Pull Out (Zoom Out)](https://varg.ai/how-to/skills/pull-out-zoom.md): The camera jerks backwards out of shot A and keeps pulling back as shot B settles in.
