Skip to content

🎥 Make videos programmatically with React

Skills: Fix examples that import missing exports

Jillur Rahmanb06fba022462
diff --git a/packages/skills/skills/remotion-markup/effects.md b/packages/skills/skills/remotion-markup/effects.md
index 9b41109203..b8eeefacdd 100644
--- a/packages/skills/skills/remotion-markup/effects.md
+++ b/packages/skills/skills/remotion-markup/effects.md
@@ -47,7 +47,8 @@ Config.setChromiumOpenGlRenderer('angle');
Example:
```tsx
-import {brightness} from "@remotion/effects";
+import {Video} from '@remotion/media';
+import {brightness} from '@remotion/effects/brightness';
<Video
src="https://remotion.media/video.mp4"
diff --git a/packages/skills/skills/remotion-markup/images.md b/packages/skills/skills/remotion-markup/images.md
index b86985fca1..ad9ec1a35a 100644
--- a/packages/skills/skills/remotion-markup/images.md
+++ b/packages/skills/skills/remotion-markup/images.md
@@ -46,10 +46,11 @@ This pattern is useful for:
## Getting image dimensions
-Use `getImageDimensions()` to get the dimensions of an image:
+Use `getImageDimensions()` from `@remotion/media-utils` to get the dimensions of an image:
```tsx
-import { getImageDimensions, staticFile } from "remotion";
+import { getImageDimensions } from "@remotion/media-utils";
+import { staticFile } from "remotion";
const { width, height } = await getImageDimensions(staticFile("photo.png"));
```
@@ -57,11 +58,8 @@ const { width, height } = await getImageDimensions(staticFile("photo.png"));
This is useful for calculating aspect ratios or sizing compositions:
```tsx
-import {
- getImageDimensions,
- staticFile,
- CalculateMetadataFunction,
-} from "remotion";
+import { getImageDimensions } from "@remotion/media-utils";
+import { staticFile, CalculateMetadataFunction } from "remotion";
const calculateMetadata: CalculateMetadataFunction = async () => {
const { width, height } = await getImageDimensions(staticFile("photo.png"));
diff --git a/packages/skills/skills/remotion-markup/sfx.md b/packages/skills/skills/remotion-markup/sfx.md
index ba2dd83b11..c46d46c71f 100644
--- a/packages/skills/skills/remotion-markup/sfx.md
+++ b/packages/skills/skills/remotion-markup/sfx.md
@@ -8,7 +8,7 @@ metadata:
To include a sound effect, use the `<Audio>` tag:
```tsx
-import { Audio } from "@remotion/sfx";
+import { Audio } from "@remotion/media";
<Audio src={"https://remotion.media/whoosh.wav"} />;
```
diff --git a/packages/skills/skills/remotion-multimedia/get-audio-duration.md b/packages/skills/skills/remotion-multimedia/get-audio-duration.md
index e2336c7d00..1678eb3c70 100644
--- a/packages/skills/skills/remotion-multimedia/get-audio-duration.md
+++ b/packages/skills/skills/remotion-multimedia/get-audio-duration.md
@@ -44,13 +44,18 @@ const duration = await getAudioDuration(staticFile("audio.mp3"));
## In Node.js and Bun
-Use `FileSource` instead of `UrlSource`:
+Use `FilePathSource` instead of `UrlSource` to read a file from disk:
```tsx
-import { Input, ALL_FORMATS, FileSource } from "mediabunny";
+import { Input, ALL_FORMATS, FilePathSource } from "mediabunny";
const input = new Input({
formats: ALL_FORMATS,
- source: new FileSource(file), // File object from input or drag-drop
+ source: new FilePathSource("audio.mp3"),
});
+
+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.
diff --git a/packages/skills/skills/remotion-multimedia/get-video-dimensions.md b/packages/skills/skills/remotion-multimedia/get-video-dimensions.md
index e73014e72e..8071a2bbac 100644
--- a/packages/skills/skills/remotion-multimedia/get-video-dimensions.md
+++ b/packages/skills/skills/remotion-multimedia/get-video-dimensions.md
@@ -42,21 +42,27 @@ console.log(dimensions.height); // e.g. 1080
## Using with local files
-For local files, use `FileSource` instead of `UrlSource`:
+For a `File` from a file input or drag and drop, use `BlobSource` instead of `UrlSource`:
```tsx
-import { Input, ALL_FORMATS, FileSource } from "mediabunny";
+import { Input, ALL_FORMATS, BlobSource } from "mediabunny";
const input = new Input({
formats: ALL_FORMATS,
- source: new FileSource(file), // File object from input or drag-drop
+ source: new BlobSource(file), // File object from input or drag-drop
});
const videoTrack = await input.getPrimaryVideoTrack();
+if (!videoTrack) {
+ throw new Error("No video track found");
+}
+
const width = videoTrack.displayWidth;
const height = videoTrack.displayHeight;
```
+In Node.js and Bun, use `new FilePathSource(path)` to read a file from disk, and call `input.dispose()` when done.
+
## Using with staticFile in Remotion
```tsx
diff --git a/packages/skills/skills/remotion-multimedia/get-video-duration.md b/packages/skills/skills/remotion-multimedia/get-video-duration.md
index 9fd125fb34..55bbb8635e 100644
--- a/packages/skills/skills/remotion-multimedia/get-video-duration.md
+++ b/packages/skills/skills/remotion-multimedia/get-video-duration.md
@@ -44,15 +44,18 @@ const duration = await getVideoDuration(staticFile("video.mp4"));
## In Node.js and Bun
-Use `FileSource` instead of `UrlSource`:
+Use `FilePathSource` instead of `UrlSource` to read a file from disk:
```tsx
-import { Input, ALL_FORMATS, FileSource } from "mediabunny";
+import { Input, ALL_FORMATS, FilePathSource } from "mediabunny";
const input = new Input({
formats: ALL_FORMATS,
- source: new FileSource(file), // File object from input or drag-drop
+ 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.