Skip to content

guanyang/open-agent-hub / skills/remotion-multimedia

remotion-multimedia

Verified

Interacting with Mediabunny

FileKindSize
SKILL.mdskill md705 B
agents/openai.yamlconfig317 B
assets/remotion-icon.pngbinary1.3 KB
assets/remotion-icon.svgother1.3 KB
get-audio-duration.mdmarkdown1.5 KB
get-video-dimensions.mdmarkdown1.8 KB
get-video-duration.mdmarkdown1.4 KB

get-video-duration.md

View on GitHub
---
name: get-video-duration
description: Getting the duration of a video file in seconds with Mediabunny
metadata:
  tags: duration, video, length, time, seconds
---

# Getting video duration with Mediabunny

Mediabunny can extract the duration of a video file. It works in browser, Node.js, and Bun environments.

## Getting video duration

```tsx
import { Input, ALL_FORMATS, UrlSource } from "mediabunny";

export const getVideoDuration = async (src: string) => {
  const input = new Input({
    formats: ALL_FORMATS,
    source: new UrlSource(src),
  });

  const durationInSeconds = await input.computeDuration();
  return durationInSeconds;
};
```

## Usage

```tsx
const duration = await getVideoDuration("https://remotion.media/video.mp4");
console.log(duration); // e.g. 10.5 (seconds)
```

## Video files from the public/ directory

Make sure to wrap the file path in `staticFile()`:

```tsx
import { staticFile } from "remotion";

const duration = await getVideoDuration(staticFile("video.mp4"));
```

## In Node.js and Bun

Use `FilePathSource` instead of `UrlSource` to read a file from disk:

```tsx
import { Input, ALL_FORMATS, FilePathSource } from "mediabunny";

const input = new Input({
  formats: ALL_FORMATS,
  source: new FilePathSource("video.mp4"),
});

const durationInSeconds = await input.computeDuration();
input.dispose(); // Closes the file handle
```

For a `File` from a file input or drag and drop, use `new BlobSource(file)` instead.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall