# Video Loop

> Create a looping background video — crossfade the loop point, encode optimized MP4 + WebM, optional poster frame. Use whenever the user has a video that needs to loop for web use (hero sections, backgrounds, landing-page ambience), wants to fix a visible jump at the loop point, or needs to optimize a clip for web delivery — even if they just say "make this loop smoothly" or "compress this for the…

- **Type:** Skill
- **Install:** `agentstack add skill-coroboros-agent-skills-video-loop`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [coroboros](https://agentstack.voostack.com/s/coroboros)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [coroboros](https://github.com/coroboros)
- **Source:** https://github.com/coroboros/agent-skills/tree/main/skills/video-loop
- **Website:** https://coroboros.com

## Install

```sh
agentstack add skill-coroboros-agent-skills-video-loop
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Video Loop

Create a seamless looping background video from any source clip. A crossfade blends the last and first frames so the `` transition is invisible, then the pipeline encodes web-optimized MP4 + WebM.

All ffmpeg work happens in `scripts/video-loop.sh` — this skill validates inputs, optionally helps pick a good fade duration, invokes the script, and turns the script's summary into a human-readable report.

## Parameters

| Flag | Default | Description |
|------|---------|-------------|
| `-d ` | `1.5` | Crossfade duration in seconds |
| `-q ` | `26` | H.264 CRF — 18 = high quality, 28 = smaller file |
| `-w ` | `32` | VP9 WebM CRF |
| `-o ` | Same as input | Output directory |
| `-p` | off | Also extract a poster frame (first frame as JPEG) |
| `-C` | off | Disable the crossfade — optimize and encode only (`-n` accepted as a deprecated alias) |

> **No `-s/-S` save-mode flag.** Unlike media-cluster siblings (`/audio-loop`, `/markitdown`), video-loop outputs are web assets (MP4 / WebM / poster) the user drops directly into their site's video directory. No downstream skill consumes video files via `-f`, so the `~/.agents/output///` convention would add ceremony without enabling anything — `-o ` is the direct path.

## Workflow

### 1. Validate tools

Confirm `ffmpeg` and `ffprobe` are available: `command -v ffmpeg ffprobe`. If either is missing, stop and ask the user to install (macOS: `! brew install ffmpeg`, Debian/Ubuntu: `! sudo apt install ffmpeg`). Never auto-install.

### 2. Analyze loop quality (optional but recommended)

Before committing to a crossfade, extract the first and last frames and compare them — this is the one step in the pipeline that genuinely benefits from the model's visual reasoning:

```bash
ffmpeg -y -ss 0 -i  -frames:v 1 -update 1 /tmp/vl-first.png
ffmpeg -y -sseof -0.1 -i  -frames:v 1 -update 1 /tmp/vl-last.png
```

Read both frames. If they're nearly identical, suggest `-C` (the source already loops cleanly, crossfade would only blur motion). If they differ significantly, proceed with the default fade or recommend a longer `-d` for more gradual blending.

### 3. Run the pipeline

`$SKILL_DIR` = this skill's folder — `${CLAUDE_SKILL_DIR}` in Claude Code, the directory containing this SKILL.md elsewhere.

```bash
bash "$SKILL_DIR"/scripts/video-loop.sh  [flags]
```

The script does the rest: probes metadata, builds the lossless loop intermediate when crossfade is requested, encodes MP4 (H.264 + faststart) and WebM (VP9), optionally extracts a poster frame. It emits a machine-readable summary on stdout, one `RESULT: key=value` line per fact.

### 4. Report

Parse the `RESULT:` lines to compose:

- A size table comparing input vs outputs (absolute MB and delta percent)
- A ready-to-paste HTML snippet for the user's site

**Report template:**

```
| File | Size | Codec | vs Original |
|------|------|-------|-------------|
| `*-opt.mp4` | X MB | H.264 | -XX% |
| `*.webm` | X MB | VP9 | -XX% |
| `*-poster.jpg` | X KB | JPEG | — |
```

**HTML snippet:**

```html

  
  

```

WebM first — browsers pick the first supported source.

## Why crossfade-first matters

Useful background for debugging "I still see a jump" reports. The script places the xfade at the **start** of the output, not the end:

- `[xfade]` (F seconds): blends `A[end]` → `A[start]`. First frame = `A[D-F]`, last frame = `A[F]`
- `[middle]` (D−2F seconds): untouched frames from `A[F]` to `A[D-F]`

At the loop boundary, `[middle]` ends at `A[D-F]` and the player loops back to `[xfade]`, which starts at the same frame — invisible transition. If the xfade were placed at the end (`[middle][xfade]`), the xfade would end at `A[F]` but loop back to `A[0]` — a visible jump of F seconds.

If the user reports a visible jump despite running the skill, first check whether they pointed at an already-encoded file (re-running re-encodes but doesn't re-loop). If the source is correct, try a longer `-d` — short fades are more visible on high-motion content.

## Rules

- NEVER upscale — the script encodes at source resolution
- NEVER re-encode an already-encoded output (double compression). Always start from the original source
- Audio is always stripped (`-an`) — background videos are muted
- The script rejects `-d >= duration/2` — a too-long fade would leave the middle segment empty
- Always report original vs output sizes so the user sees the quality/size tradeoff

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [coroboros](https://github.com/coroboros)
- **Source:** [coroboros/agent-skills](https://github.com/coroboros/agent-skills)
- **License:** MIT
- **Homepage:** https://coroboros.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-coroboros-agent-skills-video-loop
- Seller: https://agentstack.voostack.com/s/coroboros
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
