🎥 Make videos programmatically with React
documentation
umungobungofe9d35c57b2b
diff --git a/packages/create-video/src/templates.ts b/packages/create-video/src/templates.tsindex 9d18c0e214..f2fb56fbc3 100644--- a/packages/create-video/src/templates.ts+++ b/packages/create-video/src/templates.ts@@ -45,7 +45,8 @@ export type Template = {| 'code-hike'| 'render-server'| 'recorder'- | 'prompt-to-motion-graphics';+ | 'prompt-to-motion-graphics'+ | 'vercel';defaultBranch: string;featuredOnHomePage: string | null;previewURL: string | null;@@ -578,6 +579,29 @@ export const FEATURED_TEMPLATES: Template[] = [contributedBy: null,showStackblitz: true,},+ {+ homePageLabel: 'Vercel Sandbox',+ shortName: 'Vercel Sandbox',+ org: 'remotion-dev',+ repoName: 'template-vercel',+ description: 'Render videos on-demand using Vercel Sandbox',+ longerDescription:+ 'A template for rendering videos on-demand using Vercel Sandbox. Spawns ephemeral Linux VMs to render videos and stores them in Vercel Blob storage.',+ cliId: 'vercel' as const,+ promoBanner: {+ width: 655,+ height: 720,+ src: '/img/vercel-sandbox-template.png',+ },+ type: 'image' as const,+ defaultBranch: 'main',+ featuredOnHomePage: null,+ previewURL: null,+ templateInMonorepo: 'template-vercel',+ allowEnableTailwind: false,+ contributedBy: null,+ showStackblitz: false,+ },].filter(truthy);export const PAID_TEMPLATES = [diff --git a/packages/docs/docs/miscellaneous/vercel.mdx b/packages/docs/docs/miscellaneous/vercel.mdxindex 1613583475..844611c0e7 100644--- a/packages/docs/docs/miscellaneous/vercel.mdx+++ b/packages/docs/docs/miscellaneous/vercel.mdx@@ -27,6 +27,56 @@ Config.setExperimentalClientSideRenderingEnabled(true);This will make it possible to render videos client-side on your Vercel deployment.+## Rendering with Vercel Sandbox++Vercel Sandbox allows you to render videos on-demand without managing Lambda or AWS infrastructure. Each render spawns an ephemeral Linux VM with full access to the Remotion renderer.++### How it works++1. User triggers a render from your application+2. A Vercel Sandbox VM is spawned with Node.js+3. The VM runs `renderMedia()` pointing to your deployed bundle+4. Progress is streamed to the client via Server-Sent Events+5. Completed video is uploaded to Vercel Blob storage+6. Client receives the video URL++### Getting Started++Use the Vercel template:++```bash+npx create-video@latest --template vercel+```++### Required Setup++1. **Deploy your Remotion bundle:**++ ```bash+ npx remotion bundle+ cd build && vercel deploy+ ```++2. **Create a Vercel Blob store** in your Vercel dashboard under Storage++3. **Set environment variables:**+ - `REMOTION_SERVE_URL`: URL of your deployed bundle+ - `BLOB_READ_WRITE_TOKEN`: Token from your Vercel Blob store (auto-injected when deployed to same project)++4. **(Optional) Create a sandbox snapshot** for faster renders:+ ```bash+ pnpm run create-snapshot+ ```+ Then set `SANDBOX_SNAPSHOT_ID` with the returned ID.++### Limitations++- **Longer cold starts**: Sandbox VMs take a few seconds to start (mitigated with snapshots)+- **Single machine**: No distributed rendering (unlike Lambda)+- **Timeout limits**: 45 min (Hobby), 5 hours (Pro & Enterprise)++See the [template source code](https://github.com/remotion-dev/remotion/tree/main/packages/template-vercel) for implementation details.+## Triggering Lambda renders from Vercel Serverless functionsYou can trigger [Remotion Lambda renders](/docs/lambda) from Vercel Serverless functions.@@ -100,14 +150,13 @@ npx remotion render https://remotion-helloworld.vercel.app HelloWorldIt is currently not possible to render videos or stills on Vercel Serverless functions due to the 50MB maximum function size. Since Chromium is a dependency of Remotion, it alone almost entirely fills the quota available.-We recommend you to resort to client-side rendering or Remotion Lambda.--## Next.js Templates+We recommend using [Vercel Sandbox](#rendering-with-vercel-sandbox), client-side rendering, or Remotion Lambda instead.-We currently offer 3 Next.js templates:+## Templates- [Next.js (App dir)](/templates/next)- [Next.js (App dir + TailwindCSS)](/templates/next-tailwind)- [Next.js (Pages router)](/templates/next-pages-dir)+- [Vercel Sandbox Rendering](/templates/vercel)These templates are recommended for building applications that can generate videos.diff --git a/packages/docs/docs/ssr.mdx b/packages/docs/docs/ssr.mdxindex f0f7efca12..a1b9f2f387 100644--- a/packages/docs/docs/ssr.mdx+++ b/packages/docs/docs/ssr.mdx@@ -102,6 +102,18 @@ See: [Dockerizing a Remotion project](/docs/docker)Check out the experimental [Cloud Run](/docs/cloudrun) package.Note: It not actively being developed - our plan is to port the Lambda runtime to Cloud Run instead of maintaining a separate implementation.+## Render using Vercel Sandbox++You can render videos on-demand using [Vercel Sandbox](https://vercel.com/docs/sandbox). This spawns an ephemeral Linux VM that renders your video and stores it in Vercel Blob storage.++Use the Vercel template to get started:++```bash+npx create-video@latest --template vercel+```++See the [Vercel documentation](/docs/miscellaneous/vercel#rendering-with-vercel-sandbox) for detailed setup instructions.+## API reference<TableOfContents />diff --git a/packages/docs/static/img/vercel-sandbox-template.png b/packages/docs/static/img/vercel-sandbox-template.pngnew file mode 100644index 0000000000..74e9a9fcb5Binary files /dev/null and b/packages/docs/static/img/vercel-sandbox-template.png differ