Chapter 458: downloadMedia()
Core Idea
Downloads a rendered video, audio or still to the disk of the machine this API is called from.
Key Concepts
- Arguments
- region
- bucketName
- renderId
- outPath
- onProgress?
- customCredentials?<AvailableFrom v="3.2.23" />
- signal?<AvailableFrom v="4.0.406" />
Code Examples
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
- What it demonstrates: Usage pattern for downloadMedia() from the official docs.
Key Takeaways
- Understand arguments when working with downloadMedia().
- Understand region when working with downloadMedia().
- Understand bucketname when working with downloadMedia().
- Understand renderid when working with downloadMedia().
- Understand outpath when working with downloadMedia().
Connects To
- api: related page in the Lambda (@remotion/lambda) section.
- Approuterwebhook: related page in the Lambda (@remotion/lambda) section.
- Authentication: related page in the Lambda (@remotion/lambda) section.