🎥 Make videos programmatically with React
refactor skills
JonnyBurger8a73325e232d
diff --git a/packages/skills/skills/remotion/SKILL.md b/packages/skills/skills/remotion/SKILL.mdindex 84679e2711..66c3ca7eba 100644--- a/packages/skills/skills/remotion/SKILL.md+++ b/packages/skills/skills/remotion/SKILL.md@@ -19,6 +19,178 @@ npx create-video@latest --yes --blank --no-tailwind my-videoReplace `my-video` with a suitable project name.+## Designing a video++Animate properties using `useCurrentFrame()` and `interpolate()`. Use Easing to customize the timing of the animation.++```tsx+import { useCurrentFrame, Easing } from "remotion";++export const FadeIn = () => {+ const frame = useCurrentFrame();+ const { fps } = useVideoConfig();++ const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {+ extrapolateRight: "clamp",+ extrapolateLeft: "clamp",+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return <div style={{ opacity }}>Hello World!</div>;+};+```++CSS transitions or animations are FORBIDDEN - they will not render correctly.+Tailwind animation class names are FORBIDDEN - they will not render correctly.++Place assets in the `public/` folder at your project root.++Use `staticFile()` to reference files from the `public/` folder.++Add images using the `<Img>` component:++```tsx+import { Img, staticFile } from "remotion";++export const MyComposition = () => {+ return <Img src={staticFile("logo.png")} style={{ width: 100, height: 100 }} />;+};+```++Add videos using the `<Video>` component from `@remotion/media`:++```tsx+import { Video } from "@remotion/media";+import { staticFile } from "remotion";++export const MyComposition = () => {+ return <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />;+};+```++Add audio using the `<Audio>` component from `@remotion/media`:++```tsx+import { Audio } from "@remotion/media";+import { staticFile } from "remotion";++export const MyComposition = () => {+ return <Audio src={staticFile("audio.mp3")} />;+};+```++Assets can be also referenced as remote URLs:++```tsx+import { Video } from "@remotion/media";++export const MyComposition = () => {+ return <Video src="https://remotion.media/video.mp4" />+};+```++To delay content wrap it in `<Sequence>` and use `from`.+To limit the duration of an element, use `durationInFrames` of `<Sequence>`.+`<Sequence>` by default is an absolute fill. For inline content, use `layout="none"`.++```tsx+import { Sequence } from "remotion";++export const Title = () => {+ const frame = useCurrentFrame();+ const { fps } = useVideoConfig();++ const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {+ extrapolateRight: "clamp",+ extrapolateLeft: "clamp",+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return <div style={{ opacity }}>Title</div>;+};++export const Subtitle = () => {+ return <div>Subtitle</div>;+};++const Main = () => {+ const {fps} = useVideoConfig();++ return (+ <AbsoluteFill>+ <Sequence>+ <Background />+ </Sequence>+ <Sequence from={1 * fps} durationInFrames={2 * fps} layout="none">+ <Title />+ </Sequence>+ <Sequence from={2 * fps} durationInFrames={2 * fps} layout="none">+ <Subtitle />+ </Sequence>+ </AbsoluteFill>+ );+}+```++The width, height, fps, and duration of a video is defined in `src/Root.tsx`:++```tsx+import { Composition } from "remotion";+import { MyComposition } from "./MyComposition";++export const RemotionRoot = () => {+ return (+ <Composition+ id="MyComposition"+ component={MyComposition}+ durationInFrames={100}+ fps={30}+ width={1080}+ height={1080}+ />+ );+};+```++Metadata can also be calculated dynamically:++```tsx+import { Composition, CalculateMetadataFunction } from "remotion";+import { MyComposition, MyCompositionProps } from "./MyComposition";++const calculateMetadata: CalculateMetadataFunction<+ MyCompositionProps+> = async ({ props, abortSignal }) => {+ const data = await fetch(`https://api.example.com/video/${props.videoId}`, {+ signal: abortSignal,+ }).then((res) => res.json());++ return {+ durationInFrames: Math.ceil(data.duration * 30),+ props: {+ ...props,+ videoUrl: data.url,+ },+ width: 1080,+ height: 1080,+ };+};++export const RemotionRoot = () => {+ return (+ <Composition+ id="MyComposition"+ component={MyComposition}+ fps={30}+ width={1080}+ height={1080}+ defaultProps={{ videoId: "abc123" }}+ calculateMetadata={calculateMetadata}+ />+ );+};+```+## Starting previewStart the Remotion Studio to preview a video:@@ -58,24 +230,44 @@ When needing to visualize audio (spectrum bars, waveforms, bass-reactive effectsWhen needing to use sound effects, load the [./rules/sfx.md](./rules/sfx.md) file for more information.-## How to use+## 3D content++See [rules/3d.md](rules/3d.md) for 3D content in Remotion using Three.js and React Three Fiber.++## Advanced audio++See [rules/audio.md](rules/audio.md) for advanced audio features like trimming, volume, speed, pitch.++## Dynamic duration, dimensions and data++See [rules/calculate-metadata.md](rules/calculate-metadata.md) for dynamically set composition duration, dimensions, and props.++## Advanced compositions++See [rules/compositions.md](rules/compositions.md) for how to define stills, folders, default props and for how to nest compositions.++## Google Fonts++Is the recommended way to load fonts in Remotion. See [rules/google-fonts.md](rules/google-fonts.md) for how to load Google Fonts.++## Local fonts++See [rules/local-fonts.md](rules/local-fonts.md) for how to load local fonts.++## Getting video and audio metadata++See:-Read individual rule files for detailed explanations and code examples:--- [rules/3d.md](rules/3d.md) - 3D content in Remotion using Three.js and React Three Fiber-- [rules/animations.md](rules/animations.md) - Fundamental animation skills for Remotion-- [rules/assets.md](rules/assets.md) - Importing images, videos, audio, and fonts into Remotion-- [rules/audio.md](rules/audio.md) - Using audio and sound in Remotion - importing, trimming, volume, speed, pitch-- [rules/calculate-metadata.md](rules/calculate-metadata.md) - Dynamically set composition duration, dimensions, and props-- [rules/can-decode.md](rules/can-decode.md) - Check if a video can be decoded by the browser using Mediabunny-- [rules/charts.md](rules/charts.md) - Chart and data visualization patterns for Remotion (bar, pie, line, stock charts)-- [rules/compositions.md](rules/compositions.md) - Defining compositions, stills, folders, default props and dynamic metadata-- [rules/extract-frames.md](rules/extract-frames.md) - Extract frames from videos at specific timestamps using Mediabunny-- [rules/fonts.md](rules/fonts.md) - Loading Google Fonts and local fonts in Remotion- [rules/get-audio-duration.md](rules/get-audio-duration.md) - Getting the duration of an audio file in seconds with Mediabunny- [rules/get-video-dimensions.md](rules/get-video-dimensions.md) - Getting the width and height of a video file with Mediabunny- [rules/get-video-duration.md](rules/get-video-duration.md) - Getting the duration of a video file in seconds with Mediabunny-- [rules/gifs.md](rules/gifs.md) - Displaying GIFs synchronized with Remotion's timeline++## GIFs++See [rules/gifs.md](rules/gifs.md) for how to display GIFs synchronized with Remotion's timeline.++## How to use+- [rules/images.md](rules/images.md) - Embedding images in Remotion using the Img component- [rules/light-leaks.md](rules/light-leaks.md) - Light leak overlay effects using @remotion/light-leaks- [rules/lottie.md](rules/lottie.md) - Embedding Lottie animations in Remotion@@ -84,7 +276,7 @@ Read individual rule files for detailed explanations and code examples:- [rules/sequencing.md](rules/sequencing.md) - Sequencing patterns for Remotion - delay, trim, limit duration of items- [rules/tailwind.md](rules/tailwind.md) - Using TailwindCSS in Remotion- [rules/text-animations.md](rules/text-animations.md) - Typography and text animation patterns for Remotion-- [rules/timing.md](rules/timing.md) - Timing with interpolate and Bézier easing, springs+- [rules/timing.md](rules/timing.md) - Advanced timing with interpolate and Bézier easing, springs- [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering out a video with transparency- [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animationsdiff --git a/packages/skills/skills/remotion/rules/animations.md b/packages/skills/skills/remotion/rules/animations.mddeleted file mode 100644index 4a02e55357..0000000000--- a/packages/skills/skills/remotion/rules/animations.md+++ /dev/null@@ -1,31 +0,0 @@-----name: animations-description: Fundamental animation skills for Remotion-metadata:- tags: animations, transitions, frames, useCurrentFrame------All animations MUST be driven by the `useCurrentFrame()` hook.-Write animations in seconds and multiply them by the `fps` value from `useVideoConfig()`.--For eased motion, prefer `interpolate` with explicit frame ranges and an easing—especially `Easing.bezier`, which matches CSS `cubic-bezier` so timing can be shared with web specs and curve editors. See [timing](./timing.md).--```tsx-import { useCurrentFrame, Easing } from "remotion";--export const FadeIn = () => {- const frame = useCurrentFrame();- const { fps } = useVideoConfig();-- const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {- extrapolateRight: "clamp",- extrapolateLeft: "clamp",- easing: Easing.bezier(0.16, 1, 0.3, 1),- });-- return <div style={{ opacity }}>Hello World!</div>;-};-```--CSS transitions or animations are FORBIDDEN - they will not render correctly.-Tailwind animation class names are FORBIDDEN - they will not render correctly.diff --git a/packages/skills/skills/remotion/rules/assets.md b/packages/skills/skills/remotion/rules/assets.mddeleted file mode 100644index a5d40152ef..0000000000--- a/packages/skills/skills/remotion/rules/assets.md+++ /dev/null@@ -1,78 +0,0 @@-----name: assets-description: Importing images, videos, audio, and fonts into Remotion-metadata:- tags: assets, staticFile, images, fonts, public------# Importing assets in Remotion--## The public folder--Place assets in the `public/` folder at your project root.--## Using staticFile()--You MUST use `staticFile()` to reference files from the `public/` folder:--```tsx-import { Img, staticFile } from "remotion";--export const MyComposition = () => {- return <Img src={staticFile("logo.png")} />;-};-```--The function returns an encoded URL that works correctly when deploying to subdirectories.--## Using with components--**Images:**--```tsx-import { Img, staticFile } from "remotion";--<Img src={staticFile("photo.png")} />;-```--**Videos:**--```tsx-import { Video } from "@remotion/media";-import { staticFile } from "remotion";--<Video src={staticFile("clip.mp4")} />;-```--**Audio:**--```tsx-import { Audio } from "@remotion/media";-import { staticFile } from "remotion";--<Audio src={staticFile("music.mp3")} />;-```--**Fonts:**--```tsx-import { staticFile } from "remotion";--const fontFamily = new FontFace("MyFont", `url(${staticFile("font.woff2")})`);-await fontFamily.load();-document.fonts.add(fontFamily);-```--## Remote URLs--Remote URLs can be used directly without `staticFile()`:--```tsx-<Img src="https://example.com/image.png" />-<Video src="https://remotion.media/video.mp4" />-```--## Important notes--- Remotion components (`<Img>`, `<Video>`, `<Audio>`) ensure assets are fully loaded before rendering-- Special characters in filenames (`#`, `?`, `&`) are automatically encodeddiff --git a/packages/skills/skills/remotion/rules/can-decode.md b/packages/skills/skills/remotion/rules/can-decode.mddeleted file mode 100644index 7abc7f6cc6..0000000000--- a/packages/skills/skills/remotion/rules/can-decode.md+++ /dev/null@@ -1,81 +0,0 @@-----name: can-decode-description: Check if a video can be decoded by the browser using Mediabunny-metadata:- tags: decode, validation, video, audio, compatibility, browser------# Checking if a video can be decoded--Use Mediabunny to check if a video can be decoded by the browser before attempting to play it.--First, install the right version of Mediabunny:--```bash-npx remotion add mediabunny-```--## The `canDecode()` function--This function can be copy-pasted into any project.--```tsx-import { Input, ALL_FORMATS, UrlSource } from "mediabunny";--export const canDecode = async (src: string) => {- const input = new Input({- formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),- });-- try {- await input.getFormat();- } catch {- return false;- }-- const videoTrack = await input.getPrimaryVideoTrack();- if (videoTrack && !(await videoTrack.canDecode())) {- return false;- }-- const audioTrack = await input.getPrimaryAudioTrack();- if (audioTrack && !(await audioTrack.canDecode())) {- return false;- }-- return true;-};-```--## Usage--```tsx-const src = "https://remotion.media/video.mp4";-const isDecodable = await canDecode(src);--if (isDecodable) {- console.log("Video can be decoded");-} else {- console.log("Video cannot be decoded by this browser");-}-```--## Using with Blob--For file uploads or drag-and-drop, use `BlobSource`:--```tsx-import { Input, ALL_FORMATS, BlobSource } from "mediabunny";--export const canDecodeBlob = async (blob: Blob) => {- const input = new Input({- formats: ALL_FORMATS,- source: new BlobSource(blob),- });-- // Same validation logic as above-};-```diff --git a/packages/skills/skills/remotion/rules/charts.md b/packages/skills/skills/remotion/rules/charts.mddeleted file mode 100644index f036485892..0000000000--- a/packages/skills/skills/remotion/rules/charts.md+++ /dev/null@@ -1,120 +0,0 @@-----name: charts-description: Chart and data visualization patterns for Remotion. Use when creating bar charts, pie charts, line charts, stock graphs, or any data-driven animations.-metadata:- tags: charts, data, visualization, bar-chart, pie-chart, line-chart, stock-chart, svg-paths, graphs------# Charts in Remotion--Create charts using React code - HTML, SVG, and D3.js are all supported.--Disable all animations from third party libraries - they cause flickering.-Drive all animations from `useCurrentFrame()`.--## Bar Chart--```tsx-const STAGGER_DELAY = 5;-const frame = useCurrentFrame();-const { fps } = useVideoConfig();--const bars = data.map((item, i) => {- const height = spring({- frame,- fps,- delay: i * STAGGER_DELAY,- config: { damping: 200 },- });- return <div style={{ height: height * item.value }} />;-});-```--## Pie Chart--Animate segments using stroke-dashoffset, starting from 12 o'clock:--```tsx-const progress = interpolate(frame, [0, 100], [0, 1]);-const circumference = 2 * Math.PI * radius;-const segmentLength = (value / total) * circumference;-const offset = interpolate(progress, [0, 1], [segmentLength, 0]);--<circle- r={radius}- cx={center}- cy={center}- fill="none"- stroke={color}- strokeWidth={strokeWidth}- strokeDasharray={`${segmentLength} ${circumference}`}- strokeDashoffset={offset}- transform={`rotate(-90 ${center} ${center})`}-/>;-```--## Line Chart / Path Animation--Use `@remotion/paths` for animating SVG paths (line charts, stock graphs, signatures).--Install: `npx remotion add @remotion/paths`-Docs: https://remotion.dev/docs/paths.md--### Convert data points to SVG path--```tsx-type Point = { x: number; y: number };--const generateLinePath = (points: Point[]): string => {- if (points.length < 2) return "";- return points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");-};-```--### Draw path with animation--```tsx-import { evolvePath } from "@remotion/paths";--const path = "M 100 200 L 200 150 L 300 180 L 400 100";-const progress = interpolate(frame, [0, 2 * fps], [0, 1], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- easing: Easing.out(Easing.quad),-});--const { strokeDasharray, strokeDashoffset } = evolvePath(progress, path);--<path- d={path}- fill="none"- stroke="#FF3232"- strokeWidth={4}- strokeDasharray={strokeDasharray}- strokeDashoffset={strokeDashoffset}-/>;-```--### Follow path with marker/arrow--```tsx-import {- getLength,- getPointAtLength,- getTangentAtLength,-} from "@remotion/paths";--const pathLength = getLength(path);-const point = getPointAtLength(path, progress * pathLength);-const tangent = getTangentAtLength(path, progress * pathLength);-const angle = Math.atan2(tangent.y, tangent.x);--<g- style={{- transform: `translate(${point.x}px, ${point.y}px) rotate(${angle}rad)`,- transformOrigin: "0 0",- }}->- <polygon points="0,0 -20,-10 -20,10" fill="#FF3232" />-</g>;-```diff --git a/packages/skills/skills/remotion/rules/compositions.md b/packages/skills/skills/remotion/rules/compositions.mdindex 0db5f60266..4f6b865625 100644--- a/packages/skills/skills/remotion/rules/compositions.md+++ b/packages/skills/skills/remotion/rules/compositions.md@@ -7,26 +7,6 @@ metadata:A `<Composition>` defines the component, width, height, fps and duration of a renderable video.-It normally is placed in the `src/Root.tsx` file.--```tsx-import { Composition } from "remotion";-import { MyComposition } from "./MyComposition";--export const RemotionRoot = () => {- return (- <Composition- id="MyComposition"- component={MyComposition}- durationInFrames={100}- fps={30}- width={1080}- height={1080}- />- );-};-```-## Default PropsPass `defaultProps` to provide initial values for your component.@@ -128,7 +108,6 @@ export const RemotionRoot = () => {<Compositionid="MyComposition"component={MyComposition}- durationInFrames={100} // Placeholder, will be overriddenfps={30}width={1080}height={1080}diff --git a/packages/skills/skills/remotion/rules/extract-frames.md b/packages/skills/skills/remotion/rules/extract-frames.mddeleted file mode 100644index 1a8a0c8935..0000000000--- a/packages/skills/skills/remotion/rules/extract-frames.md+++ /dev/null@@ -1,229 +0,0 @@-----name: extract-frames-description: Extract frames from videos at specific timestamps using Mediabunny-metadata:- tags: frames, extract, video, thumbnail, filmstrip, canvas------# Extracting frames from videos--Use Mediabunny to extract frames from videos at specific timestamps. This is useful for generating thumbnails, filmstrips, or processing individual frames.--## The `extractFrames()` function--This function can be copy-pasted into any project.--```tsx-import {- ALL_FORMATS,- Input,- UrlSource,- VideoSample,- VideoSampleSink,-} from "mediabunny";--type Options = {- track: { width: number; height: number };- container: string;- durationInSeconds: number | null;-};--export type ExtractFramesTimestampsInSecondsFn = (- options: Options,-) => Promise<number[]> | number[];--export type ExtractFramesProps = {- src: string;- timestampsInSeconds: number[] | ExtractFramesTimestampsInSecondsFn;- onVideoSample: (sample: VideoSample) => void;- signal?: AbortSignal;-};--export async function extractFrames({- src,- timestampsInSeconds,- onVideoSample,- signal,-}: ExtractFramesProps): Promise<void> {- using input = new Input({- formats: ALL_FORMATS,- source: new UrlSource(src),- });-- const [durationInSeconds, format, videoTrack] = await Promise.all([- input.computeDuration(),- input.getFormat(),- input.getPrimaryVideoTrack(),- ]);-- if (!videoTrack) {- throw new Error("No video track found in the input");- }-- if (signal?.aborted) {- throw new Error("Aborted");- }-- const timestamps =- typeof timestampsInSeconds === "function"- ? await timestampsInSeconds({- track: {- width: videoTrack.displayWidth,- height: videoTrack.displayHeight,- },- container: format.name,- durationInSeconds,- })- : timestampsInSeconds;-- if (timestamps.length === 0) {- return;- }-- if (signal?.aborted) {- throw new Error("Aborted");- }-- const sink = new VideoSampleSink(videoTrack);-- for await (using videoSample of sink.samplesAtTimestamps(timestamps)) {- if (signal?.aborted) {- break;- }-- if (!videoSample) {- continue;- }-- onVideoSample(videoSample);- }-}-```--## Basic usage--Extract frames at specific timestamps:--```tsx-await extractFrames({- src: "https://remotion.media/video.mp4",- timestampsInSeconds: [0, 1, 2, 3, 4],- onVideoSample: (sample) => {- const canvas = document.createElement("canvas");- canvas.width = sample.displayWidth;- canvas.height = sample.displayHeight;- const ctx = canvas.getContext("2d");- sample.draw(ctx!, 0, 0);- },-});-```--## Creating a filmstrip--Use a callback function to dynamically calculate timestamps based on video metadata:--```tsx-const canvasWidth = 500;-const canvasHeight = 80;-const fromSeconds = 0;-const toSeconds = 10;--await extractFrames({- src: "https://remotion.media/video.mp4",- timestampsInSeconds: async ({ track, durationInSeconds }) => {- const aspectRatio = track.width / track.height;- const amountOfFramesFit = Math.ceil(- canvasWidth / (canvasHeight * aspectRatio),- );- const segmentDuration = toSeconds - fromSeconds;- const timestamps: number[] = [];-- for (let i = 0; i < amountOfFramesFit; i++) {- timestamps.push(- fromSeconds + (segmentDuration / amountOfFramesFit) * (i + 0.5),- );- }-- return timestamps;- },- onVideoSample: (sample) => {- console.log(`Frame at ${sample.timestamp}s`);-- const canvas = document.createElement("canvas");- canvas.width = sample.displayWidth;- canvas.height = sample.displayHeight;- const ctx = canvas.getContext("2d");- sample.draw(ctx!, 0, 0);- },-});-```--## Cancellation with AbortSignal--Cancel frame extraction after a timeout:--```tsx-const controller = new AbortController();--setTimeout(() => controller.abort(), 5000);--try {- await extractFrames({- src: "https://remotion.media/video.mp4",- timestampsInSeconds: [0, 1, 2, 3, 4],- onVideoSample: (sample) => {- using frame = sample;- const canvas = document.createElement("canvas");- canvas.width = frame.displayWidth;- canvas.height = frame.displayHeight;- const ctx = canvas.getContext("2d");- frame.draw(ctx!, 0, 0);- },- signal: controller.signal,- });-- console.log("Frame extraction complete!");-} catch (error) {- console.error("Frame extraction was aborted or failed:", error);-}-```--## Timeout with Promise.race--```tsx-const controller = new AbortController();--const timeoutPromise = new Promise<never>((_, reject) => {- const timeoutId = setTimeout(() => {- controller.abort();- reject(new Error("Frame extraction timed out after 10 seconds"));- }, 10000);-- controller.signal.addEventListener("abort", () => clearTimeout(timeoutId), {- once: true,- });-});--try {- await Promise.race([- extractFrames({- src: "https://remotion.media/video.mp4",- timestampsInSeconds: [0, 1, 2, 3, 4],- onVideoSample: (sample) => {- using frame = sample;- const canvas = document.createElement("canvas");- canvas.width = frame.displayWidth;- canvas.height = frame.displayHeight;- const ctx = canvas.getContext("2d");- frame.draw(ctx!, 0, 0);- },- signal: controller.signal,- }),- timeoutPromise,- ]);-- console.log("Frame extraction complete!");-} catch (error) {- console.error("Frame extraction was aborted or failed:", error);-}-```diff --git a/packages/skills/skills/remotion/rules/fonts.md b/packages/skills/skills/remotion/rules/fonts.mddeleted file mode 100644index c10cd83e62..0000000000--- a/packages/skills/skills/remotion/rules/fonts.md+++ /dev/null@@ -1,152 +0,0 @@-----name: fonts-description: Loading Google Fonts and local fonts in Remotion-metadata:- tags: fonts, google-fonts, typography, text------# Using fonts in Remotion--## Google Fonts with @remotion/google-fonts--The recommended way to use Google Fonts. It's type-safe and automatically blocks rendering until the font is ready.--### Prerequisites--First, the @remotion/google-fonts package needs to be installed.-If it is not installed, use the following command:--```bash-npx remotion add @remotion/google-fonts # If project uses npm-bunx remotion add @remotion/google-fonts # If project uses bun-yarn remotion add @remotion/google-fonts # If project uses yarn-pnpm exec remotion add @remotion/google-fonts # If project uses pnpm-```--```tsx-import { loadFont } from "@remotion/google-fonts/Lobster";--const { fontFamily } = loadFont();--export const MyComposition = () => {- return <div style={{ fontFamily }}>Hello World</div>;-};-```--Preferrably, specify only needed weights and subsets to reduce file size:--```tsx-import { loadFont } from "@remotion/google-fonts/Roboto";--const { fontFamily } = loadFont("normal", {- weights: ["400", "700"],- subsets: ["latin"],-});-```--### Waiting for font to load--Use `waitUntilDone()` if you need to know when the font is ready:--```tsx-import { loadFont } from "@remotion/google-fonts/Lobster";--const { fontFamily, waitUntilDone } = loadFont();--await waitUntilDone();-```--## Local fonts with @remotion/fonts--For local font files, use the `@remotion/fonts` package.--### Prerequisites--First, install @remotion/fonts:--```bash-npx remotion add @remotion/fonts # If project uses npm-bunx remotion add @remotion/fonts # If project uses bun-yarn remotion add @remotion/fonts # If project uses yarn-pnpm exec remotion add @remotion/fonts # If project uses pnpm-```--### Loading a local font--Place your font file in the `public/` folder and use `loadFont()`:--```tsx-import { loadFont } from "@remotion/fonts";-import { staticFile } from "remotion";--await loadFont({- family: "MyFont",- url: staticFile("MyFont-Regular.woff2"),-});--export const MyComposition = () => {- return <div style={{ fontFamily: "MyFont" }}>Hello World</div>;-};-```--### Loading multiple weights--Load each weight separately with the same family name:--```tsx-import { loadFont } from "@remotion/fonts";-import { staticFile } from "remotion";--await Promise.all([- loadFont({- family: "Inter",- url: staticFile("Inter-Regular.woff2"),- weight: "400",- }),- loadFont({- family: "Inter",- url: staticFile("Inter-Bold.woff2"),- weight: "700",- }),-]);-```--### Available options--```tsx-loadFont({- family: "MyFont", // Required: name to use in CSS- url: staticFile("font.woff2"), // Required: font file URL- format: "woff2", // Optional: auto-detected from extension- weight: "400", // Optional: font weight- style: "normal", // Optional: normal or italic- display: "block", // Optional: font-display behavior-});-```--## Using in components--Call `loadFont()` at the top level of your component or in a separate file that's imported early:--```tsx-import { loadFont } from "@remotion/google-fonts/Montserrat";--const { fontFamily } = loadFont("normal", {- weights: ["400", "700"],- subsets: ["latin"],-});--export const Title: React.FC<{ text: string }> = ({ text }) => {- return (- <h1- style={{- fontFamily,- fontSize: 80,- fontWeight: "bold",- }}- >- {text}- </h1>- );-};-```diff --git a/packages/skills/skills/remotion/rules/google-fonts.md b/packages/skills/skills/remotion/rules/google-fonts.mdnew file mode 100644index 0000000000..87c07697ec--- /dev/null+++ b/packages/skills/skills/remotion/rules/google-fonts.md@@ -0,0 +1,72 @@+---+name: fonts+description: Loading Google Fonts and local fonts in Remotion+metadata:+ tags: fonts, google-fonts, typography, text+---++# Using fonts in Remotion++## Google Fonts with @remotion/google-fonts++The recommended way to use Google Fonts. It's type-safe and automatically blocks rendering until the font is ready.++### Prerequisites++First, the @remotion/google-fonts package needs to be installed.+If it is not installed, use the following command:++```bash+npx remotion add @remotion/google-fonts # If project uses npm+bunx remotion add @remotion/google-fonts # If project uses bun+yarn remotion add @remotion/google-fonts # If project uses yarn+pnpm exec remotion add @remotion/google-fonts # If project uses pnpm+```++```tsx+import { loadFont } from "@remotion/google-fonts/Lobster";++const { fontFamily } = loadFont();++export const MyComposition = () => {+ return <div style={{ fontFamily }}>Hello World</div>;+};+```++Preferrably, specify only needed weights and subsets to reduce file size:++```tsx+import { loadFont } from "@remotion/google-fonts/Roboto";++const { fontFamily } = loadFont("normal", {+ weights: ["400", "700"],+ subsets: ["latin"],+});+```++## Using in components++Call `loadFont()` at the top level of your component or in a separate file that's imported early:++```tsx+import { loadFont } from "@remotion/google-fonts/Montserrat";++const { fontFamily } = loadFont("normal", {+ weights: ["400", "700"],+ subsets: ["latin"],+});++export const Title: React.FC<{ text: string }> = ({ text }) => {+ return (+ <h1+ style={{+ fontFamily,+ fontSize: 80,+ fontWeight: "bold",+ }}+ >+ {text}+ </h1>+ );+};+```diff --git a/packages/skills/skills/remotion/rules/local-fonts.md b/packages/skills/skills/remotion/rules/local-fonts.mdnew file mode 100644index 0000000000..30dce5fb10--- /dev/null+++ b/packages/skills/skills/remotion/rules/local-fonts.md@@ -0,0 +1,65 @@+For local font files, use the `@remotion/fonts` package.++### Prerequisites++First, install @remotion/fonts:++```bash+npx remotion add @remotion/fonts # If project uses npm+bunx remotion add @remotion/fonts # If project uses bun+yarn remotion add @remotion/fonts # If project uses yarn+pnpm exec remotion add @remotion/fonts # If project uses pnpm+```++### Loading a local font++Place your font file in the `public/` folder and use `loadFont()`:++```tsx+import { loadFont } from "@remotion/fonts";+import { staticFile } from "remotion";++await loadFont({+ family: "MyFont",+ url: staticFile("MyFont-Regular.woff2"),+});++export const MyComposition = () => {+ return <div style={{ fontFamily: "MyFont" }}>Hello World</div>;+};+```++### Loading multiple weights++Load each weight separately with the same family name:++```tsx+import { loadFont } from "@remotion/fonts";+import { staticFile } from "remotion";++await Promise.all([+ loadFont({+ family: "Inter",+ url: staticFile("Inter-Regular.woff2"),+ weight: "400",+ }),+ loadFont({+ family: "Inter",+ url: staticFile("Inter-Bold.woff2"),+ weight: "700",+ }),+]);+```++### Available options++```tsx+loadFont({+ family: "MyFont", // Required: name to use in CSS+ url: staticFile("font.woff2"), // Required: font file URL+ format: "woff2", // Optional: auto-detected from extension+ weight: "400", // Optional: font weight+ style: "normal", // Optional: normal or italic+ display: "block", // Optional: font-display behavior+});+```diff --git a/packages/skills/skills/remotion/rules/sequencing.md b/packages/skills/skills/remotion/rules/sequencing.mdindex 46b86a8872..a2af6690d9 100644--- a/packages/skills/skills/remotion/rules/sequencing.md+++ b/packages/skills/skills/remotion/rules/sequencing.md@@ -10,14 +10,40 @@ Use `<Sequence>` to delay when an element appears in the timeline.```tsximport { Sequence } from "remotion";-const {fps} = useVideoConfig();--<Sequence from={1 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>- <Title />-</Sequence>-<Sequence from={2 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>- <Subtitle />-</Sequence>+export const Title = () => {+ const frame = useCurrentFrame();+ const { fps } = useVideoConfig();++ const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {+ extrapolateRight: "clamp",+ extrapolateLeft: "clamp",+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return <div style={{ opacity }}>Title</div>;+};++export const Subtitle = () => {+ return <div>Subtitle</div>;+};++const Main = () => {+ const {fps} = useVideoConfig();++ return (+ <AbsoluteFill>+ <Sequence>+ <Background />+ </Sequence>+ <Sequence from={1 * fps} durationInFrames={2 * fps} layout="none">+ <Title />+ </Sequence>+ <Sequence from={2 * fps} durationInFrames={2 * fps} layout="none">+ <Subtitle />+ </Sequence>+ </AbsoluteFill>+ );+}```This will by default wrap the component in an absolute fill element.