@remotion/lambda 4.0.33 → 4.0.35
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/api/render-media-on-lambda.d.ts +2 -0
- package/dist/api/render-media-on-lambda.js +5 -4
- package/dist/cli/commands/render/render.js +13 -12
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/shared/deserialize-input-props.d.ts +8 -0
- package/dist/shared/deserialize-input-props.js +26 -0
- package/dist/shared/invoke-webhook.d.ts +0 -2
- package/dist/shared/serialize-input-props.d.ts +8 -0
- package/dist/shared/serialize-input-props.js +42 -0
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
|
@@ -5,6 +5,7 @@ import type { AwsRegion } from '../pricing/aws-regions';
|
|
|
5
5
|
import type { OutNameInput, Privacy, WebhookOption } from '../shared/constants';
|
|
6
6
|
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
7
7
|
import type { LambdaCodec } from '../shared/validate-lambda-codec';
|
|
8
|
+
import type { InnerRenderMediaOnLambdaInput } from './make-lambda-payload';
|
|
8
9
|
export type RenderMediaOnLambdaInput = {
|
|
9
10
|
region: AwsRegion;
|
|
10
11
|
functionName: string;
|
|
@@ -59,6 +60,7 @@ export type RenderMediaOnLambdaOutput = {
|
|
|
59
60
|
cloudWatchLogs: string;
|
|
60
61
|
folderInS3Console: string;
|
|
61
62
|
};
|
|
63
|
+
export declare const internalRenderMediaOnLambdaRaw: (input: InnerRenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
62
64
|
/**
|
|
63
65
|
* @description Triggers a render on a lambda given a composition and a lambda function.
|
|
64
66
|
* @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
|
|
3
|
+
exports.renderVideoOnLambda = exports.renderMediaOnLambda = exports.internalRenderMediaOnLambdaRaw = void 0;
|
|
4
4
|
const pure_1 = require("@remotion/renderer/pure");
|
|
5
5
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
6
6
|
const constants_1 = require("../shared/constants");
|
|
7
7
|
const get_aws_urls_1 = require("../shared/get-aws-urls");
|
|
8
8
|
const make_lambda_payload_1 = require("./make-lambda-payload");
|
|
9
|
-
const
|
|
9
|
+
const internalRenderMediaOnLambdaRaw = async (input) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const { functionName, region, rendererFunctionName } = input;
|
|
12
12
|
try {
|
|
@@ -43,6 +43,7 @@ const renderMediaOnLambdaRaw = async (input) => {
|
|
|
43
43
|
throw err;
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
exports.internalRenderMediaOnLambdaRaw = internalRenderMediaOnLambdaRaw;
|
|
46
47
|
/**
|
|
47
48
|
* @description Triggers a render on a lambda given a composition and a lambda function.
|
|
48
49
|
* @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
|
|
@@ -64,7 +65,7 @@ const renderMediaOnLambdaRaw = async (input) => {
|
|
|
64
65
|
*/
|
|
65
66
|
const renderMediaOnLambda = (options) => {
|
|
66
67
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
67
|
-
const wrapped = pure_1.PureJSAPIs.wrapWithErrorHandling(
|
|
68
|
+
const wrapped = pure_1.PureJSAPIs.wrapWithErrorHandling(exports.internalRenderMediaOnLambdaRaw);
|
|
68
69
|
if (options.quality) {
|
|
69
70
|
throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
|
|
70
71
|
}
|
|
@@ -93,7 +94,7 @@ const renderMediaOnLambda = (options) => {
|
|
|
93
94
|
maxRetries: (_t = options.maxRetries) !== null && _t !== void 0 ? _t : 1,
|
|
94
95
|
muted: (_u = options.muted) !== null && _u !== void 0 ? _u : false,
|
|
95
96
|
numberOfGifLoops: (_v = options.numberOfGifLoops) !== null && _v !== void 0 ? _v : 0,
|
|
96
|
-
offthreadVideoCacheSizeInBytes: (_w = options.offthreadVideoCacheSizeInBytes) !== null && _w !== void 0 ? _w :
|
|
97
|
+
offthreadVideoCacheSizeInBytes: (_w = options.offthreadVideoCacheSizeInBytes) !== null && _w !== void 0 ? _w : null,
|
|
97
98
|
outName: (_x = options.outName) !== null && _x !== void 0 ? _x : null,
|
|
98
99
|
overwrite: (_y = options.overwrite) !== null && _y !== void 0 ? _y : false,
|
|
99
100
|
pixelFormat: (_z = options.pixelFormat) !== null && _z !== void 0 ? _z : undefined,
|
|
@@ -4,7 +4,6 @@ exports.renderCommand = exports.RENDER_COMMAND = void 0;
|
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const config_1 = require("@remotion/cli/config");
|
|
6
6
|
const renderer_1 = require("@remotion/renderer");
|
|
7
|
-
const client_1 = require("@remotion/renderer/client");
|
|
8
7
|
const remotion_1 = require("remotion");
|
|
9
8
|
const download_media_1 = require("../../../api/download-media");
|
|
10
9
|
const get_render_progress_1 = require("../../../api/get-render-progress");
|
|
@@ -24,7 +23,7 @@ const log_1 = require("../../log");
|
|
|
24
23
|
const progress_1 = require("./progress");
|
|
25
24
|
exports.RENDER_COMMAND = 'render';
|
|
26
25
|
const renderCommand = async (args, remotionRoot) => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
28
27
|
const serveUrl = args[0];
|
|
29
28
|
if (!serveUrl) {
|
|
30
29
|
log_1.Log.error('No serve URL passed.');
|
|
@@ -34,7 +33,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
34
33
|
(0, quit_1.quit)(1);
|
|
35
34
|
}
|
|
36
35
|
const region = (0, get_aws_region_1.getAwsRegion)();
|
|
37
|
-
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, browserExecutable, port, offthreadVideoCacheSizeInBytes, colorSpace, } = await cli_1.CliInternals.getCliOptions({
|
|
36
|
+
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, browserExecutable, port, offthreadVideoCacheSizeInBytes, colorSpace, deleteAfter, x264Preset, } = await cli_1.CliInternals.getCliOptions({
|
|
38
37
|
type: 'series',
|
|
39
38
|
isLambda: true,
|
|
40
39
|
remotionRoot,
|
|
@@ -100,8 +99,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
100
99
|
const framesPerLambda = (_e = args_1.parsedLambdaCli['frames-per-lambda']) !== null && _e !== void 0 ? _e : undefined;
|
|
101
100
|
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({ framesPerLambda, durationInFrames: 1 });
|
|
102
101
|
const webhookCustomData = (0, get_webhook_custom_data_1.getWebhookCustomData)();
|
|
103
|
-
const
|
|
104
|
-
const res = await (0, render_media_on_lambda_1.renderMediaOnLambda)({
|
|
102
|
+
const res = await (0, render_media_on_lambda_1.internalRenderMediaOnLambdaRaw)({
|
|
105
103
|
functionName,
|
|
106
104
|
serveUrl,
|
|
107
105
|
inputProps,
|
|
@@ -118,8 +116,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
118
116
|
framesPerLambda,
|
|
119
117
|
privacy,
|
|
120
118
|
logLevel,
|
|
121
|
-
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange :
|
|
122
|
-
outName: args_1.parsedLambdaCli['out-name'],
|
|
119
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
120
|
+
outName: (_f = args_1.parsedLambdaCli['out-name']) !== null && _f !== void 0 ? _f : null,
|
|
123
121
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
124
122
|
chromiumOptions,
|
|
125
123
|
scale,
|
|
@@ -135,15 +133,18 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
135
133
|
webhook: args_1.parsedLambdaCli.webhook
|
|
136
134
|
? {
|
|
137
135
|
url: args_1.parsedLambdaCli.webhook,
|
|
138
|
-
secret: (
|
|
136
|
+
secret: (_g = args_1.parsedLambdaCli['webhook-secret']) !== null && _g !== void 0 ? _g : null,
|
|
139
137
|
customData: webhookCustomData,
|
|
140
138
|
}
|
|
141
|
-
:
|
|
142
|
-
rendererFunctionName: (
|
|
143
|
-
forceBucketName: args_1.parsedLambdaCli['force-bucket-name'],
|
|
139
|
+
: null,
|
|
140
|
+
rendererFunctionName: (_h = args_1.parsedLambdaCli['renderer-function-name']) !== null && _h !== void 0 ? _h : null,
|
|
141
|
+
forceBucketName: (_j = args_1.parsedLambdaCli['force-bucket-name']) !== null && _j !== void 0 ? _j : null,
|
|
144
142
|
audioCodec: cli_1.CliInternals.parsedCli['audio-codec'],
|
|
145
|
-
deleteAfter,
|
|
143
|
+
deleteAfter: deleteAfter !== null && deleteAfter !== void 0 ? deleteAfter : null,
|
|
146
144
|
colorSpace,
|
|
145
|
+
downloadBehavior: { type: 'play-in-browser' },
|
|
146
|
+
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
147
|
+
x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
|
|
147
148
|
});
|
|
148
149
|
const totalSteps = downloadName ? 6 : 5;
|
|
149
150
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
4
4
|
type: z.ZodLiteral<"render-id-determined">;
|
|
5
5
|
renderId: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
renderId: string;
|
|
8
7
|
type: "render-id-determined";
|
|
9
|
-
}, {
|
|
10
8
|
renderId: string;
|
|
9
|
+
}, {
|
|
11
10
|
type: "render-id-determined";
|
|
11
|
+
renderId: string;
|
|
12
12
|
}>]>;
|
|
13
13
|
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
14
|
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
-
renderId: string;
|
|
16
15
|
type: "render-id-determined";
|
|
16
|
+
renderId: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
19
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { SerializedInputProps } from './constants';
|
|
3
|
+
export declare const deserializeInputProps: ({ serialized, region, bucketName, expectedBucketOwner, }: {
|
|
4
|
+
serialized: SerializedInputProps;
|
|
5
|
+
region: AwsRegion;
|
|
6
|
+
bucketName: string;
|
|
7
|
+
expectedBucketOwner: string;
|
|
8
|
+
}) => Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeInputProps = void 0;
|
|
4
|
+
const io_1 = require("../functions/helpers/io");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const stream_to_string_1 = require("./stream-to-string");
|
|
7
|
+
const deserializeInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, }) => {
|
|
8
|
+
if (serialized.type === 'payload') {
|
|
9
|
+
return JSON.parse(serialized.payload);
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const response = await (0, io_1.lambdaReadFile)({
|
|
13
|
+
bucketName,
|
|
14
|
+
expectedBucketOwner,
|
|
15
|
+
key: (0, constants_1.inputPropsKey)(serialized.hash),
|
|
16
|
+
region,
|
|
17
|
+
});
|
|
18
|
+
const body = await (0, stream_to_string_1.streamToString)(response);
|
|
19
|
+
const payload = JSON.parse(body);
|
|
20
|
+
return payload;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.deserializeInputProps = deserializeInputProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { SerializedInputProps } from './constants';
|
|
3
|
+
export declare const serializeInputProps: ({ inputProps, region, type, userSpecifiedBucketName, }: {
|
|
4
|
+
inputProps: Record<string, unknown>;
|
|
5
|
+
region: AwsRegion;
|
|
6
|
+
type: 'still' | 'video-or-audio';
|
|
7
|
+
userSpecifiedBucketName: string | null;
|
|
8
|
+
}) => Promise<SerializedInputProps>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeInputProps = void 0;
|
|
4
|
+
const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
|
|
5
|
+
const io_1 = require("../functions/helpers/io");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const random_hash_1 = require("./random-hash");
|
|
8
|
+
const serializeInputProps = async ({ inputProps = {}, region, type, userSpecifiedBucketName, }) => {
|
|
9
|
+
try {
|
|
10
|
+
const payload = JSON.stringify(inputProps);
|
|
11
|
+
const hash = (0, random_hash_1.randomHash)();
|
|
12
|
+
const MAX_INLINE_PAYLOAD_SIZE = type === 'still' ? 5000000 : 200000;
|
|
13
|
+
if (payload.length > MAX_INLINE_PAYLOAD_SIZE) {
|
|
14
|
+
console.warn(`Warning: inputProps are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(payload.length / 1024)}KB) in size. Uploading them to S3 to circumvent AWS Lambda payload size.`);
|
|
15
|
+
const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
16
|
+
region,
|
|
17
|
+
})).bucketName;
|
|
18
|
+
await (0, io_1.lambdaWriteFile)({
|
|
19
|
+
body: payload,
|
|
20
|
+
bucketName,
|
|
21
|
+
region,
|
|
22
|
+
customCredentials: null,
|
|
23
|
+
downloadBehavior: null,
|
|
24
|
+
expectedBucketOwner: null,
|
|
25
|
+
key: (0, constants_1.inputPropsKey)(hash),
|
|
26
|
+
privacy: 'public',
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
type: 'bucket-url',
|
|
30
|
+
hash,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
type: 'payload',
|
|
35
|
+
payload,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
throw new Error('Error serializing inputProps. Check it has no circular references or reduce the size if the object is big.');
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.serializeInputProps = serializeInputProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.35",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.21.4",
|
|
29
|
-
"@remotion/bundler": "4.0.
|
|
30
|
-
"@remotion/
|
|
31
|
-
"
|
|
32
|
-
"remotion": "4.0.
|
|
29
|
+
"@remotion/bundler": "4.0.35",
|
|
30
|
+
"@remotion/renderer": "4.0.35",
|
|
31
|
+
"remotion": "4.0.35",
|
|
32
|
+
"@remotion/cli": "4.0.35"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"ts-node": "^10.8.0",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"@remotion/bundler": "4.0.
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
46
|
+
"@remotion/bundler": "4.0.35",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.35"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.35"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|