skills/remotion-video-creation/rules/assets.md
Place assets in the public/ folder at your project root.
You MUST use staticFile() to reference files from the public/ folder:
import {Img, staticFile} from 'remotion';
export const MyComposition = () => {
return ;
};
The function returns an encoded URL that works correctly when deploying to subdirectories.
Images:
import {Img, staticFile} from 'remotion';
;
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 can be used directly without staticFile():
<Video src="https://remotion.media/video.mp4" />
<Video>, <Audio>) ensure assets are fully loaded before rendering#, ?, &) are automatically encoded