Skills2026年3月29日·1 分钟阅读

Remotion Rule: Assets

Remotion skill rule: Importing images, videos, audio, and fonts into Remotion. Part of the official Remotion Agent Skill for programmatic video in React.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

npx skills add remotion-dev/skills

This rule activates automatically when working with assets in a Remotion project.


介绍

Importing images, videos, audio, and fonts into Remotion. Part of the Remotion AI Skill — the official Agent Skill for programmatic video creation in React.

Best for: Developers using Remotion for assets Works with: Claude Code, OpenAI Codex, Cursor


Rule Content

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:

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:

import { Img, staticFile } from "remotion";

<Img src={staticFile("photo.png")} />;

Videos:

import { Video } from "@remotion/media";
import { staticFile } from "remotion";

<Video src={staticFile("clip.mp4")} />;

Audio:

import { Audio } from "@remotion/media";
import { staticFile } from "remotion";

<Audio src={staticFile("music.mp3")} />;

Fonts:

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():

<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 encoded

🙏

来源与感谢

Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule: assets

Part of the Remotion AI Skill collection on TokRepo.

相关资产