Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsMar 29, 2026·1 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Remotion Rule: Assets
Comando de instalación directa
npx -y tokrepo@latest install 5e7d0f33-7ea5-4ca6-b5f7-9719a99db833 --target codex

Ejecutar después de confirmar el plan con 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.

Preguntas frecuentes

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.

Referencias (3)
🙏

Fuente y agradecimientos

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

Part of the Remotion AI Skill collection on TokRepo.

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados