packages/docs/docs/vercel/render-media-on-vercel.mdx
:::warning Experimental package: We reserve the right to make breaking changes in order to correct bad design decisions until this notice is gone. :::
Renders a video inside a Vercel Sandbox.
The rendered file stays inside the sandbox. Use uploadToVercelBlob() to upload it to Vercel Blob.
Set detached: true to return immediately and poll the render with getRenderProgress().
// @module: es2022
// @target: es2022
import {renderMediaOnVercel, addBundleToSandbox, createSandbox} from '@remotion/vercel';
const sandbox = await createSandbox();
// ---cut---
const {sandboxFilePath} = await renderMediaOnVercel({
sandbox,
compositionId: 'MyComp',
inputProps: {title: 'Hello World'},
onProgress: async (update) => {
console.log(`Overall: ${Math.round(update.overallProgress * 100)}%`);
if (update.stage === 'render-progress') {
console.log(`Rendering: ${Math.round(update.progress.progress * 100)}%`);
}
},
});
// @module: es2022
// @target: es2022
import {renderMediaOnVercel, createSandbox} from '@remotion/vercel';
const sandbox = await createSandbox();
// ---cut---
const {sandboxId, cmdId} = await renderMediaOnVercel({
sandbox,
compositionId: 'MyComp',
inputProps: {title: 'Hello World'},
detached: true,
vercelBlob: {
blobToken: process.env.BLOB_READ_WRITE_TOKEN!,
access: 'public',
},
});
An object with the following properties:
sandboxA Sandbox instance.
compositionIdThe ID of the Remotion composition to render.
inputPropsProps to pass to the composition.
codec?string <TsType type="Codec" source="@remotion/renderer" href="/docs/renderer/types#codec" />
Choose a suitable codec for your output media. Refer to the Encoding guide to find the best codec for your use case. Default: "h264".
outputFile?The output file path inside the sandbox. Default: "/tmp/video.mp4".
detached?<AvailableFrom v="4.0.469" />When set to true, starts the render and returns {sandboxId, cmdId, outputFile} without waiting for it to finish.
Use getRenderProgress() to poll the returned IDs.
vercelBlob?<AvailableFrom v="4.0.469" />Uploads the rendered video from inside the sandbox to Vercel Blob.
This option is only available when detached: true, and required in that mode because the route that started the render returns before the video exists.
detachedSandboxTimeoutInMilliseconds?<AvailableFrom v="4.0.469" />Extends the sandbox lifetime before returning from a detached render. Default: 1800000 (30 minutes).
crf?imageFormat?pixelFormat?envVariables?Record<string, string>
An object containing environment variables to be injected in your project.
frameRange?number | [number, number] | [number, null] <TsType type="FrameRange" source="@remotion/renderer" href="/docs/renderer/types#framerange" />
Specify a single frame (passing a number) or a range of frames (passing a tuple [number, number]) to be rendered. By passing null (default) all frames of a composition get rendered.
everyNthFrame?proResProfile?chromiumOptions?Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
scale?preferLossless?enforceAudioTrack?disallowParallelEncoding?concurrency?metadata?logLevel?timeoutInMilliseconds?videoBitrate?audioBitrate?audioCodec?encodingMaxRate?encodingBufferSize?muted?numberOfGifLoops?x264Preset?gopSize?<AvailableFrom v="4.0.466" />colorSpace?jpegQuality?forSeamlessAacConcatenation?separateAudioTo?hardwareAcceleration?offthreadVideoCacheSizeInBytes?mediaCacheSizeInBytes?offthreadVideoThreads?licenseKey?onProgress?function <TsType type="RenderMediaOnVercelProgress" source="@remotion/vercel" href="/docs/vercel/types#rendermediaonvercelprogress" />
A callback that receives progress updates. Every variant includes overallProgress (0–1).
import type {RenderMediaOnVercelProgress} from '@remotion/vercel';
// ---cut---
const onProgress = async (update: RenderMediaOnVercelProgress) => {
console.log(`Overall: ${Math.round(update.overallProgress * 100)}%`);
if (update.stage === 'render-progress') {
console.log(`Rendering: ${Math.round(update.progress.progress * 100)}%`);
}
};
When detached is unset or false, an object containing:
sandboxFilePathThe path to the rendered video inside the sandbox.
contentTypeThe MIME type of the rendered output (e.g. "video/mp4", "video/webm", "image/gif").
When detached is true, an object containing:
sandboxIdThe ID of the sandbox that is rendering the video.
cmdIdThe ID of the command that is rendering the video.
outputFileThe path to the rendered video inside the sandbox.