guanyang/open-agent-hub / skills/remotion-multimedia
remotion-multimedia
VerifiedInteracting with Mediabunny
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 705 B |
| agents/openai.yaml | config | 317 B |
| assets/remotion-icon.png | binary | 1.3 KB |
| assets/remotion-icon.svg | other | 1.3 KB |
| get-audio-duration.md | markdown | 1.5 KB |
| get-video-dimensions.md | markdown | 1.8 KB |
| get-video-duration.md | markdown | 1.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.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |