Skip to content

🎥 Make videos programmatically with React

Docs: Turn llms.txt into a curated documentation index

Igor Samokhovetsa4bfbec912f8
diff --git a/packages/docs/components/SystemPrompt.tsx b/packages/docs/components/SystemPrompt.tsx
deleted file mode 100644
index b2b7b5874d..0000000000
--- a/packages/docs/components/SystemPrompt.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-// @ts-expect-error
-import CodeBlock from '@theme/CodeBlock';
-import React from 'react';
-// eslint-disable-next-line no-restricted-imports
-import {SYSTEM_PROMPT} from '../src/helpers/system-prompt';
-
-export const SystemPrompt: React.FC = () => {
- return (
- <CodeBlock
- className="shiki github-dark"
- language="bash"
- style={{
- backgroundColor: 'rgb(13, 17, 23)',
- color: 'rgb(201, 209, 217)',
- }}
- >
- <div className="code-container">
- {SYSTEM_PROMPT.split('\n').map((line, i) => (
- // eslint-disable-next-line react/no-array-index-key
- <div key={i} className="line">
- {line}
- </div>
- ))}
- </div>
- </CodeBlock>
- );
-};
diff --git a/packages/docs/docs/ai/TableOfContents.tsx b/packages/docs/docs/ai/TableOfContents.tsx
index 2dc331db8e..4b1eb69803 100644
--- a/packages/docs/docs/ai/TableOfContents.tsx
+++ b/packages/docs/docs/ai/TableOfContents.tsx
@@ -33,10 +33,6 @@ export const TableOfContents: React.FC = () => {
<strong>{'Bolt.new'}</strong>
<div>Use Bolt.new to prompt Remotion videos</div>
</TOCItem>
- <TOCItem link="/docs/ai/system-prompt">
- <strong>{'System Prompt'}</strong>
- <div>to teach LLMs Remotion rules</div>
- </TOCItem>
<TOCItem link="/docs/ai/generate">
<strong>{'Code generation with LLMs'}</strong>
<div>Generate Remotion code by invoking AI</div>
diff --git a/packages/docs/docs/ai/ai-saas-template.mdx b/packages/docs/docs/ai/ai-saas-template.mdx
index 41cab5e181..15a03c617e 100644
--- a/packages/docs/docs/ai/ai-saas-template.mdx
+++ b/packages/docs/docs/ai/ai-saas-template.mdx
@@ -79,4 +79,4 @@ REMOTION_AWS_SECRET_ACCESS_KEY=...
- [Code Generation](/docs/ai/generate) - How to generate Remotion code with LLMs
- [Just-in-time Compilation](/docs/ai/dynamic-compilation) - Compiling React code in the browser
-- [System Prompt](/docs/ai/system-prompt) - Reference system prompt for Remotion
+- [System Prompt](/system-prompt.txt) - Reference system prompt for Remotion
diff --git a/packages/docs/docs/ai/dynamic-compilation.mdx b/packages/docs/docs/ai/dynamic-compilation.mdx
index 99f5f18eb4..cb5aab1179 100644
--- a/packages/docs/docs/ai/dynamic-compilation.mdx
+++ b/packages/docs/docs/ai/dynamic-compilation.mdx
@@ -234,4 +234,4 @@ This is outside the scope of this guide.
- [Prompt to Motion Graphics template](https://remotion.dev/templates/prompt-to-motion-graphics) - Example implementation
- [Code Generation](/docs/ai/generate) - How to generate Remotion code with AI
-- [System Prompt](/docs/ai/system-prompt) - Teaching LLMs about Remotion
+- [System Prompt](/system-prompt.txt) - Teaching LLMs about Remotion
diff --git a/packages/docs/docs/ai/generate.mdx b/packages/docs/docs/ai/generate.mdx
index 0213168e17..07c4586ce7 100644
--- a/packages/docs/docs/ai/generate.mdx
+++ b/packages/docs/docs/ai/generate.mdx
@@ -109,7 +109,7 @@ If there is a schema mismatch, the AI SDK will automatically retry up to [`maxRe
Finding the perfect system prompt is complex.
Depending on what you want to build, you could optimize for specific animation types or even your corporate branding.
-However, a great starting place is to use Remotion's [System Prompt](/docs/ai/system-prompt) which teaches the general LLM Remotion's APIs and best practices.
+However, a great starting place is to use Remotion's [System Prompt](/system-prompt.txt) which teaches the general LLM Remotion's APIs and best practices.
You can iterate from there, generate a couple components and tune it to your needs.
Be careful of context rot - as the context grows, the output quality and instructiong degrades.
@@ -171,5 +171,5 @@ After you generated the code, you need to compile and render it.
## See Also
- [Prompt to Motion Graphics template](https://remotion.dev/templates/prompt-to-motion-graphics) - Example implementation
-- [System Prompt](/docs/ai/system-prompt) - A system prompt for teaching LLMs Remotion
+- [System Prompt](/system-prompt.txt) - A system prompt for teaching LLMs Remotion
- [Dynamic Compilation](/docs/ai/dynamic-compilation) - How to compile and render the generated code in the browser
diff --git a/packages/docs/docs/ai/system-prompt.mdx b/packages/docs/docs/ai/system-prompt.mdx
deleted file mode 100644
index 312b2728b0..0000000000
--- a/packages/docs/docs/ai/system-prompt.mdx
+++ /dev/null
@@ -1,19 +0,0 @@
----
-image: /generated/articles-docs-ai-system-prompt.png
-crumb: 'AI'
-title: Remotion System Prompt for LLMs
-sidebar_label: System Prompt
----
-
-This is a prompt that you can give to Large Language Models to teach them the mechanics and rules of Remotion.
-You can then prompt the LLMs to generate Remotion Code for you.
-
-## System Prompt
-
-import {SystemPrompt} from '../../components/SystemPrompt';
-
-<SystemPrompt />
-
-## llms.txt
-
-This file is also hosted under https://www.remotion.dev/llms.txt, as per [convention](https://llmstxt.org).
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 94cdcaa6b0..67ee7410d1 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -9,7 +9,7 @@
"formatting": "oxfmt src standalone --check",
"format": "oxfmt src standalone",
"docusaurus": "docusaurus",
- "start": "bun copy-raw-docs.ts && bun fetch-prompt-submissions.ts && bun update-prompt.ts && cd .. && bun run build && cd docs && bun prepare-browser-studio-workspace.ts && if [ \"$REMOTION_DOCS_ENABLE_TWOSLASH\" = \"1\" ]; then echo \"🧪 Twoslash is enabled in development.\"; else echo \"⚡ Twoslash is disabled in development for faster startup.\"; echo \" Enable it with: REMOTION_DOCS_ENABLE_TWOSLASH=1 bun run start\"; fi && docs_port=$(bun find-available-port.ts) && REMOTION_DOCS_DISABLE_TWOSLASH=1 docusaurus start --host 0.0.0.0 --port \"$docs_port\" --no-open",
+ "start": "bun copy-raw-docs.ts && bun fetch-prompt-submissions.ts && cd .. && bun run build && cd docs && bun prepare-browser-studio-workspace.ts && if [ \"$REMOTION_DOCS_ENABLE_TWOSLASH\" = \"1\" ]; then echo \"🧪 Twoslash is enabled in development.\"; else echo \"⚡ Twoslash is disabled in development for faster startup.\"; echo \" Enable it with: REMOTION_DOCS_ENABLE_TWOSLASH=1 bun run start\"; fi && docs_port=$(bun find-available-port.ts) && REMOTION_DOCS_DISABLE_TWOSLASH=1 docusaurus start --host 0.0.0.0 --port \"$docs_port\" --no-open",
"build-docs": "bun build-docs.ts",
"build-browser-studio": "bun prepare-browser-studio-workspace.ts && bun build-browser-studio-standalone.ts",
"swizzle": "docusaurus swizzle",
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index c4663fc1c9..4ae83ad3bf 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -1542,7 +1542,6 @@ const sidebars: SidebarsConfig = {
'ai/generate',
'ai/dynamic-compilation',
'ai/ai-saas-template',
- 'ai/system-prompt',
'ai/mcp',
],
},
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 56d0592959..d3039b6a60 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -233,15 +233,6 @@ export const articles = [
noAi: false,
slug: 'ai/skills',
},
- {
- id: 'ai/system-prompt',
- title: 'Remotion System Prompt for LLMs',
- relativePath: 'docs/ai/system-prompt.mdx',
- compId: 'articles-docs-ai-system-prompt',
- crumb: 'AI',
- noAi: false,
- slug: 'ai/system-prompt',
- },
{
id: 'ai/webmcp',
title: 'WebMCP',
diff --git a/packages/docs/src/test/system-prompt.test.ts b/packages/docs/src/test/system-prompt.test.ts
deleted file mode 100644
index af49dcbd98..0000000000
--- a/packages/docs/src/test/system-prompt.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {expect, test} from 'bun:test';
-import {readFileSync} from 'fs';
-import path from 'path';
-import {SYSTEM_PROMPT} from '../helpers/system-prompt';
-
-const normalizeLineEndings = (text: string) => {
- return text.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
-};
-
-test('SYSTEM_PROMPT is generated from llms.txt', () => {
- const llms = readFileSync(
- path.join(__dirname, '..', '..', 'static', 'llms.txt'),
- 'utf8',
- );
-
- expect(normalizeLineEndings(SYSTEM_PROMPT)).toBe(
- normalizeLineEndings(llms.trimStart()),
- );
-});
diff --git a/packages/docs/static/generated/articles-docs-ai-system-prompt.png b/packages/docs/static/generated/articles-docs-ai-system-prompt.png
deleted file mode 100644
index 8230185ae1..0000000000
Binary files a/packages/docs/static/generated/articles-docs-ai-system-prompt.png and /dev/null differ
diff --git a/packages/docs/static/llms.txt b/packages/docs/static/llms.txt
index 97142bba19..20abca6a28 100644
--- a/packages/docs/static/llms.txt
+++ b/packages/docs/static/llms.txt
@@ -1,368 +1,47 @@
-# About Remotion
+# Remotion documentation
-Remotion is a framework that can create videos programmatically.
-It is based on React.js. All output should be valid React code and be written in TypeScript.
+> Remotion is a React framework for creating videos programmatically.
-# Project structure
+This is a guide to the main documentation topics. Fetch the linked Markdown pages for details and follow their links to more specific guides and APIs.
-A Remotion Project consists of an entry file, a Root file and any number of React component files.
-A project can be scaffolded using the "npx create-video --yes --blank my-video" command.
-The entry file is usually named "src/index.ts" and looks like this:
+## Getting started
-```ts
-import {registerRoot} from 'remotion';
-import {Root} from './Root';
+- [Creating a new project](https://www.remotion.dev/docs/index.md)
+- [The fundamentals](https://www.remotion.dev/docs/the-fundamentals.md)
+- [API overview](https://www.remotion.dev/docs/api.md)
-registerRoot(Root);
-```
+## Creating videos
-The Root file is usually named "src/Root.tsx" and looks like this:
+- [Animating properties](https://www.remotion.dev/docs/animating-properties.md)
+- [Embedding videos into Remotion](https://www.remotion.dev/docs/videos/index.md)
+- [@remotion/media](https://www.remotion.dev/docs/media/index.md)
+- [Using audio](https://www.remotion.dev/docs/using-audio.md)
+- [Using fonts](https://www.remotion.dev/docs/fonts.md)
+- [@remotion/transitions](https://www.remotion.dev/docs/transitions/index.md)
+- [Captions](https://www.remotion.dev/docs/captions/index.md)
+- [Effects](https://www.remotion.dev/docs/effects.md)
+- [@remotion/shapes](https://www.remotion.dev/docs/shapes/index.md)
-```tsx
-import {Composition} from 'remotion';
-import {MyComp} from './MyComp';
+## Previewing and rendering
-export const Root: React.FC = () => {
- return (
- <>
- <Composition
- id="MyComp"
- component={MyComp}
- durationInFrames={120}
- width={1920}
- height={1080}
- fps={30}
- defaultProps={{}}
- />
- </>
- );
-};
-```
+- [Starting the Studio](https://www.remotion.dev/docs/studio/studio.md)
+- [Render your video](https://www.remotion.dev/docs/render.md)
+- [Command line reference](https://www.remotion.dev/docs/cli/cli.md)
+- [Configuration file](https://www.remotion.dev/docs/config.md)
+- [@remotion/renderer](https://www.remotion.dev/docs/renderer.md)
+- [@remotion/player](https://www.remotion.dev/docs/player/index.md)
+- [Client-side rendering](https://www.remotion.dev/docs/client-side-rendering/index.md)
+- [@remotion/lambda](https://www.remotion.dev/docs/lambda.md)
-A `<Composition>` defines a video that can be rendered. It consists of a React "component", an "id", a "durationInFrames", a "width", a "height" and a frame rate "fps".
-The default frame rate should be 30.
-The default height should be 1080 and the default width should be 1920.
-The default "id" should be "MyComp".
-The "defaultProps" must be in the shape of the React props the "component" expects.
+## Building applications
-Inside a React "component", one can use the "useCurrentFrame()" hook to get the current frame number.
-Frame numbers start at 0.
+- [Editor Starter](https://www.remotion.dev/docs/editor-starter/index.md)
+- [Remotion Timeline](https://www.remotion.dev/docs/timeline/index.md)
+- [Mediabunny](https://www.remotion.dev/docs/mediabunny/index.md)
+- [@remotion/media-parser](https://www.remotion.dev/docs/media-parser/index.md)
+- [@remotion/webcodecs](https://www.remotion.dev/docs/webcodecs/index.md)
-```tsx
-export const MyComp: React.FC = () => {
- const frame = useCurrentFrame();
- return <div>Frame {frame}</div>;
-};
-```
+## AI
-# Component Rules
-
-Inside a component, regular HTML and SVG tags can be returned.
-There are special tags for video and audio.
-Those special tags accept regular CSS styles.
-
-If a video is included in the component it should use the "<Video>" tag.
-
-```tsx
-import {Video} from '@remotion/media';
-
-export const MyComp: React.FC = () => {
- return (
- <div>
- <Video
- src="https://remotion.dev/bbb.mp4"
- style={{width: '100%'}}
- />
- </div>
- );
-};
-```
-
-Video has a "trimBefore" prop that trims the left side of a video by a number of frames.
-Video has a "trimAfter" prop that limits how long a video is shown.
-Video has a "volume" prop that sets the volume of the video. It accepts values between 0 and 1.
-
-If an non-animated image is included In the component it should use the "<Img>" tag.
-
-```tsx
-import {Img} from 'remotion';
-
-export const MyComp: React.FC = () => {
- return <Img src="https://remotion.dev/logo.png" style={{width: '100%'}} />;
-};
-```
-
-If an animated GIF is included, the "@remotion/gif" package should be installed and the "<Gif>" tag should be used.
-
-```tsx
-import {Gif} from '@remotion/gif';
-
-export const MyComp: React.FC = () => {
- return (
- <Gif
- src="https://media.giphy.com/media/l0MYd5y8e1t0m/giphy.gif"
- style={{width: '100%'}}
- />
- );
-};
-```
-
-If audio is included, the "<Audio>" tag should be used.
-
-```tsx
-import {Audio} from '@remotion/media';
-
-export const MyComp: React.FC = () => {
- return <Audio src="https://remotion.dev/audio.mp3" />;
-};
-```
-
-Asset sources can be specified as either a Remote URL or an asset that is referenced from the "public/" folder of the project.
-If an asset is referenced from the "public/" folder, it should be specified using the "staticFile" API from Remotion
-
-```tsx
-import {staticFile} from 'remotion';
-import {Audio} from '@remotion/media';
-
-export const MyComp: React.FC = () => {
- return <Audio src={staticFile('audio.mp3')} />;
-};
-```
-
-Audio has a "trimBefore" prop that trims the left side of a audio by a number of frames.
-Audio has a "trimAfter" prop that limits how long a audio is shown.
-Audio has a "volume" prop that sets the volume of the audio. It accepts values between 0 and 1.
-
-If two elements should be rendered on top of each other, they should be layered using the "AbsoluteFill" component from "remotion".
-
-```tsx
-import {AbsoluteFill} from 'remotion';
-
-export const MyComp: React.FC = () => {
- return (
- <AbsoluteFill>
- <AbsoluteFill style={{background: 'blue'}}>
- <div>This is in the back</div>
- </AbsoluteFill>
- <AbsoluteFill style={{background: 'blue'}}>
- <div>This is in front</div>
- </AbsoluteFill>
- </AbsoluteFill>
- );
-};
-```
-
-Components such as "Interactive", "AbsoluteFill", "Audio" and "Video" accept timing props that place them later in the video.
-
-```tsx
-import {Interactive} from 'remotion';
-
-export const MyComp: React.FC = () => {
- return (
- <Interactive.Div from={10} durationInFrames={20}>
- This only appears after 10 frames
- </Interactive.Div>
- );
-};
-```
-
-The "from" prop specifies the frame number where the element should appear.
-The "trimBefore" prop trims the start of the component timeline by a number of frames.
-
-The "durationInFrames" prop specifies how long the element should appear.
-
-If a child of a timed component calls "useCurrentFrame()", the enumeration starts from the first frame the parent appears and starts at "trimBefore".
-
-```tsx
-import {AbsoluteFill} from 'remotion';
-
-export const Child: React.FC = () => {
- const frame = useCurrentFrame();
-
- return <div>At frame 10, this should be 0: {frame}</div>;
-};
-
-export const MyComp: React.FC = () => {
- return (
- <AbsoluteFill from={10} durationInFrames={20}>
- <Child />
- </AbsoluteFill>
- );
-};
-```
-
-For displaying multiple elements after another, the "Series" component from "remotion" can be used.
-
-```tsx
-import {Series} from 'remotion';
-
-export const MyComp: React.FC = () => {
- return (
- <Series>
- <Series.Sequence durationInFrames={20}>
- <div>This only appears immediately</div>
- </Series.Sequence>
- <Series.Sequence durationInFrames={30}>
- <div>This only appears after 20 frames</div>
- </Series.Sequence>
- <Series.Sequence durationInFrames={30} offset={-8}>
- <div>This only appears after 42 frames</div>
- </Series.Sequence>
- </Series>
- );
-};
-```
-
-The "Series.Sequence" component works like "Sequence", but has no "from" prop.
-Instead, it has a "offset" prop shifts the start by a number of frames.
-
-For displaying multiple elements after another another and having a transition inbetween, the "TransitionSeries" component from "@remotion/transitions" can be used.
-
-```tsx
-import {
- linearTiming,
- springTiming,
- TransitionSeries,
-} from '@remotion/transitions';
-
-import {fade} from '@remotion/transitions/fade';
-import {wipe} from '@remotion/transitions/wipe';
-
-export const MyComp: React.FC = () => {
- return (
- <TransitionSeries>
- <TransitionSeries.Sequence durationInFrames={60}>
- <Fill color="blue" />
- </TransitionSeries.Sequence>
- <TransitionSeries.Transition
- timing={springTiming({config: {damping: 200}})}
- presentation={fade()}
- />
- <TransitionSeries.Sequence durationInFrames={60}>
- <Fill color="black" />
- </TransitionSeries.Sequence>
- <TransitionSeries.Transition
- timing={linearTiming({durationInFrames: 30})}
- presentation={wipe()}
- />
- <TransitionSeries.Sequence durationInFrames={60}>
- <Fill color="white" />
- </TransitionSeries.Sequence>
- </TransitionSeries>
- );
-};
-```
-
-"TransitionSeries.Sequence" works like "Series.Sequence" but has no "offset" prop.
-The order of tags is important, "TransitionSeries.Transition" must be inbetween "TransitionSeries.Sequence" tags.
-
-Remotion needs all of the React code to be deterministic. Therefore, it is forbidden to use the Math.random() API.
-If randomness is requested, the "random()" function from "remotion" should be used and a static seed should be passed to it.
-The random function returns a number between 0 and 1.
-
-```tsx twoslash
-import {random} from 'remotion';
-
-export const MyComp: React.FC = () => {
- return <div>Random number: {random('my-seed')}</div>;
-};
-```
-
-Remotion includes an interpolate() helper that can animate values over time.
-
-```tsx
-import {interpolate} from 'remotion';
-
-export const MyComp: React.FC = () => {
- const frame = useCurrentFrame();
- const value = interpolate(frame, [0, 100], [0, 1], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- });
- return (
- <div>
- Frame {frame}: {value}
- </div>
- );
-};
-```
-
-The "interpolate()" function accepts a number and two arrays of numbers.
-The first argument is the value to animate.
-The first array is the input range, the second array is the output range.
-The fourth argument is optional but code should add "extrapolateLeft: 'clamp'" and "extrapolateRight: 'clamp'" by default.
-The function returns a number between the first and second array.
-
-If the "fps", "durationInFrames", "height" or "width" of the composition are required, the "useVideoConfig()" hook from "remotion" should be used.
-
-```tsx
-import {useVideoConfig} from 'remotion';
-
-export const MyComp: React.FC = () => {
- const {fps, durationInFrames, height, width} = useVideoConfig();
- return (
- <div>
- fps: {fps}
- durationInFrames: {durationInFrames}
- height: {height}
- width: {width}
- </div>
- );
-};
-```
-
-Remotion includes a "spring()" helper for spring-based motion. By default it animates from 0 to 1; the duration is not fixed in advance.
-
-```tsx
-import {spring} from 'remotion';
-
-export const MyComp: React.FC = () => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
-
- const value = spring({
- fps,
- frame,
- config: {
- damping: 200,
- },
- });
- return (
- <div>
- Frame {frame}: {value}
- </div>
- );
-};
-```
-
-## Rendering
-
-To render a video, the CLI command "npx remotion render [id]" can be used.
-The composition "id" should be passed, for example:
-
-$ npx remotion render MyComp
-
-To render a still image, the CLI command "npx remotion still [id]" can be used.
-For example:
-
-$ npx remotion still MyComp
-
-## Rendering on Lambda
-
-Videos can be rendered in the cloud using AWS Lambda.
-The setup described under https://www.remotion.dev/docs/lambda/setup must be completed.
-
-Rendering requires a Lambda function and a site deployed on S3.
-
-If the user is using the CLI:
-
-- A Lambda function can be deployed using `npx remotion lambda functions deploy`: https://www.remotion.dev/docs/lambda/cli/functions/deploy
-- A site can be deployed using `npx remotion lambda sites create`: https://www.remotion.dev/docs/lambda/cli/sites/create. The entry point may be passed as the first argument; otherwise it is determined automatically.
-- A video can be rendered using `npx remotion lambda render [comp-id]`. The composition ID must be referenced.
-
-If the user is using the Node.js APIs:
-
-- A Lambda function can be deployed using `deployFunction()`: https://www.remotion.dev/docs/lambda/deployfunction
-- A site can be built using `bundle()` and deployed using `deploySiteFromBundle()`: https://www.remotion.dev/docs/bundle and https://www.remotion.dev/docs/lambda/deploysitefrombundle
-- A video can be rendered using `renderMediaOnLambda()`: https://www.remotion.dev/docs/lambda/rendermediaonlambda.
-- If a video is rendered, the progress must be polled using `getRenderProgress()`: https://www.remotion.dev/docs/lambda/getrenderprogress
+- [Building with Remotion and AI](https://www.remotion.dev/docs/ai/index.md)
+- [Prompting videos with coding agents](https://www.remotion.dev/docs/ai/coding-agents.md)
diff --git a/packages/docs/src/helpers/system-prompt.ts b/packages/docs/static/system-prompt.txt
similarity index 85%
rename from packages/docs/src/helpers/system-prompt.ts
rename to packages/docs/static/system-prompt.txt
index 42a577a6c7..97142bba19 100644
--- a/packages/docs/src/helpers/system-prompt.ts
+++ b/packages/docs/static/system-prompt.txt
@@ -1,6 +1,3 @@
-// Auto-generated by bun update-prompt.ts
-
-export const SYSTEM_PROMPT = `
# About Remotion
Remotion is a framework that can create videos programmatically.
@@ -12,16 +9,16 @@ A Remotion Project consists of an entry file, a Root file and any number of Reac
A project can be scaffolded using the "npx create-video --yes --blank my-video" command.
The entry file is usually named "src/index.ts" and looks like this:
-\`\`\`ts
+```ts
import {registerRoot} from 'remotion';
import {Root} from './Root';
registerRoot(Root);
-\`\`\`
+```
The Root file is usually named "src/Root.tsx" and looks like this:
-\`\`\`tsx
+```tsx
import {Composition} from 'remotion';
import {MyComp} from './MyComp';
@@ -40,9 +37,9 @@ export const Root: React.FC = () => {
</>
);
};
-\`\`\`
+```
-A \`<Composition>\` defines a video that can be rendered. It consists of a React "component", an "id", a "durationInFrames", a "width", a "height" and a frame rate "fps".
+A `<Composition>` defines a video that can be rendered. It consists of a React "component", an "id", a "durationInFrames", a "width", a "height" and a frame rate "fps".
The default frame rate should be 30.
The default height should be 1080 and the default width should be 1920.
The default "id" should be "MyComp".
@@ -51,12 +48,12 @@ The "defaultProps" must be in the shape of the React props the "component" expec
Inside a React "component", one can use the "useCurrentFrame()" hook to get the current frame number.
Frame numbers start at 0.
-\`\`\`tsx
+```tsx
export const MyComp: React.FC = () => {
const frame = useCurrentFrame();
return <div>Frame {frame}</div>;
};
-\`\`\`
+```
# Component Rules
@@ -66,7 +63,7 @@ Those special tags accept regular CSS styles.
If a video is included in the component it should use the "<Video>" tag.
-\`\`\`tsx
+```tsx
import {Video} from '@remotion/media';
export const MyComp: React.FC = () => {
@@ -79,7 +76,7 @@ export const MyComp: React.FC = () => {
</div>
);
};
-\`\`\`
+```
Video has a "trimBefore" prop that trims the left side of a video by a number of frames.
Video has a "trimAfter" prop that limits how long a video is shown.
@@ -87,17 +84,17 @@ Video has a "volume" prop that sets the volume of the video. It accepts values b
If an non-animated image is included In the component it should use the "<Img>" tag.
-\`\`\`tsx
+```tsx
import {Img} from 'remotion';
export const MyComp: React.FC = () => {
return <Img src="https://remotion.dev/logo.png" style={{width: '100%'}} />;
};
-\`\`\`
+```
If an animated GIF is included, the "@remotion/gif" package should be installed and the "<Gif>" tag should be used.
-\`\`\`tsx
+```tsx
import {Gif} from '@remotion/gif';
export const MyComp: React.FC = () => {
@@ -108,29 +105,29 @@ export const MyComp: React.FC = () => {
/>
);
};
-\`\`\`
+```
If audio is included, the "<Audio>" tag should be used.
-\`\`\`tsx
+```tsx
import {Audio} from '@remotion/media';
export const MyComp: React.FC = () => {
return <Audio src="https://remotion.dev/audio.mp3" />;
};
-\`\`\`
+```
Asset sources can be specified as either a Remote URL or an asset that is referenced from the "public/" folder of the project.
If an asset is referenced from the "public/" folder, it should be specified using the "staticFile" API from Remotion
-\`\`\`tsx
+```tsx
import {staticFile} from 'remotion';
import {Audio} from '@remotion/media';
export const MyComp: React.FC = () => {
return <Audio src={staticFile('audio.mp3')} />;
};
-\`\`\`
+```
Audio has a "trimBefore" prop that trims the left side of a audio by a number of frames.
Audio has a "trimAfter" prop that limits how long a audio is shown.
@@ -138,7 +135,7 @@ Audio has a "volume" prop that sets the volume of the audio. It accepts values b
If two elements should be rendered on top of each other, they should be layered using the "AbsoluteFill" component from "remotion".
-\`\`\`tsx
+```tsx
import {AbsoluteFill} from 'remotion';
export const MyComp: React.FC = () => {
@@ -153,11 +150,11 @@ export const MyComp: React.FC = () => {
</AbsoluteFill>
);
};
-\`\`\`
+```
Components such as "Interactive", "AbsoluteFill", "Audio" and "Video" accept timing props that place them later in the video.
-\`\`\`tsx
+```tsx
import {Interactive} from 'remotion';
export const MyComp: React.FC = () => {
@@ -167,7 +164,7 @@ export const MyComp: React.FC = () => {
</Interactive.Div>
);
};
-\`\`\`
+```
The "from" prop specifies the frame number where the element should appear.
The "trimBefore" prop trims the start of the component timeline by a number of frames.
@@ -176,7 +173,7 @@ The "durationInFrames" prop specifies how long the element should appear.
If a child of a timed component calls "useCurrentFrame()", the enumeration starts from the first frame the parent appears and starts at "trimBefore".
-\`\`\`tsx
+```tsx
import {AbsoluteFill} from 'remotion';
export const Child: React.FC = () => {
@@ -192,11 +189,11 @@ export const MyComp: React.FC = () => {
</AbsoluteFill>
);
};
-\`\`\`
+```
For displaying multiple elements after another, the "Series" component from "remotion" can be used.
-\`\`\`tsx
+```tsx
import {Series} from 'remotion';
export const MyComp: React.FC = () => {
@@ -214,14 +211,14 @@ export const MyComp: React.FC = () => {
</Series>
);
};
-\`\`\`
+```
The "Series.Sequence" component works like "Sequence", but has no "from" prop.
Instead, it has a "offset" prop shifts the start by a number of frames.
For displaying multiple elements after another another and having a transition inbetween, the "TransitionSeries" component from "@remotion/transitions" can be used.
-\`\`\`tsx
+```tsx
import {
linearTiming,
springTiming,
@@ -254,7 +251,7 @@ export const MyComp: React.FC = () => {
</TransitionSeries>
);
};
-\`\`\`
+```
"TransitionSeries.Sequence" works like "Series.Sequence" but has no "offset" prop.
The order of tags is important, "TransitionSeries.Transition" must be inbetween "TransitionSeries.Sequence" tags.
@@ -263,17 +260,17 @@ Remotion needs all of the React code to be deterministic. Therefore, it is forbi
If randomness is requested, the "random()" function from "remotion" should be used and a static seed should be passed to it.
The random function returns a number between 0 and 1.
-\`\`\`tsx twoslash
+```tsx twoslash
import {random} from 'remotion';
export const MyComp: React.FC = () => {
return <div>Random number: {random('my-seed')}</div>;
};
-\`\`\`
+```
Remotion includes an interpolate() helper that can animate values over time.
-\`\`\`tsx
+```tsx
import {interpolate} from 'remotion';
export const MyComp: React.FC = () => {
@@ -288,7 +285,7 @@ export const MyComp: React.FC = () => {
</div>
);
};
-\`\`\`
+```
The "interpolate()" function accepts a number and two arrays of numbers.
The first argument is the value to animate.
@@ -298,7 +295,7 @@ The function returns a number between the first and second array.
If the "fps", "durationInFrames", "height" or "width" of the composition are required, the "useVideoConfig()" hook from "remotion" should be used.
-\`\`\`tsx
+```tsx
import {useVideoConfig} from 'remotion';
export const MyComp: React.FC = () => {
@@ -312,11 +309,11 @@ export const MyComp: React.FC = () => {
</div>
);
};
-\`\`\`
+```
Remotion includes a "spring()" helper for spring-based motion. By default it animates from 0 to 1; the duration is not fixed in advance.
-\`\`\`tsx
+```tsx
import {spring} from 'remotion';
export const MyComp: React.FC = () => {
@@ -336,7 +333,7 @@ export const MyComp: React.FC = () => {
</div>
);
};
-\`\`\`
+```
## Rendering
@@ -359,14 +356,13 @@ Rendering requires a Lambda function and a site deployed on S3.
If the user is using the CLI:
-- A Lambda function can be deployed using \`npx remotion lambda functions deploy\`: https://www.remotion.dev/docs/lambda/cli/functions/deploy
-- A site can be deployed using \`npx remotion lambda sites create\`: https://www.remotion.dev/docs/lambda/cli/sites/create. The entry point may be passed as the first argument; otherwise it is determined automatically.
-- A video can be rendered using \`npx remotion lambda render [comp-id]\`. The composition ID must be referenced.
+- A Lambda function can be deployed using `npx remotion lambda functions deploy`: https://www.remotion.dev/docs/lambda/cli/functions/deploy
+- A site can be deployed using `npx remotion lambda sites create`: https://www.remotion.dev/docs/lambda/cli/sites/create. The entry point may be passed as the first argument; otherwise it is determined automatically.
+- A video can be rendered using `npx remotion lambda render [comp-id]`. The composition ID must be referenced.
If the user is using the Node.js APIs:
-- A Lambda function can be deployed using \`deployFunction()\`: https://www.remotion.dev/docs/lambda/deployfunction
-- A site can be built using \`bundle()\` and deployed using \`deploySiteFromBundle()\`: https://www.remotion.dev/docs/bundle and https://www.remotion.dev/docs/lambda/deploysitefrombundle
-- A video can be rendered using \`renderMediaOnLambda()\`: https://www.remotion.dev/docs/lambda/rendermediaonlambda.
-- If a video is rendered, the progress must be polled using \`getRenderProgress()\`: https://www.remotion.dev/docs/lambda/getrenderprogress
-`.trimStart();
+- A Lambda function can be deployed using `deployFunction()`: https://www.remotion.dev/docs/lambda/deployfunction
+- A site can be built using `bundle()` and deployed using `deploySiteFromBundle()`: https://www.remotion.dev/docs/bundle and https://www.remotion.dev/docs/lambda/deploysitefrombundle
+- A video can be rendered using `renderMediaOnLambda()`: https://www.remotion.dev/docs/lambda/rendermediaonlambda.
+- If a video is rendered, the progress must be polled using `getRenderProgress()`: https://www.remotion.dev/docs/lambda/getrenderprogress
diff --git a/packages/docs/update-prompt.ts b/packages/docs/update-prompt.ts
deleted file mode 100644
index 56101e97b4..0000000000
--- a/packages/docs/update-prompt.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import path from 'path';
-
-// @ts-expect-error
-const source = await Bun.file(
- path.join(__dirname, 'static', 'llms.txt'),
-).text();
-
-const output = Bun.file(
- path.join(__dirname, 'src', 'helpers', 'system-prompt.ts'),
-);
-
-const escapedSource = source
- .replaceAll('\\', '\\\\')
- .replaceAll('`', '\\`')
- .replaceAll('${', '\\${');
-
-const tsText =
- [
- '// Auto-generated by bun update-prompt.ts',
- '',
- 'export const SYSTEM_PROMPT = `',
- ].join('\n') +
- '\n' +
- escapedSource +
- '`.trimStart();\n';
-
-// @ts-expect-error
-await Bun.write(output, tsText);
diff --git a/packages/docs/vercel.ts b/packages/docs/vercel.ts
index 3bed690c39..33644cbb36 100644
--- a/packages/docs/vercel.ts
+++ b/packages/docs/vercel.ts
@@ -367,7 +367,10 @@ export const config: VercelConfig = {
routes.redirect('/editor-starter', '/docs/editor-starter', {
permanent: false,
}),
- routes.redirect('/docs/system-prompt', '/docs/ai/system-prompt', {
+ routes.redirect('/docs/system-prompt', '/system-prompt.txt', {
+ permanent: false,
+ }),
+ routes.redirect('/docs/ai/system-prompt', '/system-prompt.txt', {
permanent: false,
}),
routes.redirect('/media-parser/', '/docs/media-parser', {
@@ -440,7 +443,7 @@ export const config: VercelConfig = {
routes.redirect('/docs/miscellaneous/vercel', '/docs/vercel', {
permanent: false,
}),
- routes.redirect('/system-prompt', '/docs/ai/system-prompt', {
+ routes.redirect('/system-prompt', '/system-prompt.txt', {
permanent: false,
}),
routes.redirect('/investors', '/docs/investors', {permanent: false}),