Capítulo 458 de 988

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

  1. Understand arguments when working with downloadMedia().
  2. Understand region when working with downloadMedia().
  3. Understand bucketname when working with downloadMedia().
  4. Understand renderid when working with downloadMedia().
  5. 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.