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
bash
bash
bash
bash
bash
bash
- If you'd like to embed a Remotion video in your existing React app, install @remotion/playeras well.
- If you'd like to render a video using the Node.JS APIs, install @remotion/rendereras well.
- If you'd like to trigger a render on Remotion Lambda, install @remotion/lambdaas 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.tsxtsxMyComposition = () => {return null;};
remotion/Composition.tsxtsxMyComposition = () => {return null;};
remotion/Root.tsxtsxReact 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.tsxtsxReact 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.tstsregisterRoot } from "remotion";import {RemotionRoot } from "./Root";registerRoot (RemotionRoot );
remotion/index.tstsregisterRoot } from "remotion";import {RemotionRoot } from "./Root";registerRoot (RemotionRoot );
The file that calls registerRoot() is now your Remotion entrypoint.
Starting the preview
Start the preview server using the following command:
Replace remotion/index.ts with your entrypoint if necessary.
Render a video
Render our a video using
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
bash
bash
bash
bash
bash
This snippet will enable the recommended rules only for the Remotion files:
.eslintrcjson
.eslintrcjson
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.