Skip to main content
rule CX Codex

get-video-dimensions — Claude Code rule: video width and height

get-video-dimensions — a Claude rule that hands the agent working Mediabunny code for reading a video's width and height, whether the file sits behind a URL, on disk, or in Remotion.

no license ★ 849 updated 2026-01-24

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

What get-video-dimensions does

Add this rule to a project and the model gets a ready snippet instead of guessing at the Mediabunny API. It creates an Input over ALL_FORMATS, fetches the primary video track, and returns displayWidth along with displayHeight. A file with no video track throws an error, which is how the guard on bad input works.

Three paths are covered: a remote URL through UrlSource, a local File through FileSource (the object you get from an input or a drop), and Remotion's staticFile. Mediabunny runs in the browser, in Node.js and in Bun, so the same helper serves either side.

UrlSource cannot read something from disk, so use the FileSource variant there. Every snippet imports from mediabunny, meaning the package belongs in your dependencies; the rule itself only supplies code.

What it helps with

  • read a clip's width and height before building the player layout
  • check the resolution of a remote video in the browser
  • feed real dimensions into a Remotion composition
  • reject an upload that carries no video track
  • measure a file dropped into the page

Example prompts for the agent

  • Write a helper that returns the width and height of a video URL, following the get-video-dimensions rule
  • Use the FileSource snippet from get-video-dimensions for a file from drag-and-drop
  • Get the dimensions of staticFile("video.mp4") in my Remotion component with the get-video-dimensions rule

How to install get-video-dimensions

Manually: put the files in place

.claude/rules/get-video-dimensions.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 get-video-dimensions

How do I install get-video-dimensions in Claude Code?

Copy the rule file into the project at .claude/rules/get-video-dimensions.md.

What does get-video-dimensions do?

It gives the agent Mediabunny code that reads the primary video track and returns displayWidth and displayHeight.

What has to be in place before the snippets work?

The mediabunny package installed in the project, since the imports come from it. The Remotion example also pulls staticFile from remotion.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set33

The whole set →

Project sponsors

Companies that keep this analytics open