npm package: @rendermotion/sdk
Description: Rendermotion official SDK
Latest version: 0.1.0-beta.6

# Rendermotion Official SDK

This is the official SDK for Rendermotion, a distributed cloud platform for rendering Remotion videos.

## Status: 🚧 Under Construction 🚧

We're hard at work building Rendermotion and this SDK.

>[!TIP]
Join the waitlist to get early access at [rendermotion.io](https://www.rendermotion.io).

## About Rendermotion

Rendermotion is a revolutionary platform that allows you to render Remotion videos in the cloud, leveraging the power of distributed computing. This means faster rendering times, increased scalability, and reduced costs for your video production workflows.

## Features

- Easy integration: Seamlessly connect your Remotion projects to Rendermotion.
- Fast rendering: Distribute rendering across multiple machines for blazing-fast results.
- Scalable infrastructure: Handle any size project, from small marketing videos to large-scale animation renders.
- Cost-effective: Pay only for the rendering resources you use. Much cheaper than Remotion Lambda.
- API access: Control and monitor your renders programmatically.

## Stay connected

- [X] Website: [rendermotion.io](https://www.rendermotion.io)
- [X] Twitter: [@rendermotion_io](https://x.com/rendermotion_io)
- [X] Discord: [Rendermotion](https://discord.com/invite/Ujb63p4qPV)
- [X] Email: [hi@rendermotion.io](mailto:hi@rendermotion.io)

## Requirements

- Node.js >= 20.0.0 or Bun >= 1.0.0
- Remotion >= 4.0.200

## Installation

```bash
# npm
npm install @rendermotion/sdk

# yarn
yarn add @rendermotion/sdk

# pnpm
pnpm add @rendermotion/sdk

# bun
bun add @rendermotion/sdk
```

## Usage

### Deploying your Remotion project
It will return a `serveUrl` that you can use to render your video.

You only need to run this once (initially) and everytime you make changes
to your Remotion composition or upgrade your Remotion version.

```ts
import { deploySite } from "@rendermotion/sdk/deploy-site";

const { serveUrl } = await client.deploySite({
  entryPoint: "your/remotion/entry/point/index.ts",
  siteName: "YOUR_SITE_NAME",
  apiKey: "YOUR_API_KEY",
});
```

### Triggering a render
For each video you want to render, you simply need to call the `renderMedia` method from the client.
You can use the `serveUrl` from the `deploySite` method or your own custom URL.

```ts
import { createClient } from "@rendermotion/sdk";

// 1. Create a client with your API key.
const client = createClient("YOUR_API_KEY");

// 2. Render your video.
const { renderJob } = await client.renderMedia({
  // The serve URL to your Remotion project.
  // If you have a deployed site on Lambda or anywhere else, you can use that URL instead.
  serveUrl,

  // The composition ID to render.
  compositionId: "YourCompositionId",

  // Your composition input props.
  inputProps: {},

  // (optional) We'll call this URL when the render is complete if provided.
  webhookUrl: "https://your-webhook-url.com",

  // (optional) Settings for your render.
  settings: {
    codec: "h265",
  }
});

// 3. Get the render job details.
const {
  status, // "pending", "rendering", "completed", "failed"
  progress, // 0-100
  downloadUrl // If status is "completed", this will be the URL to download your video.
} = await client.getRenderJob({ renderJobId: renderJob.id });
```