Skip to content

🎥 Make videos programmatically with React

that polish

Jonny Burger678a92e9d10a
diff --git a/packages/docs/docs/lambda/custom-destination.md b/packages/docs/docs/lambda/custom-destination.md
index 4d42fe4634..9e89b17093 100644
--- a/packages/docs/docs/lambda/custom-destination.md
+++ b/packages/docs/docs/lambda/custom-destination.md
@@ -4,13 +4,13 @@ sidebar_label: Custom output destination
title: Customizing Lambda output destination
---
-By default a render artifact is saved into the S3 back under the key `renders/${renderId}/out.{extension}` (for example: `renders/hy0k2siao8/out.mp4`)
+By default a render artifact is saved into the same S3 bucket as where the site is located under the key `renders/${renderId}/out.{extension}` (for example: `renders/hy0k2siao8/out.mp4`)
You can modify the output destination by passing a different filename, writing it into a different bucket or even upload it to a different S3-compatible provider.
## Customizing the output name
-To customize the output filename, pass `outName: "my-filename.mp4"` to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda).
+To customize the output filename, pass `outName: "my-filename.mp4"` to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda#outname) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda#outname).
On the CLI, use the [`--out-name`](/docs/lambda/cli/render#--out-name) flag.
diff --git a/packages/docs/docs/lambda/getawsclient.md b/packages/docs/docs/lambda/getawsclient.md
index 6963a95c21..53671d12cf 100644
--- a/packages/docs/docs/lambda/getawsclient.md
+++ b/packages/docs/docs/lambda/getawsclient.md
@@ -78,7 +78,7 @@ One of `lambda`, `cloudwatch`, `iam`, `servicequotas` and `s3`.
_available from v3.2.23_
-Allows you to connect to another cloud provider, useful if you [render your output to a different cloud](/docs/lambda/custom-destination).
+Allows you to connect to another cloud provider, useful if you [render your output to a different cloud](/docs/lambda/custom-destination). The value must satisfy the following type:
```ts
type CustomCredentials = {
diff --git a/packages/lambda/src/api/download-media.ts b/packages/lambda/src/api/download-media.ts
index e9756b120d..b5225ed81f 100644
--- a/packages/lambda/src/api/download-media.ts
+++ b/packages/lambda/src/api/download-media.ts
@@ -5,7 +5,7 @@ import {getRenderMetadata} from '../functions/helpers/get-render-metadata';
import type {LambdaReadFileProgress} from '../functions/helpers/read-with-progress';
import {lambdaDownloadFileWithProgress} from '../functions/helpers/read-with-progress';
import type {AwsRegion} from '../pricing/aws-regions';
-import type {CustomS3Credentials} from '../shared/aws-clients';
+import type {CustomCredentials} from '../shared/aws-clients';
import {getAccountId} from '../shared/get-account-id';
export type DownloadMediaInput = {
@@ -14,7 +14,7 @@ export type DownloadMediaInput = {
renderId: string;
outPath: string;
onProgress?: LambdaReadFileProgress;
- customCredentials?: CustomS3Credentials;
+ customCredentials?: CustomCredentials;
};
export type DownloadMediaOutput = {
diff --git a/packages/lambda/src/api/get-aws-client.ts b/packages/lambda/src/api/get-aws-client.ts
index 030bf34546..c272b0e286 100644
--- a/packages/lambda/src/api/get-aws-client.ts
+++ b/packages/lambda/src/api/get-aws-client.ts
@@ -4,13 +4,13 @@ import * as LambdaSDK from '@aws-sdk/client-lambda';
import * as S3SDK from '@aws-sdk/client-s3';
import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
import type {AwsRegion} from '../client';
-import type {CustomS3Credentials, ServiceMapping} from '../shared/aws-clients';
+import type {CustomCredentials, ServiceMapping} from '../shared/aws-clients';
import {getServiceClient} from '../shared/aws-clients';
export type GetAwsClientInput<T extends keyof ServiceMapping> = {
region: AwsRegion;
service: T;
- customCredentials?: CustomS3Credentials | null;
+ customCredentials?: CustomCredentials | null;
};
type SdkMapping = {
diff --git a/packages/lambda/src/api/get-render-progress.ts b/packages/lambda/src/api/get-render-progress.ts
index b337f0742f..1f7b6df680 100644
--- a/packages/lambda/src/api/get-render-progress.ts
+++ b/packages/lambda/src/api/get-render-progress.ts
@@ -1,6 +1,6 @@
import {VERSION} from 'remotion/version';
import type {AwsRegion} from '../pricing/aws-regions';
-import type {CustomS3Credentials} from '../shared/aws-clients';
+import type {CustomCredentials} from '../shared/aws-clients';
import {callLambda} from '../shared/call-lambda';
import type {RenderProgress} from '../shared/constants';
import {LambdaRoutines} from '../shared/constants';
@@ -10,7 +10,7 @@ export type GetRenderInput = {
bucketName: string;
renderId: string;
region: AwsRegion;
- s3OutputProvider?: CustomS3Credentials;
+ s3OutputProvider?: CustomCredentials;
};
/**
@@ -20,7 +20,7 @@ export type GetRenderInput = {
* @param {string} params.bucketName The name of the bucket that was used in the render.
* @param {string} params.renderId The ID of the render that was returned by `renderMediaOnLambda()`.
* @param {AwsRegion} params.region The region in which the render was triggered.
- * @param {CustomS3Credentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
+ * @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
* @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
*/
export const getRenderProgress = async ({
diff --git a/packages/lambda/src/functions/helpers/expected-out-name.ts b/packages/lambda/src/functions/helpers/expected-out-name.ts
index 6e0bf42327..a14d1d0c85 100644
--- a/packages/lambda/src/functions/helpers/expected-out-name.ts
+++ b/packages/lambda/src/functions/helpers/expected-out-name.ts
@@ -2,13 +2,13 @@ import type {Codec} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
import type {OutNameInput, OutNameOutput, RenderMetadata} from '../../defaults';
import {customOutName, outName, outStillName} from '../../defaults';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {validateOutname} from '../../shared/validate-outname';
import {getCustomOutName} from './get-custom-out-name';
export const getCredentialsFromOutName = (
name: OutNameInput | null
-): CustomS3Credentials | null => {
+): CustomCredentials | null => {
if (typeof name === 'string') {
return null;
}
@@ -27,7 +27,7 @@ export const getCredentialsFromOutName = (
export const getExpectedOutName = (
renderMetadata: RenderMetadata,
bucketName: string,
- customCredentials: CustomS3Credentials | null
+ customCredentials: CustomCredentials | null
): OutNameOutput => {
const outNameValue = getCustomOutName({
customCredentials,
diff --git a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
index a9d0116b4f..75fc29feb5 100644
--- a/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
+++ b/packages/lambda/src/functions/helpers/find-output-file-in-bucket.ts
@@ -1,7 +1,7 @@
import {HeadObjectCommand} from '@aws-sdk/client-s3';
import type {AwsRegion} from '../..';
import {ROLE_NAME} from '../../api/iam-validation/suggested-policy';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getS3Client} from '../../shared/aws-clients';
import type {RenderMetadata} from '../../shared/constants';
import {getExpectedOutName} from './expected-out-name';
@@ -22,7 +22,7 @@ export const findOutputFileInBucket = async ({
region: AwsRegion;
renderMetadata: RenderMetadata;
bucketName: string;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): Promise<OutputFileMetadata | null> => {
if (!renderMetadata) {
throw new Error('unexpectedly did not get renderMetadata');
diff --git a/packages/lambda/src/functions/helpers/get-custom-out-name.ts b/packages/lambda/src/functions/helpers/get-custom-out-name.ts
index 51c6f0f306..f9cee2e47f 100644
--- a/packages/lambda/src/functions/helpers/get-custom-out-name.ts
+++ b/packages/lambda/src/functions/helpers/get-custom-out-name.ts
@@ -1,12 +1,12 @@
import type {OutNameInput, RenderMetadata} from '../../defaults';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
export const getCustomOutName = ({
renderMetadata,
customCredentials,
}: {
renderMetadata: RenderMetadata;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): OutNameInput | null => {
if (!renderMetadata.outName) {
return null;
diff --git a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
index 128daeb4db..5a59e46bae 100644
--- a/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
+++ b/packages/lambda/src/functions/helpers/get-output-url-from-metadata.ts
@@ -1,12 +1,12 @@
import type {RenderMetadata} from '../../defaults';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getExpectedOutName} from './expected-out-name';
import {getCurrentRegionInFunction} from './get-current-region';
export const getOutputUrlFromMetadata = (
renderMetadata: RenderMetadata,
bucketName: string,
- customCredentials: CustomS3Credentials | null
+ customCredentials: CustomCredentials | null
) => {
const outname = getExpectedOutName(
renderMetadata,
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index a4b653d0b8..9850133002 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -1,6 +1,6 @@
import {Internals} from 'remotion';
import type {AwsRegion} from '../../pricing/aws-regions';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import type {RenderProgress} from '../../shared/constants';
import {
chunkKey,
@@ -46,7 +46,7 @@ export const getProgress = async ({
region: AwsRegion;
memorySizeInMb: number;
timeoutInMiliseconds: number;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): Promise<RenderProgress> => {
const postRenderData = await getPostRenderData({
bucketName,
diff --git a/packages/lambda/src/functions/helpers/io.ts b/packages/lambda/src/functions/helpers/io.ts
index 44d3813774..b43fb58259 100644
--- a/packages/lambda/src/functions/helpers/io.ts
+++ b/packages/lambda/src/functions/helpers/io.ts
@@ -9,7 +9,7 @@ import type {ReadStream} from 'fs';
import mimeTypes from 'mime-types';
import type {Readable} from 'stream';
import type {AwsRegion} from '../../pricing/aws-regions';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getS3Client} from '../../shared/aws-clients';
import type {Privacy} from '../../shared/constants';
import type {DownloadBehavior} from '../../shared/content-disposition-header';
@@ -110,7 +110,7 @@ export const lambdaWriteFile = async ({
privacy: Privacy;
expectedBucketOwner: string | null;
downloadBehavior: DownloadBehavior | null;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): Promise<void> => {
await getS3Client(region, customCredentials).send(
new PutObjectCommand({
diff --git a/packages/lambda/src/functions/helpers/read-with-progress.ts b/packages/lambda/src/functions/helpers/read-with-progress.ts
index aba3030b21..61196a8b2b 100644
--- a/packages/lambda/src/functions/helpers/read-with-progress.ts
+++ b/packages/lambda/src/functions/helpers/read-with-progress.ts
@@ -2,7 +2,7 @@ import {GetObjectCommand} from '@aws-sdk/client-s3';
import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
import {RenderInternals} from '@remotion/renderer';
import type {AwsRegion} from '../../pricing/aws-regions';
-import type {CustomS3Credentials} from '../../shared/aws-clients';
+import type {CustomCredentials} from '../../shared/aws-clients';
import {getS3Client} from '../../shared/aws-clients';
export type LambdaReadFileProgress = (progress: {
@@ -26,7 +26,7 @@ export const lambdaDownloadFileWithProgress = async ({
expectedBucketOwner: string;
outputPath: string;
onProgress: LambdaReadFileProgress;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): Promise<{sizeInBytes: number; to: string}> => {
const client = getS3Client(region, customCredentials);
const command = new GetObjectCommand({
diff --git a/packages/lambda/src/index.ts b/packages/lambda/src/index.ts
index 26647edae5..61f000fc28 100644
--- a/packages/lambda/src/index.ts
+++ b/packages/lambda/src/index.ts
@@ -58,7 +58,7 @@ import {renderStillOnLambda} from './api/render-still-on-lambda';
import type {LambdaLSInput, LambdaLsReturnType} from './functions/helpers/io';
import {LambdaInternals} from './internals';
import type {AwsRegion} from './pricing/aws-regions';
-import type {CustomS3Credentials} from './shared/aws-clients';
+import type {CustomCredentials} from './shared/aws-clients';
import type {RenderProgress} from './shared/constants';
import type {LambdaArchitecture} from './shared/validate-architecture';
@@ -118,5 +118,5 @@ export type {
GetAwsClientInput,
GetAwsClientOutput,
LambdaArchitecture,
- CustomS3Credentials,
+ CustomCredentials,
};
diff --git a/packages/lambda/src/shared/aws-clients.ts b/packages/lambda/src/shared/aws-clients.ts
index 3a4d0e1de2..59d0faec89 100644
--- a/packages/lambda/src/shared/aws-clients.ts
+++ b/packages/lambda/src/shared/aws-clients.ts
@@ -53,7 +53,7 @@ const getKey = ({
}: {
credentials: CredentialPair | null;
region: AwsRegion;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
service: keyof ServiceMapping;
}) =>
[
@@ -78,7 +78,7 @@ export type CustomCredentialsWithoutSensitiveData = {
endpoint: string;
};
-export type CustomS3Credentials = CustomCredentialsWithoutSensitiveData & {
+export type CustomCredentials = CustomCredentialsWithoutSensitiveData & {
accessKeyId: string | null;
secretAccessKey: string | null;
};
@@ -90,7 +90,7 @@ export const getServiceClient = <T extends keyof ServiceMapping>({
}: {
region: AwsRegion;
service: T;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
}): ServiceMapping[T] => {
const Client = (() => {
if (service === 'cloudwatch') {
@@ -161,7 +161,7 @@ export const getCloudWatchLogsClient = (
export const getS3Client = (
region: AwsRegion,
- customCredentials: CustomS3Credentials | null
+ customCredentials: CustomCredentials | null
): S3Client => {
return getServiceClient({region, service: 's3', customCredentials});
};
@@ -180,7 +180,7 @@ export const getIamClient = (region: AwsRegion): IAMClient => {
export const getServiceQuotasClient = (
region: AwsRegion,
- customCredentials: CustomS3Credentials | null
+ customCredentials: CustomCredentials | null
): ServiceQuotasClient => {
return getServiceClient({
region,
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 70c5b87da6..27cee87b4b 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -12,8 +12,8 @@ import type {ChunkRetry} from '../functions/helpers/get-retry-stats';
import type {EnhancedErrorInfo} from '../functions/helpers/write-lambda-error';
import type {AwsRegion} from '../pricing/aws-regions';
import type {
+ CustomCredentials,
CustomCredentialsWithoutSensitiveData,
- CustomS3Credentials,
} from './aws-clients';
import type {DownloadBehavior} from './content-disposition-header';
import type {ExpensiveChunk} from './get-most-expensive-chunks';
@@ -132,7 +132,7 @@ export type OutNameInput =
| {
bucketName: string;
key: string;
- s3OutputProvider?: CustomS3Credentials;
+ s3OutputProvider?: CustomCredentials;
};
export type OutNameInputWithoutCredentials =
@@ -146,7 +146,7 @@ export type OutNameInputWithoutCredentials =
export type OutNameOutput = {
renderBucketName: string;
key: string;
- customCredentials: CustomS3Credentials | null;
+ customCredentials: CustomCredentials | null;
};
export const optimizationProfile = (siteId: string, compositionId: string) =>
@@ -260,7 +260,7 @@ export type LambdaPayloads = {
bucketName: string;
renderId: string;
version: string;
- s3OutputProvider?: CustomS3Credentials;
+ s3OutputProvider?: CustomCredentials;
};
renderer: {
concurrencyPerLambda: number;