@remotion/lambda 4.0.0-alpha5 → 4.0.0-alpha6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/bundle-lambda.js +10 -10
- package/dist/admin/generate-etag-list.js +4 -4
- package/dist/api/create-function.js +2 -2
- package/dist/api/deploy-site.js +2 -2
- package/dist/api/download-media.js +2 -2
- package/dist/api/get-sites.d.ts +0 -1
- package/dist/api/make-lambda-payload.d.ts +41 -0
- package/dist/api/make-lambda-payload.js +65 -0
- package/dist/api/render-media-on-lambda.d.ts +2 -2
- package/dist/api/render-media-on-lambda.js +4 -60
- package/dist/api/upload-dir.js +7 -7
- package/dist/cli/commands/quotas/increase.js +2 -2
- package/dist/cli/help.js +4 -0
- package/dist/cli/index.js +3 -3
- package/dist/cli/log.d.ts +3 -3
- package/dist/functions/helpers/clean-tmpdir.js +7 -7
- package/dist/functions/helpers/concat-videos.js +7 -7
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-files-in-folder.js +5 -5
- package/dist/functions/helpers/io.d.ts +1 -1
- package/dist/functions/index.d.ts +9 -9
- package/dist/functions/launch.js +9 -9
- package/dist/functions/renderer.js +6 -6
- package/dist/functions/still.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/internals.d.ts +40 -0
- package/dist/internals.js +2 -0
- package/dist/shared/aws-clients.js +2 -2
- package/dist/shared/call-lambda.js +11 -0
- package/dist/shared/function-zip-path.js +2 -2
- package/dist/shared/get-etag.js +4 -4
- package/dist/shared/invoke-webhook.d.ts +1 -1
- package/dist/shared/invoke-webhook.js +4 -4
- package/dist/shared/make-s3-key.js +2 -2
- package/dist/shared/make-s3-url.js +2 -2
- package/dist/shared/read-dir.js +2 -2
- package/dist/shared/serialize-input-props.js +1 -1
- package/dist/shared/validate-privacy.js +1 -1
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
|
@@ -5,20 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const bundler_1 = require("@remotion/bundler");
|
|
7
7
|
const compositor_linux_arm64_gnu_1 = require("@remotion/compositor-linux-arm64-gnu");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const quit_1 = require("../cli/helpers/quit");
|
|
11
11
|
const function_zip_path_1 = require("../shared/function-zip-path");
|
|
12
12
|
const zl = require("zip-lib");
|
|
13
13
|
const bundleLambda = async () => {
|
|
14
|
-
const outdir =
|
|
15
|
-
|
|
14
|
+
const outdir = node_path_1.default.join(__dirname, '..', `build-render`);
|
|
15
|
+
node_fs_1.default.mkdirSync(outdir, {
|
|
16
16
|
recursive: true,
|
|
17
17
|
});
|
|
18
|
-
const outfile =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const template = require.resolve(
|
|
18
|
+
const outfile = node_path_1.default.join(outdir, 'index.js');
|
|
19
|
+
node_fs_1.default.rmSync(outdir, { recursive: true });
|
|
20
|
+
node_fs_1.default.mkdirSync(outdir, { recursive: true });
|
|
21
|
+
const template = require.resolve(node_path_1.default.join(__dirname, '..', 'functions', 'index'));
|
|
22
22
|
await bundler_1.BundlerInternals.esbuild.build({
|
|
23
23
|
platform: 'node',
|
|
24
24
|
target: 'node16',
|
|
@@ -36,9 +36,9 @@ const bundleLambda = async () => {
|
|
|
36
36
|
],
|
|
37
37
|
});
|
|
38
38
|
const compositorFile = `${outdir}/compositor`;
|
|
39
|
-
|
|
39
|
+
node_fs_1.default.copyFileSync(compositor_linux_arm64_gnu_1.binaryPath, compositorFile);
|
|
40
40
|
await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
|
|
41
|
-
|
|
41
|
+
node_fs_1.default.rmSync(outdir, { recursive: true });
|
|
42
42
|
};
|
|
43
43
|
bundleLambda()
|
|
44
44
|
.then(() => {
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const md5 = (data) =>
|
|
6
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
9
9
|
const chunks = [];
|
|
10
10
|
for (let i = 0; i < 2000; i++) {
|
|
11
11
|
const etag = `"${md5(String(i))}"`;
|
|
12
12
|
chunks.push(etag);
|
|
13
13
|
}
|
|
14
|
-
(0,
|
|
14
|
+
(0, node_fs_1.writeFileSync)('etags.json', JSON.stringify(chunks));
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFunction = void 0;
|
|
4
4
|
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
5
5
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
7
|
const defaults_1 = require("../defaults");
|
|
8
8
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
9
9
|
const hosted_layers_1 = require("../shared/hosted-layers");
|
|
@@ -33,7 +33,7 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
33
33
|
const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
|
|
34
34
|
const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
35
|
Code: {
|
|
36
|
-
ZipFile: (0,
|
|
36
|
+
ZipFile: (0, node_fs_1.readFileSync)(zipFile),
|
|
37
37
|
},
|
|
38
38
|
FunctionName: functionName,
|
|
39
39
|
Handler: 'index.handler',
|
package/dist/api/deploy-site.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.deploySite = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const io_1 = require("../functions/helpers/io");
|
|
9
9
|
const bundle_site_1 = require("../shared/bundle-site");
|
|
10
10
|
const constants_1 = require("../shared/constants");
|
|
@@ -87,7 +87,7 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
|
|
|
87
87
|
})),
|
|
88
88
|
]);
|
|
89
89
|
if (!process.env.VITEST) {
|
|
90
|
-
|
|
90
|
+
node_fs_1.default.rmSync(bundled, {
|
|
91
91
|
recursive: true,
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.downloadMedia = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
|
-
const
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const expected_out_name_1 = require("../functions/helpers/expected-out-name");
|
|
10
10
|
const get_render_metadata_1 = require("../functions/helpers/get-render-metadata");
|
|
11
11
|
const read_with_progress_1 = require("../functions/helpers/read-with-progress");
|
|
@@ -32,7 +32,7 @@ const downloadMedia = async (input) => {
|
|
|
32
32
|
region: input.region,
|
|
33
33
|
renderId: input.renderId,
|
|
34
34
|
});
|
|
35
|
-
const outputPath =
|
|
35
|
+
const outputPath = node_path_1.default.resolve(process.cwd(), input.outPath);
|
|
36
36
|
renderer_1.RenderInternals.ensureOutputDirectory(outputPath);
|
|
37
37
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
|
|
38
38
|
const { sizeInBytes } = await (0, read_with_progress_1.lambdaDownloadFileWithProgress)({
|
package/dist/api/get-sites.d.ts
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RenderMediaOnLambdaInput } from './render-media-on-lambda';
|
|
2
|
+
export declare const makeLambdaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: RenderMediaOnLambdaInput) => Promise<{
|
|
3
|
+
rendererFunctionName: string | null;
|
|
4
|
+
framesPerLambda: number | null;
|
|
5
|
+
composition: string;
|
|
6
|
+
serveUrl: string;
|
|
7
|
+
inputProps: import("../defaults").SerializedInputProps;
|
|
8
|
+
codec: "h264" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "gif" | "prores";
|
|
9
|
+
imageFormat: "png" | "jpeg" | "none";
|
|
10
|
+
crf: number | undefined;
|
|
11
|
+
envVariables: Record<string, string> | undefined;
|
|
12
|
+
pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
|
|
13
|
+
proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
|
|
14
|
+
jpegQuality: number | undefined;
|
|
15
|
+
maxRetries: number;
|
|
16
|
+
privacy: import("../defaults").Privacy;
|
|
17
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
18
|
+
frameRange: import("@remotion/renderer").FrameRange | null;
|
|
19
|
+
outName: import("../defaults").OutNameInput | null;
|
|
20
|
+
timeoutInMilliseconds: number;
|
|
21
|
+
chromiumOptions: import("@remotion/renderer").ChromiumOptions;
|
|
22
|
+
scale: number;
|
|
23
|
+
everyNthFrame: number;
|
|
24
|
+
numberOfGifLoops: number;
|
|
25
|
+
concurrencyPerLambda: number;
|
|
26
|
+
downloadBehavior: import("../shared/content-disposition-header").DownloadBehavior;
|
|
27
|
+
muted: boolean;
|
|
28
|
+
version: string;
|
|
29
|
+
overwrite: boolean;
|
|
30
|
+
audioBitrate: string | null;
|
|
31
|
+
videoBitrate: string | null;
|
|
32
|
+
webhook: {
|
|
33
|
+
url: string;
|
|
34
|
+
secret: string | null;
|
|
35
|
+
} | null;
|
|
36
|
+
forceHeight: number | null;
|
|
37
|
+
forceWidth: number | null;
|
|
38
|
+
bucketName: string | null;
|
|
39
|
+
audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
40
|
+
dumpBrowserLogs: boolean;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeLambdaPayload = void 0;
|
|
4
|
+
const version_1 = require("remotion/version");
|
|
5
|
+
const serialize_input_props_1 = require("../shared/serialize-input-props");
|
|
6
|
+
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
7
|
+
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
8
|
+
const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
|
|
9
|
+
const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
10
|
+
const makeLambdaPayload = async ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }) => {
|
|
11
|
+
if (quality) {
|
|
12
|
+
throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
|
|
13
|
+
}
|
|
14
|
+
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
15
|
+
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
16
|
+
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({
|
|
17
|
+
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
18
|
+
durationInFrames: 1,
|
|
19
|
+
});
|
|
20
|
+
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
21
|
+
const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
|
|
22
|
+
inputProps,
|
|
23
|
+
region,
|
|
24
|
+
type: 'video-or-audio',
|
|
25
|
+
userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
rendererFunctionName: rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : null,
|
|
29
|
+
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
30
|
+
composition,
|
|
31
|
+
serveUrl,
|
|
32
|
+
inputProps: serializedInputProps,
|
|
33
|
+
codec: actualCodec,
|
|
34
|
+
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
|
|
35
|
+
crf,
|
|
36
|
+
envVariables,
|
|
37
|
+
pixelFormat,
|
|
38
|
+
proResProfile,
|
|
39
|
+
jpegQuality,
|
|
40
|
+
maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
|
|
41
|
+
privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
|
|
42
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
43
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
44
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
45
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
46
|
+
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
47
|
+
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
48
|
+
everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
|
|
49
|
+
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
|
|
50
|
+
concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
|
|
51
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
52
|
+
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
53
|
+
version: version_1.VERSION,
|
|
54
|
+
overwrite: overwrite !== null && overwrite !== void 0 ? overwrite : false,
|
|
55
|
+
audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
|
|
56
|
+
videoBitrate: videoBitrate !== null && videoBitrate !== void 0 ? videoBitrate : null,
|
|
57
|
+
webhook: webhook !== null && webhook !== void 0 ? webhook : null,
|
|
58
|
+
forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
|
|
59
|
+
forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
|
|
60
|
+
bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
|
|
61
|
+
audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
|
|
62
|
+
dumpBrowserLogs: dumpBrowserLogs !== null && dumpBrowserLogs !== void 0 ? dumpBrowserLogs : false,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.makeLambdaPayload = makeLambdaPayload;
|
|
@@ -74,8 +74,8 @@ export declare type RenderMediaOnLambdaOutput = {
|
|
|
74
74
|
* @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch
|
|
75
75
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
76
76
|
*/
|
|
77
|
-
export declare const renderMediaOnLambda: (
|
|
77
|
+
export declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
78
78
|
/**
|
|
79
79
|
* @deprecated Renamed to renderMediaOnLambda()
|
|
80
80
|
*/
|
|
81
|
-
export declare const renderVideoOnLambda: (
|
|
81
|
+
export declare const renderVideoOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
|
|
4
|
-
const version_1 = require("remotion/version");
|
|
5
4
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
6
5
|
const constants_1 = require("../shared/constants");
|
|
7
6
|
const get_aws_urls_1 = require("../shared/get-aws-urls");
|
|
8
|
-
const
|
|
9
|
-
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
10
|
-
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
11
|
-
const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
|
|
12
|
-
const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
7
|
+
const make_lambda_payload_1 = require("./make-lambda-payload");
|
|
13
8
|
/**
|
|
14
9
|
* @description Triggers a render on a lambda given a composition and a lambda function.
|
|
15
10
|
* @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
|
|
@@ -30,65 +25,14 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
30
25
|
* @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch
|
|
31
26
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
32
27
|
*/
|
|
33
|
-
const renderMediaOnLambda = async (
|
|
28
|
+
const renderMediaOnLambda = async (input) => {
|
|
34
29
|
var _a;
|
|
35
|
-
|
|
36
|
-
throw new Error(`"quality" has been renamed. Use "jpegQuality" instead.`);
|
|
37
|
-
}
|
|
38
|
-
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
39
|
-
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
40
|
-
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({
|
|
41
|
-
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
42
|
-
durationInFrames: 1,
|
|
43
|
-
});
|
|
44
|
-
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
45
|
-
const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
|
|
46
|
-
inputProps,
|
|
47
|
-
region,
|
|
48
|
-
type: 'video-or-audio',
|
|
49
|
-
userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
|
|
50
|
-
});
|
|
30
|
+
const { functionName, region, rendererFunctionName } = input;
|
|
51
31
|
try {
|
|
52
32
|
const res = await (0, call_lambda_1.callLambda)({
|
|
53
33
|
functionName,
|
|
54
34
|
type: constants_1.LambdaRoutines.start,
|
|
55
|
-
payload:
|
|
56
|
-
rendererFunctionName: rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : null,
|
|
57
|
-
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
58
|
-
composition,
|
|
59
|
-
serveUrl,
|
|
60
|
-
inputProps: serializedInputProps,
|
|
61
|
-
codec: actualCodec,
|
|
62
|
-
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
|
|
63
|
-
crf,
|
|
64
|
-
envVariables,
|
|
65
|
-
pixelFormat,
|
|
66
|
-
proResProfile,
|
|
67
|
-
jpegQuality,
|
|
68
|
-
maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
|
|
69
|
-
privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
|
|
70
|
-
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
71
|
-
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
72
|
-
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
73
|
-
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
74
|
-
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
75
|
-
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
76
|
-
everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
|
|
77
|
-
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
|
|
78
|
-
concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
|
|
79
|
-
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
80
|
-
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
81
|
-
version: version_1.VERSION,
|
|
82
|
-
overwrite: overwrite !== null && overwrite !== void 0 ? overwrite : false,
|
|
83
|
-
audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
|
|
84
|
-
videoBitrate: videoBitrate !== null && videoBitrate !== void 0 ? videoBitrate : null,
|
|
85
|
-
webhook: webhook !== null && webhook !== void 0 ? webhook : null,
|
|
86
|
-
forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
|
|
87
|
-
forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
|
|
88
|
-
bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
|
|
89
|
-
audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
|
|
90
|
-
dumpBrowserLogs: dumpBrowserLogs !== null && dumpBrowserLogs !== void 0 ? dumpBrowserLogs : false,
|
|
91
|
-
},
|
|
35
|
+
payload: await (0, make_lambda_payload_1.makeLambdaPayload)(input),
|
|
92
36
|
region,
|
|
93
37
|
});
|
|
94
38
|
return {
|
package/dist/api/upload-dir.js
CHANGED
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.uploadDir = exports.getDirFiles = void 0;
|
|
7
7
|
const lib_storage_1 = require("@aws-sdk/lib-storage");
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
8
|
const mime_types_1 = __importDefault(require("mime-types"));
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
12
12
|
const make_s3_key_1 = require("../shared/make-s3-key");
|
|
13
13
|
const getDirFiles = (entry) => {
|
|
@@ -15,14 +15,14 @@ const getDirFiles = (entry) => {
|
|
|
15
15
|
};
|
|
16
16
|
exports.getDirFiles = getDirFiles;
|
|
17
17
|
async function getFiles(directory, originalDirectory, toUpload) {
|
|
18
|
-
const dirents = await
|
|
18
|
+
const dirents = await node_fs_1.promises.readdir(directory, { withFileTypes: true });
|
|
19
19
|
const _files = await Promise.all(dirents
|
|
20
20
|
.map((dirent) => {
|
|
21
|
-
const res =
|
|
21
|
+
const res = node_path_1.default.resolve(directory, dirent.name);
|
|
22
22
|
return [dirent, res];
|
|
23
23
|
})
|
|
24
24
|
.filter(([dirent, res]) => {
|
|
25
|
-
const relative =
|
|
25
|
+
const relative = node_path_1.default.relative(originalDirectory, res);
|
|
26
26
|
if (dirent.isDirectory()) {
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
@@ -32,7 +32,7 @@ async function getFiles(directory, originalDirectory, toUpload) {
|
|
|
32
32
|
return true;
|
|
33
33
|
})
|
|
34
34
|
.map(async ([dirent, res]) => {
|
|
35
|
-
const { size } = await
|
|
35
|
+
const { size } = await node_fs_1.promises.stat(res);
|
|
36
36
|
return dirent.isDirectory()
|
|
37
37
|
? getFiles(res, originalDirectory, toUpload)
|
|
38
38
|
: [
|
|
@@ -53,7 +53,7 @@ const uploadDir = async ({ bucket, region, localDir, onProgress, keyPrefix, priv
|
|
|
53
53
|
const client = (0, aws_clients_1.getS3Client)(region, null);
|
|
54
54
|
const uploads = files.map((filePath) => {
|
|
55
55
|
const Key = (0, make_s3_key_1.makeS3Key)(keyPrefix, localDir, filePath.name);
|
|
56
|
-
const Body = (0,
|
|
56
|
+
const Body = (0, node_fs_1.createReadStream)(filePath.name);
|
|
57
57
|
const ContentType = mime_types_1.default.lookup(Key) || 'application/octet-stream';
|
|
58
58
|
const ACL = privacy === 'no-acl'
|
|
59
59
|
? undefined
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.quotasIncreaseCommand = exports.INCREASE_SUBCOMMAND = void 0;
|
|
4
4
|
const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
|
|
5
|
-
const
|
|
5
|
+
const node_process_1 = require("node:process");
|
|
6
6
|
const _1 = require(".");
|
|
7
7
|
const defaults_1 = require("../../../defaults");
|
|
8
8
|
const aws_clients_1 = require("../../../shared/aws-clients");
|
|
@@ -36,7 +36,7 @@ const quotasIncreaseCommand = async () => {
|
|
|
36
36
|
if (openCase) {
|
|
37
37
|
log_1.Log.warn(`A request to increase it to ${openCase.DesiredValue} is already pending:`);
|
|
38
38
|
log_1.Log.warn(`https://${region}.console.aws.amazon.com/support/home#/case/?displayId=${openCase.CaseId}`);
|
|
39
|
-
(0,
|
|
39
|
+
(0, node_process_1.exit)(1);
|
|
40
40
|
}
|
|
41
41
|
const concurrencyCurrent = (_b = concurrencyLimit.Quota) === null || _b === void 0 ? void 0 : _b.Value;
|
|
42
42
|
const defaultConcurrency = (_c = defaultConcurrencyLimit.Quota) === null || _c === void 0 ? void 0 : _c.Value;
|
package/dist/cli/help.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.printHelp = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const constants_1 = require("../shared/constants");
|
|
6
|
+
const compositions_1 = require("./commands/compositions");
|
|
6
7
|
const functions_1 = require("./commands/functions");
|
|
7
8
|
const policies_1 = require("./commands/policies/policies");
|
|
8
9
|
const quotas_1 = require("./commands/quotas");
|
|
@@ -28,6 +29,9 @@ const printHelp = () => {
|
|
|
28
29
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${sites_1.SITES_COMMAND}`);
|
|
29
30
|
log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
|
|
30
31
|
log_1.Log.info();
|
|
32
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${compositions_1.COMPOSITIONS_COMMAND}`);
|
|
33
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Print list of composition IDs from a serve URL.'));
|
|
34
|
+
log_1.Log.info();
|
|
31
35
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${policies_1.POLICIES_COMMAND}`);
|
|
32
36
|
log_1.Log.info(cli_1.CliInternals.chalk.gray('View and validate AWS policy files.'));
|
|
33
37
|
log_1.Log.info();
|
package/dist/cli/index.js
CHANGED
|
@@ -30,9 +30,9 @@ const requiresCredentials = (args) => {
|
|
|
30
30
|
if (args[1] === role_1.ROLE_SUBCOMMAND) {
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
}
|
|
34
|
+
if (args[0] === regions_1.REGIONS_COMMAND) {
|
|
35
|
+
return false;
|
|
36
36
|
}
|
|
37
37
|
return true;
|
|
38
38
|
};
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ export declare const Log: {
|
|
|
2
2
|
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
3
3
|
verboseAdvanced: (options: {
|
|
4
4
|
indent: boolean;
|
|
5
|
-
logLevel: "
|
|
5
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
6
6
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
7
7
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
8
8
|
infoAdvanced: (options: {
|
|
9
9
|
indent: boolean;
|
|
10
|
-
logLevel: "
|
|
10
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
11
11
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
12
12
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
13
13
|
warnAdvanced: (options: {
|
|
14
14
|
indent: boolean;
|
|
15
|
-
logLevel: "
|
|
15
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
16
16
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
17
17
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
18
18
|
};
|
|
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.deleteTmpDir = exports.deletedFilesSize = exports.deletedFiles = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
9
|
exports.deletedFiles = [];
|
|
10
10
|
exports.deletedFilesSize = 0;
|
|
11
11
|
const deleteAllFilesInAFolderRecursively = (path) => {
|
|
12
|
-
const files =
|
|
12
|
+
const files = node_fs_1.default.readdirSync(path);
|
|
13
13
|
files.forEach((file) => {
|
|
14
|
-
const filePath = (0,
|
|
14
|
+
const filePath = (0, node_path_1.join)(path, file);
|
|
15
15
|
try {
|
|
16
|
-
const stat =
|
|
16
|
+
const stat = node_fs_1.default.statSync(filePath);
|
|
17
17
|
if (stat.isDirectory()) {
|
|
18
18
|
deleteAllFilesInAFolderRecursively(filePath);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
|
|
21
|
+
node_fs_1.default.unlinkSync(filePath);
|
|
22
22
|
exports.deletedFilesSize += stat.size;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -29,7 +29,7 @@ const deleteAllFilesInAFolderRecursively = (path) => {
|
|
|
29
29
|
exports.deletedFiles.push(filePath);
|
|
30
30
|
});
|
|
31
31
|
if (path !== '/tmp') {
|
|
32
|
-
|
|
32
|
+
node_fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const deleteTmpDir = () => {
|
|
@@ -25,14 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.concatVideosS3 = exports.getAllFilesS3 = void 0;
|
|
27
27
|
const renderer_1 = require("@remotion/renderer");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const node_fs_1 = __importStar(require("node:fs"));
|
|
29
|
+
const node_path_1 = __importStar(require("node:path"));
|
|
30
30
|
const constants_1 = require("../../shared/constants");
|
|
31
31
|
const inspect_errors_1 = require("./inspect-errors");
|
|
32
32
|
const io_1 = require("./io");
|
|
33
33
|
const timer_1 = require("./timer");
|
|
34
34
|
const getChunkDownloadOutputLocation = ({ outdir, file, }) => {
|
|
35
|
-
return
|
|
35
|
+
return node_path_1.default.join(outdir, node_path_1.default.basename(file));
|
|
36
36
|
};
|
|
37
37
|
const downloadS3File = async ({ bucket, key, outdir, region, expectedBucketOwner, }) => {
|
|
38
38
|
const Body = await (0, io_1.lambdaReadFile)({
|
|
@@ -43,10 +43,10 @@ const downloadS3File = async ({ bucket, key, outdir, region, expectedBucketOwner
|
|
|
43
43
|
});
|
|
44
44
|
const outpath = getChunkDownloadOutputLocation({ outdir, file: key });
|
|
45
45
|
if (Buffer.isBuffer(Body)) {
|
|
46
|
-
return
|
|
46
|
+
return node_fs_1.promises.writeFile(outpath, Body);
|
|
47
47
|
}
|
|
48
48
|
return new Promise((resolve, reject) => {
|
|
49
|
-
Body.pipe((0,
|
|
49
|
+
Body.pipe((0, node_fs_1.createWriteStream)(outpath))
|
|
50
50
|
.on('error', (err) => reject(err))
|
|
51
51
|
.on('close', () => resolve());
|
|
52
52
|
});
|
|
@@ -129,7 +129,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
129
129
|
};
|
|
130
130
|
exports.getAllFilesS3 = getAllFilesS3;
|
|
131
131
|
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, }) => {
|
|
132
|
-
const outfile = (0,
|
|
132
|
+
const outfile = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
|
|
133
133
|
const combine = (0, timer_1.timer)('Combine videos');
|
|
134
134
|
const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
|
|
135
135
|
await renderer_1.RenderInternals.combineVideos({
|
|
@@ -144,7 +144,7 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
|
|
|
144
144
|
audioCodec,
|
|
145
145
|
});
|
|
146
146
|
combine.end();
|
|
147
|
-
const cleanupChunksProm =
|
|
147
|
+
const cleanupChunksProm = node_fs_1.default.promises.rm(outdir, {
|
|
148
148
|
recursive: true,
|
|
149
149
|
});
|
|
150
150
|
return { outfile, cleanupChunksProm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "
|
|
1
|
+
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-south-1" | "ap-east-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "me-south-1" | "sa-east-1";
|
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getFolderFiles = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
function getFolderFiles(folder) {
|
|
10
|
-
const files =
|
|
10
|
+
const files = node_fs_1.default.readdirSync(folder);
|
|
11
11
|
const paths = [];
|
|
12
12
|
files.forEach((file) => {
|
|
13
|
-
const full =
|
|
13
|
+
const full = node_path_1.default.join(folder, file);
|
|
14
14
|
try {
|
|
15
|
-
const stat =
|
|
15
|
+
const stat = node_fs_1.default.statSync(full);
|
|
16
16
|
if (stat.isDirectory()) {
|
|
17
17
|
paths.push(...getFolderFiles(full));
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
-
import type { ReadStream } from 'fs';
|
|
2
|
+
import type { ReadStream } from 'node:fs';
|
|
3
3
|
import type { Readable } from 'stream';
|
|
4
4
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
5
5
|
import type { CustomCredentials } from '../../shared/aws-clients';
|
|
@@ -2,17 +2,17 @@ import type { LambdaPayload } from '../shared/constants';
|
|
|
2
2
|
export declare const handler: (params: LambdaPayload, context: {
|
|
3
3
|
invokedFunctionArn: string;
|
|
4
4
|
getRemainingTimeInMillis: () => number;
|
|
5
|
-
}) => Promise<void> | Promise<{
|
|
6
|
-
compositions: import("remotion").AnyCompMetadata[];
|
|
7
|
-
}> | Promise<{
|
|
8
|
-
version: string;
|
|
9
|
-
}> | Promise<{
|
|
10
|
-
bucketName: string;
|
|
11
|
-
renderId: string;
|
|
12
|
-
}> | Promise<import("../shared/constants").RenderProgress> | Promise<Promise<{
|
|
5
|
+
}) => Promise<void> | Promise<Promise<{
|
|
13
6
|
output: string;
|
|
14
7
|
size: number;
|
|
15
8
|
bucketName: string;
|
|
16
9
|
estimatedPrice: import("../shared/constants").CostsInfo;
|
|
17
10
|
renderId: string;
|
|
18
|
-
}
|
|
11
|
+
}>> | Promise<{
|
|
12
|
+
bucketName: string;
|
|
13
|
+
renderId: string;
|
|
14
|
+
}> | Promise<import("../shared/constants").RenderProgress> | Promise<{
|
|
15
|
+
version: string;
|
|
16
|
+
}> | Promise<{
|
|
17
|
+
compositions: import("remotion").AnyCompMetadata[];
|
|
18
|
+
}>;
|
package/dist/functions/launch.js
CHANGED
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.launchHandler = void 0;
|
|
27
27
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
28
28
|
const renderer_1 = require("@remotion/renderer");
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const node_fs_1 = __importStar(require("node:fs"));
|
|
30
|
+
const node_path_1 = require("node:path");
|
|
31
31
|
const remotion_1 = require("remotion");
|
|
32
32
|
const version_1 = require("remotion/version");
|
|
33
33
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
@@ -362,13 +362,13 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
362
362
|
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
363
363
|
};
|
|
364
364
|
const fps = comp.fps / params.everyNthFrame;
|
|
365
|
-
const outdir = (0,
|
|
366
|
-
if ((0,
|
|
367
|
-
(0,
|
|
365
|
+
const outdir = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
366
|
+
if ((0, node_fs_1.existsSync)(outdir)) {
|
|
367
|
+
(0, node_fs_1.rmSync)(outdir, {
|
|
368
368
|
recursive: true,
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
|
-
(0,
|
|
371
|
+
(0, node_fs_1.mkdirSync)(outdir);
|
|
372
372
|
const files = await (0, concat_videos_1.getAllFilesS3)({
|
|
373
373
|
bucket: params.bucketName,
|
|
374
374
|
expectedFiles: chunkCount,
|
|
@@ -390,11 +390,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
390
390
|
audioCodec: params.audioCodec,
|
|
391
391
|
});
|
|
392
392
|
const encodingStop = Date.now();
|
|
393
|
-
const outputSize =
|
|
393
|
+
const outputSize = node_fs_1.default.statSync(outfile);
|
|
394
394
|
await (0, io_1.lambdaWriteFile)({
|
|
395
395
|
bucketName: renderBucketName,
|
|
396
396
|
key,
|
|
397
|
-
body:
|
|
397
|
+
body: node_fs_1.default.createReadStream(outfile),
|
|
398
398
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
399
399
|
privacy: params.privacy,
|
|
400
400
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -473,7 +473,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
473
473
|
customCredentials: null,
|
|
474
474
|
});
|
|
475
475
|
renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
|
|
476
|
-
await Promise.all([cleanupChunksProm,
|
|
476
|
+
await Promise.all([cleanupChunksProm, node_fs_1.default.promises.rm(outfile)]);
|
|
477
477
|
clearTimeout(webhookDueToTimeout);
|
|
478
478
|
if (params.webhook && !webhookInvoked) {
|
|
479
479
|
try {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.rendererHandler = void 0;
|
|
7
7
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
13
13
|
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
@@ -51,7 +51,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
51
51
|
const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
|
|
52
52
|
? 'h264-mkv'
|
|
53
53
|
: params.codec;
|
|
54
|
-
const outputLocation =
|
|
54
|
+
const outputLocation = node_path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
|
|
55
55
|
codec: params.codec,
|
|
56
56
|
preferLossless: true,
|
|
57
57
|
}))}`);
|
|
@@ -178,7 +178,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
178
178
|
renderId: params.renderId,
|
|
179
179
|
index: params.chunk,
|
|
180
180
|
}),
|
|
181
|
-
body:
|
|
181
|
+
body: node_fs_1.default.createReadStream(outputLocation),
|
|
182
182
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
183
183
|
privacy: params.privacy,
|
|
184
184
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -186,8 +186,8 @@ const renderHandler = async (params, options, logs) => {
|
|
|
186
186
|
customCredentials: null,
|
|
187
187
|
});
|
|
188
188
|
await Promise.all([
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
node_fs_1.default.promises.rm(outputLocation, { recursive: true }),
|
|
190
|
+
node_fs_1.default.promises.rm(outputPath, { recursive: true }),
|
|
191
191
|
(0, io_1.lambdaWriteFile)({
|
|
192
192
|
bucketName: params.bucketName,
|
|
193
193
|
body: JSON.stringify(condensedTimingData, null, 2),
|
package/dist/functions/still.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.stillHandler = void 0;
|
|
7
7
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const estimate_price_1 = require("../api/estimate-price");
|
|
13
13
|
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
@@ -52,7 +52,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
52
52
|
(0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
|
|
53
53
|
]);
|
|
54
54
|
const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
55
|
-
const outputPath =
|
|
55
|
+
const outputPath = node_path_1.default.join(outputDir, 'output');
|
|
56
56
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
57
57
|
const region = (0, get_current_region_1.getCurrentRegionInFunction)();
|
|
58
58
|
const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
|
|
@@ -134,19 +134,19 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
134
134
|
browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
|
|
135
135
|
});
|
|
136
136
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
|
|
137
|
-
const { size } = await
|
|
137
|
+
const { size } = await node_fs_1.default.promises.stat(outputPath);
|
|
138
138
|
await (0, io_1.lambdaWriteFile)({
|
|
139
139
|
bucketName: renderBucketName,
|
|
140
140
|
key,
|
|
141
141
|
privacy: lambdaParams.privacy,
|
|
142
|
-
body:
|
|
142
|
+
body: node_fs_1.default.createReadStream(outputPath),
|
|
143
143
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
144
144
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
145
145
|
downloadBehavior: lambdaParams.downloadBehavior,
|
|
146
146
|
customCredentials,
|
|
147
147
|
});
|
|
148
148
|
await Promise.all([
|
|
149
|
-
|
|
149
|
+
node_fs_1.default.promises.rm(outputPath, { recursive: true }),
|
|
150
150
|
(0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
|
|
151
151
|
bucketName,
|
|
152
152
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ import type { WebhookPayload } from './shared/invoke-webhook';
|
|
|
43
43
|
/**
|
|
44
44
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
45
45
|
*/
|
|
46
|
-
declare const renderMediaOnLambda: (
|
|
46
|
+
declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
47
47
|
/**
|
|
48
48
|
* @deprecated Import this from `@remotion/lambda/client` instead
|
|
49
49
|
*/
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
1
|
export declare const LambdaInternals: {
|
|
2
2
|
executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
|
|
3
|
+
makeLambdaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: import(".").RenderMediaOnLambdaInput) => Promise<{
|
|
4
|
+
rendererFunctionName: string | null;
|
|
5
|
+
framesPerLambda: number | null;
|
|
6
|
+
composition: string;
|
|
7
|
+
serveUrl: string;
|
|
8
|
+
inputProps: import("./defaults").SerializedInputProps;
|
|
9
|
+
codec: "h264" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "gif" | "prores";
|
|
10
|
+
imageFormat: "png" | "jpeg" | "none";
|
|
11
|
+
crf: number | undefined;
|
|
12
|
+
envVariables: Record<string, string> | undefined;
|
|
13
|
+
pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
|
|
14
|
+
proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
|
|
15
|
+
jpegQuality: number | undefined;
|
|
16
|
+
maxRetries: number;
|
|
17
|
+
privacy: import("./defaults").Privacy;
|
|
18
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
19
|
+
frameRange: import("@remotion/renderer").FrameRange | null;
|
|
20
|
+
outName: import("./defaults").OutNameInput | null;
|
|
21
|
+
timeoutInMilliseconds: number;
|
|
22
|
+
chromiumOptions: import("@remotion/renderer").ChromiumOptions;
|
|
23
|
+
scale: number;
|
|
24
|
+
everyNthFrame: number;
|
|
25
|
+
numberOfGifLoops: number;
|
|
26
|
+
concurrencyPerLambda: number;
|
|
27
|
+
downloadBehavior: import("./shared/content-disposition-header").DownloadBehavior;
|
|
28
|
+
muted: boolean;
|
|
29
|
+
version: string;
|
|
30
|
+
overwrite: boolean;
|
|
31
|
+
audioBitrate: string | null;
|
|
32
|
+
videoBitrate: string | null;
|
|
33
|
+
webhook: {
|
|
34
|
+
url: string;
|
|
35
|
+
secret: string | null;
|
|
36
|
+
} | null;
|
|
37
|
+
forceHeight: number | null;
|
|
38
|
+
forceWidth: number | null;
|
|
39
|
+
bucketName: string | null;
|
|
40
|
+
audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
41
|
+
dumpBrowserLogs: boolean;
|
|
42
|
+
}>;
|
|
3
43
|
};
|
package/dist/internals.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LambdaInternals = void 0;
|
|
4
|
+
const make_lambda_payload_1 = require("./api/make-lambda-payload");
|
|
4
5
|
const index_1 = require("./cli/index");
|
|
5
6
|
exports.LambdaInternals = {
|
|
6
7
|
executeCommand: index_1.executeCommand,
|
|
8
|
+
makeLambdaPayload: make_lambda_payload_1.makeLambdaPayload,
|
|
7
9
|
};
|
|
@@ -8,7 +8,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
|
|
|
8
8
|
const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
|
|
9
9
|
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
10
10
|
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
11
|
-
const
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
12
|
const check_credentials_1 = require("./check-credentials");
|
|
13
13
|
const is_in_lambda_1 = require("./is-in-lambda");
|
|
14
14
|
const _clients = {};
|
|
@@ -90,7 +90,7 @@ const getCredentialsHash = ({ customCredentials, region, service, }) => {
|
|
|
90
90
|
hashComponents.customCredentials = customCredentials;
|
|
91
91
|
hashComponents.region = region;
|
|
92
92
|
hashComponents.service = service;
|
|
93
|
-
return (0,
|
|
93
|
+
return (0, node_crypto_1.createHash)('sha256')
|
|
94
94
|
.update(JSON.stringify(hashComponents))
|
|
95
95
|
.digest('base64');
|
|
96
96
|
};
|
|
@@ -12,6 +12,17 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
|
|
|
12
12
|
}));
|
|
13
13
|
const string = Buffer.from(res.Payload).toString();
|
|
14
14
|
const json = JSON.parse(string);
|
|
15
|
+
if (json === null) {
|
|
16
|
+
throw new Error('Lambda function unexpectedly returned null: ' +
|
|
17
|
+
JSON.stringify({
|
|
18
|
+
payload,
|
|
19
|
+
type,
|
|
20
|
+
functionName,
|
|
21
|
+
json,
|
|
22
|
+
error: res.FunctionError,
|
|
23
|
+
version: res.$metadata,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
15
26
|
if ('errorMessage' in json) {
|
|
16
27
|
const err = new Error(json.errorMessage);
|
|
17
28
|
err.name = json.errorType;
|
|
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FUNCTION_ZIP_ARM64 = void 0;
|
|
7
|
-
const
|
|
8
|
-
exports.FUNCTION_ZIP_ARM64 =
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
exports.FUNCTION_ZIP_ARM64 = node_path_1.default.join(node_path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
|
package/dist/shared/get-etag.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getEtagOfFile = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const chunk = 1024 * 1024 * 5; // 5MB
|
|
10
|
-
const md5 = (data) =>
|
|
10
|
+
const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
11
11
|
const getEtagOfFile = async (filePath) => {
|
|
12
|
-
const stream = await
|
|
12
|
+
const stream = await node_fs_1.default.promises.readFile(filePath);
|
|
13
13
|
if (stream.length <= chunk) {
|
|
14
14
|
return `"${md5(stream)}"`;
|
|
15
15
|
}
|
|
@@ -27,9 +27,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.invokeWebhook = exports.mockableHttpClients = exports.calculateSignature = void 0;
|
|
30
|
-
const Crypto = __importStar(require("crypto"));
|
|
31
|
-
const http_1 = __importDefault(require("http"));
|
|
32
30
|
const https_1 = __importDefault(require("https"));
|
|
31
|
+
const Crypto = __importStar(require("node:crypto"));
|
|
32
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
33
33
|
/**
|
|
34
34
|
* @description Calculates cryptographically secure signature for webhooks using Hmac.
|
|
35
35
|
* @link https://remotion.dev/docs/lambda/webhooks#validate-webhooks
|
|
@@ -56,7 +56,7 @@ const getWebhookClient = (url) => {
|
|
|
56
56
|
throw new Error('Can only request URLs starting with http:// or https://');
|
|
57
57
|
};
|
|
58
58
|
exports.mockableHttpClients = {
|
|
59
|
-
http:
|
|
59
|
+
http: node_http_1.default.request,
|
|
60
60
|
https: https_1.default.request,
|
|
61
61
|
};
|
|
62
62
|
function invokeWebhook({ payload, secret, url, }) {
|
|
@@ -74,7 +74,7 @@ function invokeWebhook({ payload, secret, url, }) {
|
|
|
74
74
|
timeout: 5000,
|
|
75
75
|
}, (res) => {
|
|
76
76
|
if (res.statusCode && res.statusCode > 299) {
|
|
77
|
-
reject(new Error(`Sent a webhook but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
|
|
77
|
+
reject(new Error(`Sent a webhook to ${url} but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
resolve();
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeS3Key = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const makeS3Key = (folder, dir, filePath) => {
|
|
9
|
-
return `${folder}/${
|
|
9
|
+
return `${folder}/${node_path_1.default.relative(dir, filePath).split(node_path_1.default.sep).join('/')}`;
|
|
10
10
|
};
|
|
11
11
|
exports.makeS3Key = makeS3Key;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getServeUrlHash = exports.makeS3ServeUrl = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
8
|
const makeS3ServeUrl = ({ bucketName, subFolder, region, }) => {
|
|
9
9
|
return `https://${bucketName}.s3.${region}.amazonaws.com/${subFolder}/index.html`;
|
|
10
10
|
};
|
|
@@ -14,7 +14,7 @@ const getServeUrlHash = (url) => {
|
|
|
14
14
|
if (hashCache[url]) {
|
|
15
15
|
return hashCache[url];
|
|
16
16
|
}
|
|
17
|
-
const hash =
|
|
17
|
+
const hash = node_crypto_1.default.createHash('md5').update(url).digest('hex');
|
|
18
18
|
hashCache[url] = hash;
|
|
19
19
|
return hash;
|
|
20
20
|
};
|
package/dist/shared/read-dir.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.readDirectory = void 0;
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const path = __importStar(require("path"));
|
|
27
|
+
const fs = __importStar(require("node:fs"));
|
|
28
|
+
const path = __importStar(require("node:path"));
|
|
29
29
|
const get_etag_1 = require("./get-etag");
|
|
30
30
|
// Function to recursively read a directory and return a list of files
|
|
31
31
|
// with their etags and file names
|
|
@@ -5,7 +5,7 @@ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
|
5
5
|
const io_1 = require("../functions/helpers/io");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
const random_hash_1 = require("./random-hash");
|
|
8
|
-
const serializeInputProps = async ({ inputProps, region, type, userSpecifiedBucketName, }) => {
|
|
8
|
+
const serializeInputProps = async ({ inputProps = {}, region, type, userSpecifiedBucketName, }) => {
|
|
9
9
|
try {
|
|
10
10
|
const payload = JSON.stringify(inputProps);
|
|
11
11
|
const hash = (0, random_hash_1.randomHash)();
|
|
@@ -6,7 +6,7 @@ function validatePrivacy(privacy) {
|
|
|
6
6
|
throw new TypeError('Privacy must be a string');
|
|
7
7
|
}
|
|
8
8
|
if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
|
|
9
|
-
throw new TypeError('Privacy must be either "private", "public
|
|
9
|
+
throw new TypeError('Privacy must be either "private", "public" or "no-acl"');
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.validatePrivacy = validatePrivacy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha6",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"@aws-sdk/credential-providers": "3.272.0",
|
|
24
24
|
"@aws-sdk/lib-storage": "3.272.0",
|
|
25
25
|
"@aws-sdk/s3-request-presigner": "3.272.0",
|
|
26
|
-
"@remotion/bundler": "4.0.0-
|
|
27
|
-
"@remotion/cli": "4.0.0-
|
|
28
|
-
"@remotion/renderer": "4.0.0-
|
|
26
|
+
"@remotion/bundler": "4.0.0-alpha6",
|
|
27
|
+
"@remotion/cli": "4.0.0-alpha6",
|
|
28
|
+
"@remotion/renderer": "4.0.0-alpha6",
|
|
29
29
|
"aws-policies": "^1.0.1",
|
|
30
30
|
"mime-types": "2.1.34",
|
|
31
|
-
"remotion": "4.0.0-
|
|
31
|
+
"remotion": "4.0.0-alpha6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jonny/eslint-config": "3.0.266",
|
|
35
|
-
"@remotion/bundler": "4.0.0-
|
|
36
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.0-
|
|
35
|
+
"@remotion/bundler": "4.0.0-alpha6",
|
|
36
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha6",
|
|
37
37
|
"@types/mime-types": "2.1.1",
|
|
38
38
|
"@types/minimist": "1.2.2",
|
|
39
39
|
"@types/node": "^18.16.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"zip-lib": "^0.7.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.0-
|
|
50
|
+
"@remotion/bundler": "4.0.0-alpha6"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
package/remotionlambda-x64.zip
CHANGED
|
Binary file
|