downloadMedia()
Downloads a rendered video, audio, still, or image sequence to the disk of the machine this API is called from.
If you want to let the user download a result to their machine, use renderMediaOnLambda() -> downloadBehavior instead.
import {downloadMedia } from '@remotion/lambda';
const {outputPath , sizeInBytes } = await downloadMedia ({
bucketName : 'remotionlambda-r42fs9fk',
region : 'us-east-1',
renderId : '8hfxlw',
outPath : 'out.mp4',
onProgress : ({totalSize , downloaded , percent }) => {
console .log (`Download progress: ${downloaded }/${totalSize } bytes (${(percent * 100).toFixed (0)}%)`);
},
});
console .log (outputPath ); // "/Users/yourname/remotion-project/out.mp4"
console .log (sizeInBytes ); // 21249541Arguments
An object with the following properties:
region
The AWS region in which the render has performed.
bucketName
The bucket name in which the render was stored. This should be the same variable you used for renderMediaOnLambda() or renderStillOnLambda().
renderId
The ID of the render. You can retrieve this ID by calling renderMediaOnLambda() or renderStillOnLambda().
outPath
Where to save the output. Pass a directory for image sequences. Relative paths resolve from your current working directory.
output?v4.0.535
Select the output to download: "main" (the default) or "separate-audio" for a render started with separateAudioTo. Selecting separate audio for a render without that output throws an error.
onProgress?
Callback function that gets called with the following properties:
totalSize
The total size in bytes.
downloaded
The number of bytes downloaded.
percent
The relative progress between 0 and 1.
customCredentials?v3.2.23
If the render was saved to a different cloud, pass an object with the same endpoint, accessKeyId and secretAccessKey as you passed to renderMediaOnLambda() or renderStillOnLambda().
When downloading "separate-audio", pass the credentials for its destination.
signal?v4.0.406
An AbortSignal that allows the download to be cancelled.
logLevel?
One of trace, verbose, info, warn, error.Determines how much info is being logged to the console.
Default
info.
forcePathStyle?v4.0.202
Passes forcePathStyle to the AWS S3 client.
requestHandler?v4.0.315
A custom AWS SDK request handler, for example to use a proxy.
Return value
Returns a promise resolving to an object with the following properties:
outputPath
The absolute path of where the file got saved.
sizeInBytes
The size of the file in bytes.
Compatibility
| Servers | Environments | |||||
|---|---|---|---|---|---|---|
Node.js | Bun | Serverless Functions | ||||