# calculate-metadata

The calculate-metadata rule configures Remotion composition metadata before rendering, including duration, dimensions, FPS, props, and the output filename.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 849 repo stars
- Author: coleam00
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/coleam00/second-brain-skills/tree/HEAD/.claude/skills/remotion/rules/calculate-metadata.md
- Updated: 2026-01-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/calculate-metadata

## What it does

The rule shows how to attach `calculateMetadata` to a Remotion `<Composition>`. The callback receives the current `props` and can return frame duration, width, height, FPS, transformed props, a default output name, and a rendering codec.

It uses `getMediaMetadata()` from the `mediabunny/metadata` skill to read video duration and dimensions. The examples cover adding several video lengths, matching the composition to source dimensions, fetching data from `dataUrl`, and passing an `abortSignal` so stale Studio requests can be cancelled.

The video-duration and dimension examples depend on `getMediaMetadata()` from `mediabunny/metadata`; without that function, those calculations cannot run.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/calculate-metadata.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/calculate-metadata.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/calculate-metadata.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/calculate-metadata.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/calculate-metadata.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/coleam00/second-brain-skills/tree/HEAD/.claude/skills/remotion/rules/calculate-metadata.md

## When to use it
- calculate composition length from a video
- match the canvas size to source media
- combine the lengths of several videos
- fetch data before rendering
- derive an output filename from props

## Example prompts
- Configure `calculateMetadata` for a composition whose duration comes from the metadata of `videoSrc`.
- For `props.videos`, calculate the combined length of all sources and return it as frames.
- Fetch JSON from `dataUrl` with `abortSignal`, then pass the result into the component props before rendering.

## Similar
- [fixing-metadata](https://affpapa.org/en/nevibecode/skills/fixing-metadata.md) — skill · 20200 installs
- [asc-metadata-sync](https://affpapa.org/en/nevibecode/skills/asc-metadata-sync.md) — skill · 8300 installs
- [platform-metadata-deploy](https://affpapa.org/en/nevibecode/skills/platform-metadata-deploy.md) — skill · 7100 installs
- [platform-metadata-retrieve](https://affpapa.org/en/nevibecode/skills/platform-metadata-retrieve.md) — skill · 7000 installs
- [metadata-optimization](https://affpapa.org/en/nevibecode/skills/metadata-optimization.md) — skill · 3900 installs
- [dicom-metadata-extract](https://affpapa.org/en/nevibecode/skills/dicom-metadata-extract.md) — skill · 1900 installs

From the same set: [coleam00/second-brain-skills](https://affpapa.org/en/nevibecode/by/coleam00/second-brain-skills.md) — 33 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
