Skip to main content
rule CX Codex

calculate-metadata — Claude Code rule: setup

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

no license ★ 849 updated 2026-01-24

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/calculate-metadata.md
Open on GitHub

What calculate-metadata 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.

What it helps with

  • 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 for the agent

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

How to install calculate-metadata

Manually: put the files in place

.claude/rules/calculate-metadata.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about calculate-metadata

How do I install calculate-metadata in Claude Code?

Save the Claude Code rule at .claude/rules/calculate-metadata.md.

What does calculate-metadata do?

It guides Remotion to compute composition duration, dimensions, FPS, transformed props, the default output name, and the rendering codec before rendering.

What is required to calculate video duration?

Use getMediaMetadata() from the mediabunny/metadata skill to read video duration and dimensions.

Similar IDE rules

All IDE rules for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set33

The whole set →
3d 3d enforces proper Three.js and React Three Fiber conventions for deterministic video rendering in Remotion. CX Codex +1 ★ 849repo stars parameters Explains how to add video parameterization using Zod schemas in Remotion compositions. Lets users edit parameters visually in the sidebar instead of hardcoding them. CX Codex +1 ★ 849repo stars sequencing sequencing — a rule for managing component timing in Remotion videos. Uses Sequence for delays and Series for sequential playback, with support for nested and overlapping scenes. CX Codex +1 ★ 849repo stars images images directs the AI to embed graphics in Remotion via the Img element, staticFile helper, and dimensions calculation. CX Codex +1 ★ 849repo stars measuring-text measuring-text — a rule to calculate text size, fit fonts to containers, and detect overflow. Use it when building dynamic text in Remotion and need precise dimensions to avoid clipping or wrong scaling. CX Codex +1 ★ 849repo stars fonts Guides Claude Code on loading Google Fonts and local font assets in Remotion video projects without render glitches. CX Codex +1 ★ 849repo stars videos videos — a rule for embedding video in Remotion compositions with trimming, volume control, playback speed, looping and pitch adjustment. Lets you work with video files in animations without repeating boilerplate code. CX Codex +1 ★ 849repo stars display-captions display-captions — a rule that walks through drawing captions in Remotion: grouping them into TikTok-style pages and highlighting whichever word is being spoken. CX Codex +1 ★ 849repo stars

Project sponsors

Companies that keep this analytics open