packages/docs/docs/lambda/downloadmedia.mdx
Downloads a rendered video, audio or still 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: ${totalSize}/${downloaded} bytes (${(percent * 100).toFixed(0)}%)`);
},
});
console.log(outputPath); // "/Users/yourname/remotion-project/out.mp4"
console.log(sizeInBytes); // 21249541
An object with the following properties:
regionThe AWS region in which the render has performed.
bucketNameThe bucket name in which the render was stored. This should be the same variable you used for renderMediaOnLambda() or renderStillOnLambda().
renderIdThe ID of the render. You can retrieve this ID by calling renderMediaOnLambda() or renderStillOnLambda().
outPathWhere the video should be saved. Pass an absolute path, or it will be resolved relative to your current working directory.
onProgress?Callback function that gets called with the following properties:
totalSize in bytesdownloaded number of bytes downloadedpercent relative progress between 0 and 1customCredentials?<AvailableFrom v="3.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().
signal?<AvailableFrom v="4.0.406" />An AbortSignal that allows the download to be cancelled.
Returns a promise resolving to an object with the following properties:
outputPathThe absolute path of where the file got saved.
sizeInBytesThe size of the file in bytes.