Skip to main content
rule CX Codex

get-video-duration — Claude Code rule for video length

The get-video-duration rule shows how to read a video’s duration in seconds with Mediabunny. Use it when code needs the length of a remote or local clip.

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-duration.md
Open on GitHub

What get-video-duration does

The rule uses Input and computeDuration() from mediabunny to calculate a video’s duration. For a video URL, it configures the source with UrlSource and accepts formats through ALL_FORMATS. The result is a duration in seconds.

Local files need a different source: use FileSource instead of UrlSource. The examples target browser, Node.js, and Bun environments. For a file used with Remotion, the rule shows passing a path from staticFile.

Add the rule at .claude/rules/get-video-duration.md. The local-file example takes a File object, so a URL source is not interchangeable with it.

What it helps with

  • read a video’s duration in seconds
  • set up a source for a video URL
  • handle a local clip with FileSource
  • pass a Remotion asset through staticFile

Example prompts for the agent

  • Add a function that reads a video URL’s duration with Mediabunny.
  • Change the local-video example to use FileSource.
  • Use Remotion’s staticFile to get the duration of video.mp4.

How to install get-video-duration

Manually: put the files in place

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

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

Create .claude/rules/get-video-duration.md and add the rule there.

What does get-video-duration do?

It describes how to calculate a video’s duration in seconds with Mediabunny’s computeDuration().

How does the rule handle local video files?

Use FileSource for a local file rather than UrlSource. The example passes a File object as the source.

Similar IDE rules

IDE rules catalog →
linkfox-echotik-get-video-download-url linkfox-ai linkfox-echotik-get-video-download-url — a skill for Claude Code, Codex, and Cursor that parses TikTok URLs into direct download links, preview streams, and covers. It requires an existing video link to trigger extraction. CX Codex +1 232installs downtrend-duration-analyzer tradermonty downtrend-duration-analyzer — a skill for Claude Code and five other platforms that processes historical price data to find peak-to-trough periods and outputs interactive HTML histograms broken down by sector and market cap tier. CX Codex +1 3,400installs duration-prediction datadrivenconstruction The duration-prediction Claude Code skill estimates construction project durations with k-NN and regression, using records from past projects. It runs when an agent is asked to forecast a new project's timeline from comparable work. CX Codex +1 115installs platform-docs-get forcedotcom platform-docs-get pulls official Salesforce documentation and keeps the agent answering from it instead of third-party blogs. Useful when pages are JS-heavy and a plain fetch returns an empty shell. CX Codex +1 6,900installs platform-metadata-api-context-get forcedotcom platform-metadata-api-context-get hands the agent the exact schema for 604 Salesforce Metadata API types so generated -meta.xml files deploy cleanly. CX Codex +1 6,200installs google-mobile-ads-get-started official google The google-mobile-ads-get-started skill guides Google Mobile Ads SDK setup for Android, iOS, or Unity projects. Use it when starting AdMob or Ad Manager integration. CX Codex +1 5,855installs

From the same set33

The whole set →
animations animations directs Claude Code to animate Remotion components with frame hooks instead of broken CSS transitions. CX Codex +1 ★ 849repo stars transcribe-captions The transcribe-captions rule outlines three ways to transcribe audio for Remotion captions: run Whisper.cpp on a server, use WebAssembly in a browser, or call OpenAI Whisper API. CX Codex +1 ★ 849repo stars measuring-dom-nodes The measuring-dom-nodes rule covers measuring DOM element sizes inside Remotion compositions without the video container's scale distorting the numbers. CX Codex +1 ★ 849repo stars trimming Guides Claude Code on Remotion animation trimming patterns, from cutting intro frames to capping duration and combining delays. CX Codex +1 ★ 849repo stars get-audio-duration get-audio-duration — a rule that teaches Claude Code to extract audio file duration in seconds using the Mediabunny library. CX Codex +1 ★ 849repo stars can-decode Checks whether the browser can decode a video or audio stream before attempting playback using Mediabunny. CX Codex +1 ★ 849repo stars assets The assets rule guides Claude Code in adding images, video, audio, and fonts to Remotion projects. Use it when an agent needs to wire media into a composition. CX Codex +1 ★ 849repo stars get-video-dimensions 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. CX Codex +1 ★ 849repo stars

Project sponsors

Companies that keep this analytics open