Installing Remotion in an existing project
Remotion can be installed into existing projects, such as Next.JS, Remix, Vite or Create React App, as well as server-only projects that run on Node.JS. Get started by adding the following packages:
- npm
- yarn
- pnpm
- bun
npm i --save-exact remotion@4.0.230 @remotion/cli@4.0.230
npm i --save-exact remotion@4.0.230 @remotion/cli@4.0.230
pnpm i remotion@4.0.230 @remotion/cli@4.0.230
pnpm i remotion@4.0.230 @remotion/cli@4.0.230
bun i remotion@4.0.230 @remotion/cli@4.0.230
bun i remotion@4.0.230 @remotion/cli@4.0.230
yarn --exact add remotion@4.0.230 @remotion/cli@4.0.230
yarn --exact add remotion@4.0.230 @remotion/cli@4.0.230
Also update
remotion
and all `@remotion/*`
packages to the same version.Remove all
^
character in front of the version numbers of it as it can lead to a version conflict.- If you'd like to embed a Remotion video in your existing React app, install
@remotion/player
as well. - If you'd like to render a video using the Node.JS APIs, install
@remotion/renderer
as well. - If you'd like to trigger a render on Remotion Lambda, install
@remotion/lambda
as well.
Setting up the folder structure
Create a new folder for the Remotion files. It can be anywhere and assume any name, in this example we name it remotion
and put it in the root of our project. Inside the folder you created, create 3 files:
remotion/Composition.tsxtsx
export constMyComposition = () => {return null;};
remotion/Composition.tsxtsx
export constMyComposition = () => {return null;};
remotion/Root.tsxtsx
importReact from 'react';import {Composition } from 'remotion';import {MyComposition } from './Composition';export constRemotionRoot :React .FC = () => {return (<><Composition id ="Empty"component ={MyComposition }durationInFrames ={60}fps ={30}width ={1280}height ={720}/></>);};
remotion/Root.tsxtsx
importReact from 'react';import {Composition } from 'remotion';import {MyComposition } from './Composition';export constRemotionRoot :React .FC = () => {return (<><Composition id ="Empty"component ={MyComposition }durationInFrames ={60}fps ={30}width ={1280}height ={720}/></>);};
remotion/index.tsts
import {registerRoot } from "remotion";import {RemotionRoot } from "./Root";registerRoot (RemotionRoot );
remotion/index.tsts
import {registerRoot } from "remotion";import {RemotionRoot } from "./Root";registerRoot (RemotionRoot );
The file that calls registerRoot()
is now your Remotion entry point.
Watch out for import aliases in your tsconfig.json
that will resolve import {...} from "remotion"
to the remotion
folder. We recommend to not use paths
without a prefix.
Starting the Studio
Start the Remotion Studio using the following command:
npx remotion studio remotion/index.ts
npx remotion studio remotion/index.ts
Replace remotion/index.ts
with your entrypoint if necessary.
Render a video
Render our a video using
npx remotion render remotion/index.ts MyComp out.mp4
npx remotion render remotion/index.ts MyComp out.mp4
Replace the entrypoint, composition name and output filename with the values that correspond to your usecase.
Install the ESLint Plugin
Remotion has an ESLint plugin that warns about improper usage of Remotion APIs. To add it to your existing project, install it:
- npm
- yarn
- pnpm
bash
npm i @remotion/eslint-plugin
bash
npm i @remotion/eslint-plugin
bash
yarn add @remotion/eslint-plugin
bash
yarn add @remotion/eslint-plugin
bash
pnpm i @remotion/eslint-plugin
bash
pnpm i @remotion/eslint-plugin
This snippet will enable the recommended rules only for the Remotion files:
.eslintrcjson
{"plugins": ["@remotion"],"overrides": [{"files": ["remotion/*.{ts,tsx}"],"extends": ["plugin:@remotion/recommended"]}]}
.eslintrcjson
{"plugins": ["@remotion"],"overrides": [{"files": ["remotion/*.{ts,tsx}"],"extends": ["plugin:@remotion/recommended"]}]}
Embed a Remotion video into your React app
You can use the <Player>
component to display a Remotion video in your React project. Read the separate page about it for instructions.