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.
Ready-to-run agent install
This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.
npx -y tokrepo@latest install 5e7d0f33-7ea5-4ca6-b5f7-9719a99db833 --target codexRun after dry-run confirms the install plan.
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.
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.
How to use
- Add this rule to your Remotion project as part of the agent skill configuration.
- When your AI agent needs to include media in a composition, it references this rule for the correct import pattern.
- Use
staticFile('filename.mp4')for files in thepublic/folder, orimportstatements for assets processed by the bundler.
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} />;
Related on TokRepo
- Prompt library -- Explore curated prompt and skill templates for AI-assisted development.
- AI tools for video -- Other video-related AI tools and workflows.
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-faceleads 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.
Frequently Asked Questions
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.
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.
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.
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.
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.
Citations (3)
- Remotion Docs— Remotion staticFile API for importing public folder assets
- Remotion GitHub— Remotion is a React framework for programmatic video
- Remotion Assets Docs— Asset handling in Remotion compositions
Related on TokRepo
Source & Thanks
Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule:
assets
Part of the Remotion AI Skill collection on TokRepo.
Discussion
Related Assets
Remotion Rule: Videos
Remotion skill rule: Embedding videos in Remotion - trimming, volume, speed, looping, pitch. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Transcribe Captions
Remotion skill rule: Transcribing audio to generate captions in Remotion. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Import Srt Captions
Remotion skill rule: Importing .srt subtitle files into Remotion using @remotion/captions. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Get Audio Duration
Remotion skill rule: Getting the duration of an audio file in seconds with Mediabunny. Part of the official Remotion Agent Skill for programmatic video in React.