Cette page est affichée en anglais. Une traduction française est en cours.
SkillsMar 29, 2026·1 min de lecture

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.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Remotion Rule: Assets
Commande d'installation directe
npx -y tokrepo@latest install 5e7d0f33-7ea5-4ca6-b5f7-9719a99db833 --target codex

À exécuter après confirmation du plan en dry-run.

TL;DR
This Remotion agent skill rule explains how to correctly import images, videos, audio, and fonts into React-based video projects.
§01

What it is

The Remotion Assets rule is a focused skill instruction for AI agents building programmatic videos with Remotion. It covers the correct patterns for importing static and dynamic media files -- images, video clips, audio tracks, and custom fonts -- into a Remotion composition.

This rule is intended for developers and AI coding agents that generate video content in React using Remotion and need reliable media import patterns.

§02

How it saves time or tokens

Without this rule, an AI agent frequently guesses import paths or uses incompatible bundler configurations, producing broken builds. The rule eliminates trial-and-error by specifying exactly which API to use (staticFile() for public assets, ES module imports for bundled assets) and which file types each approach supports.

§03

How to use

  1. Add this rule to your Remotion project as part of the agent skill configuration.
  2. When your AI agent needs to include media in a composition, it references this rule for the correct import pattern.
  3. Use staticFile('filename.mp4') for files in the public/ folder, or import statements for assets processed by the bundler.
§04

Example

import { staticFile, Video, Img, Audio } from 'remotion';

// Public folder assets
const MyComp: React.FC = () => (
  <>
    <Video src={staticFile('background.mp4')} />
    <Img src={staticFile('logo.png')} />
    <Audio src={staticFile('narration.mp3')} />
  </>
);

// Bundled import
import heroImage from './assets/hero.png';
const Hero: React.FC = () => <Img src={heroImage} />;
§05

Related on TokRepo

§06

Common pitfalls

  • Using relative file paths instead of staticFile() causes assets to fail in the rendered output even if they work in preview.
  • Large video files in the public/ folder bloat the bundle. Use external URLs or pre-signed S3 links for assets over 50 MB.
  • Forgetting to install font files or register them with @font-face leads to fallback fonts in the final render.
  • Audio files must be WAV or MP3; some codecs (like AAC in .m4a containers) are not supported by all Remotion renderers.
  • Importing assets via dynamic require() at runtime is unsupported in Remotion's Webpack config by default.

Questions fréquentes

What is the staticFile function in Remotion?+

staticFile() resolves a filename to its path in the public/ directory. It works during both preview and rendering, ensuring assets are correctly located regardless of environment. Use it for any media file you place in the public/ folder.

Can I use external URLs for video assets in Remotion?+

Yes. The Video and Audio components accept any valid URL as the src prop. External URLs avoid bundling large files but require network access during rendering, which may slow down render times or fail in offline environments.

How do I add custom fonts to a Remotion project?+

Place font files (WOFF2, TTF) in the public/ folder and register them with a @font-face CSS declaration loaded in your Root component. Then reference the font-family in your composition styles. Google Fonts can also be imported via their CSS URL.

Does this rule work with Remotion Lambda?+

Yes. The staticFile() pattern and import-based approach both work with Remotion Lambda. However, Lambda has a payload size limit, so very large assets should be hosted externally and fetched by URL rather than bundled.

What formats does Remotion support for images?+

Remotion supports PNG, JPEG, WebP, GIF, and SVG for images. SVGs can also be imported as React components for animation. Animated GIFs play as static images by default; use the Gif component from @remotion/gif for animated playback.

Sources citées (3)
🙏

Source et remerciements

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

Part of the Remotion AI Skill collection on TokRepo.

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires