@remotion/lambda 3.2.34 → 3.2.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/LICENSE.md +7 -7
- package/dist/api/render-media-on-lambda.js +7 -1
- package/dist/api/render-still-on-lambda.js +7 -1
- package/dist/functions/launch.js +7 -1
- package/dist/functions/renderer.js +9 -1
- package/dist/functions/still.js +18 -2
- package/dist/shared/cleanup-input-props.d.ts +7 -0
- package/dist/shared/cleanup-input-props.js +17 -0
- package/dist/shared/cleanup-serialized-input-props.d.ts +7 -0
- package/dist/shared/cleanup-serialized-input-props.js +19 -0
- package/dist/shared/const hi = () => {.d.ts +1 -0
- package/dist/shared/const hi = () => {.js +18 -0
- package/dist/shared/constants.d.ts +13 -5
- package/dist/shared/constants.js +5 -1
- package/dist/shared/deserialize-input-props.d.ts +8 -0
- package/dist/shared/deserialize-input-props.js +28 -0
- package/dist/shared/query.d.ts +1 -0
- package/dist/shared/query.js +21 -0
- package/dist/shared/serialize-input-props.d.ts +7 -0
- package/dist/shared/serialize-input-props.js +42 -0
- package/package.json +6 -6
- package/remotionlambda.zip +0 -0
package/LICENSE.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
-
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit
|
|
3
|
+
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
4
|
|
|
5
5
|
- [Free license](#free-license)
|
|
6
6
|
- [Company license](#company-license)
|
|
7
7
|
|
|
8
8
|
## Free license
|
|
9
9
|
|
|
10
|
-
Copyright © 2022 [
|
|
10
|
+
Copyright © 2022 [Remotion](https://www.remotion.dev/)
|
|
11
11
|
|
|
12
12
|
### Eligibility
|
|
13
13
|
|
|
14
14
|
You are eligible to use Remotion for free if you are:
|
|
15
15
|
|
|
16
16
|
- an individual
|
|
17
|
-
- a for-profit
|
|
18
|
-
- a non-profit or not-for-profit
|
|
17
|
+
- a for-profit organization with up to 3 employees
|
|
18
|
+
- a non-profit or not-for-profit organization
|
|
19
19
|
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
20
20
|
|
|
21
21
|
### Allowed use cases
|
|
22
22
|
|
|
23
|
-
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify
|
|
23
|
+
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
|
|
24
24
|
|
|
25
25
|
### Disallowed use cases
|
|
26
26
|
|
|
27
|
-
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
|
|
27
|
+
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
|
|
28
28
|
|
|
29
29
|
### Warranty notice
|
|
30
30
|
|
|
31
|
-
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and
|
|
31
|
+
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
32
32
|
|
|
33
33
|
### Support
|
|
34
34
|
|
|
@@ -6,6 +6,7 @@ const call_lambda_1 = require("../shared/call-lambda");
|
|
|
6
6
|
const constants_1 = require("../shared/constants");
|
|
7
7
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
8
8
|
const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
|
|
9
|
+
const serialize_input_props_1 = require("../shared/serialize-input-props");
|
|
9
10
|
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
10
11
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
11
12
|
const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
|
|
@@ -39,6 +40,11 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
|
|
|
39
40
|
});
|
|
40
41
|
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
41
42
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
43
|
+
const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
|
|
44
|
+
inputProps,
|
|
45
|
+
region,
|
|
46
|
+
type: 'video-or-audio',
|
|
47
|
+
});
|
|
42
48
|
try {
|
|
43
49
|
const res = await (0, call_lambda_1.callLambda)({
|
|
44
50
|
functionName,
|
|
@@ -47,7 +53,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
|
|
|
47
53
|
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
48
54
|
composition,
|
|
49
55
|
serveUrl: realServeUrl,
|
|
50
|
-
inputProps:
|
|
56
|
+
inputProps: serializedInputProps,
|
|
51
57
|
codec: actualCodec,
|
|
52
58
|
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
|
|
53
59
|
crf,
|
|
@@ -6,6 +6,7 @@ const call_lambda_1 = require("../shared/call-lambda");
|
|
|
6
6
|
const constants_1 = require("../shared/constants");
|
|
7
7
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
8
8
|
const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
|
|
9
|
+
const serialize_input_props_1 = require("../shared/serialize-input-props");
|
|
9
10
|
/**
|
|
10
11
|
* @description Renders a still frame on Lambda
|
|
11
12
|
* @link https://remotion.dev/docs/lambda/renderstillonlambda
|
|
@@ -25,6 +26,11 @@ const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url
|
|
|
25
26
|
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
|
|
26
27
|
var _a;
|
|
27
28
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
29
|
+
const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
|
|
30
|
+
inputProps,
|
|
31
|
+
region,
|
|
32
|
+
type: 'still',
|
|
33
|
+
});
|
|
28
34
|
try {
|
|
29
35
|
const res = await (0, call_lambda_1.callLambda)({
|
|
30
36
|
functionName,
|
|
@@ -32,7 +38,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
32
38
|
payload: {
|
|
33
39
|
composition,
|
|
34
40
|
serveUrl: realServeUrl,
|
|
35
|
-
inputProps,
|
|
41
|
+
inputProps: serializedInputProps,
|
|
36
42
|
imageFormat,
|
|
37
43
|
envVariables,
|
|
38
44
|
quality,
|
package/dist/functions/launch.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
13
|
+
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
13
14
|
const constants_1 = require("../shared/constants");
|
|
14
15
|
const docs_url_1 = require("../shared/docs-url");
|
|
15
16
|
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
@@ -453,6 +454,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
453
454
|
contents,
|
|
454
455
|
jobs,
|
|
455
456
|
});
|
|
457
|
+
const cleanupSerializedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
|
|
458
|
+
bucketName: params.bucketName,
|
|
459
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
460
|
+
serialized: params.inputProps,
|
|
461
|
+
});
|
|
456
462
|
const outputUrl = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, params.bucketName, customCredentials);
|
|
457
463
|
const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
|
|
458
464
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -463,7 +469,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
463
469
|
contents,
|
|
464
470
|
errorExplanations: await errorExplanationsProm,
|
|
465
471
|
timeToEncode: encodingStop - encodingStart,
|
|
466
|
-
timeToDelete: await deletProm,
|
|
472
|
+
timeToDelete: (await Promise.all([deletProm, cleanupSerializedInputPropsProm])).reduce((a, b) => a + b, 0),
|
|
467
473
|
outputFile: {
|
|
468
474
|
lastModified: Date.now(),
|
|
469
475
|
size: outputSize.size,
|
|
@@ -10,6 +10,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
12
12
|
const constants_1 = require("../shared/constants");
|
|
13
|
+
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
13
14
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
14
15
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
15
16
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
@@ -22,6 +23,12 @@ const renderHandler = async (params, options, logs) => {
|
|
|
22
23
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
23
24
|
throw new Error('Params must be renderer');
|
|
24
25
|
}
|
|
26
|
+
const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
|
|
27
|
+
bucketName: params.bucketName,
|
|
28
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
29
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
30
|
+
serialized: params.inputProps,
|
|
31
|
+
});
|
|
25
32
|
const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), (_a = params.chromiumOptions) !== null && _a !== void 0 ? _a : {});
|
|
26
33
|
const outputPath = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
27
34
|
if (typeof params.chunk !== 'number') {
|
|
@@ -42,6 +49,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
42
49
|
const chunkCodec = params.codec === 'gif' ? 'h264-mkv' : params.codec;
|
|
43
50
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
44
51
|
const downloads = {};
|
|
52
|
+
const inputProps = await inputPropsPromise;
|
|
45
53
|
await new Promise((resolve, reject) => {
|
|
46
54
|
var _a;
|
|
47
55
|
(0, renderer_1.renderMedia)({
|
|
@@ -53,7 +61,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
53
61
|
width: params.width,
|
|
54
62
|
},
|
|
55
63
|
imageFormat: params.imageFormat,
|
|
56
|
-
inputProps
|
|
64
|
+
inputProps,
|
|
57
65
|
frameRange: params.frameRange,
|
|
58
66
|
onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
|
|
59
67
|
if (renderedFrames % 10 === 0 &&
|
package/dist/functions/still.js
CHANGED
|
@@ -12,7 +12,9 @@ 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");
|
|
14
14
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
15
|
+
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
15
16
|
const constants_1 = require("../shared/constants");
|
|
17
|
+
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
16
18
|
const make_s3_url_1 = require("../shared/make-s3-url");
|
|
17
19
|
const random_hash_1 = require("../shared/random-hash");
|
|
18
20
|
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
@@ -48,6 +50,12 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
48
50
|
}),
|
|
49
51
|
(0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
|
|
50
52
|
]);
|
|
53
|
+
const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
|
|
54
|
+
bucketName,
|
|
55
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
56
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
57
|
+
serialized: lambdaParams.inputProps,
|
|
58
|
+
});
|
|
51
59
|
const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
52
60
|
const outputPath = path_1.default.join(outputDir, 'output');
|
|
53
61
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
@@ -95,6 +103,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
95
103
|
downloadBehavior: null,
|
|
96
104
|
customCredentials: null,
|
|
97
105
|
});
|
|
106
|
+
const inputProps = await inputPropsPromise;
|
|
98
107
|
await (0, renderer_1.renderStill)({
|
|
99
108
|
composition,
|
|
100
109
|
output: outputPath,
|
|
@@ -106,7 +115,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
106
115
|
durationInFrames: composition.durationInFrames,
|
|
107
116
|
}),
|
|
108
117
|
imageFormat: lambdaParams.imageFormat,
|
|
109
|
-
inputProps
|
|
118
|
+
inputProps,
|
|
110
119
|
overwrite: false,
|
|
111
120
|
puppeteerInstance: browserInstance,
|
|
112
121
|
quality: lambdaParams.quality,
|
|
@@ -127,7 +136,14 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
127
136
|
downloadBehavior: lambdaParams.downloadBehavior,
|
|
128
137
|
customCredentials,
|
|
129
138
|
});
|
|
130
|
-
await
|
|
139
|
+
await Promise.all([
|
|
140
|
+
fs_1.default.promises.rm(outputPath, { recursive: true }),
|
|
141
|
+
(0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
|
|
142
|
+
bucketName,
|
|
143
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
144
|
+
serialized: lambdaParams.inputProps,
|
|
145
|
+
}),
|
|
146
|
+
]);
|
|
131
147
|
const estimatedPrice = (0, estimate_price_1.estimatePrice)({
|
|
132
148
|
durationInMiliseconds: Date.now() - start + 100,
|
|
133
149
|
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { SerializedInputProps } from './constants';
|
|
3
|
+
export declare const cleanupSerializedInputProps: ({ serialized, region, bucketName, }: {
|
|
4
|
+
serialized: SerializedInputProps;
|
|
5
|
+
region: AwsRegion;
|
|
6
|
+
bucketName: string;
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupSerializedInputProps = void 0;
|
|
4
|
+
const io_1 = require("../functions/helpers/io");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
|
|
7
|
+
if (serialized.type === 'payload') {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
await (0, io_1.lambdaDeleteFile)({
|
|
11
|
+
bucketName,
|
|
12
|
+
key: (0, constants_1.inputPropsKey)(serialized.hash),
|
|
13
|
+
region,
|
|
14
|
+
customCredentials: null,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { SerializedInputProps } from './constants';
|
|
3
|
+
export declare const cleanupSerializedInputProps: ({ serialized, region, bucketName, }: {
|
|
4
|
+
serialized: SerializedInputProps;
|
|
5
|
+
region: AwsRegion;
|
|
6
|
+
bucketName: string;
|
|
7
|
+
}) => Promise<number>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupSerializedInputProps = void 0;
|
|
4
|
+
const io_1 = require("../functions/helpers/io");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
|
|
7
|
+
if (serialized.type === 'payload') {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
const time = Date.now();
|
|
11
|
+
await (0, io_1.lambdaDeleteFile)({
|
|
12
|
+
bucketName,
|
|
13
|
+
key: (0, constants_1.inputPropsKey)(serialized.hash),
|
|
14
|
+
region,
|
|
15
|
+
customCredentials: null,
|
|
16
|
+
});
|
|
17
|
+
return Date.now() - time;
|
|
18
|
+
};
|
|
19
|
+
exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const hi: (query: string) => Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const hi = async (query) => {
|
|
3
|
+
await fetch('https://plsduol1ca-dsn.algolianet.com/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(4.14.2)%3B%20Browser%20(lite)%3B%20docsearch%20(3.2.1)%3B%20docsearch-react%20(3.2.1)%3B%20docusaurus%20(2.1.0)&x-algolia-api-key=3e42dbd4f895fe93ff5cf40d860c4a85&x-algolia-application-id=PLSDUOL1CA', {
|
|
4
|
+
headers: {
|
|
5
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
6
|
+
},
|
|
7
|
+
body: JSON.stringify({
|
|
8
|
+
requests: [
|
|
9
|
+
{
|
|
10
|
+
query,
|
|
11
|
+
indexName: 'remotion',
|
|
12
|
+
params: 'attributesToRetrieve=%5B%22hierarchy.lvl0%22%2C%22hierarchy.lvl1%22%2C%22hierarchy.lvl2%22%2C%22hierarchy.lvl3%22%2C%22hierarchy.lvl4%22%2C%22hierarchy.lvl5%22%2C%22hierarchy.lvl6%22%2C%22content%22%2C%22type%22%2C%22url%22%5D&attributesToSnippet=%5B%22hierarchy.lvl1%3A10%22%2C%22hierarchy.lvl2%3A10%22%2C%22hierarchy.lvl3%3A10%22%2C%22hierarchy.lvl4%3A10%22%2C%22hierarchy.lvl5%3A10%22%2C%22hierarchy.lvl6%3A10%22%2C%22content%3A10%22%5D&snippetEllipsisText=%E2%80%A6&highlightPreTag=%3Cmark%3E&highlightPostTag=%3C%2Fmark%3E&hitsPerPage=20&facetFilters=%5B%5D',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
}),
|
|
16
|
+
method: 'POST',
|
|
17
|
+
}).then((res) => res.json());
|
|
18
|
+
};
|
|
@@ -81,6 +81,7 @@ export declare const outName: (renderId: string, extension: string) => string;
|
|
|
81
81
|
export declare const outStillName: (renderId: string, imageFormat: ImageFormat) => string;
|
|
82
82
|
export declare const customOutName: (renderId: string, bucketName: string, name: OutNameInput) => OutNameOutput;
|
|
83
83
|
export declare const postRenderDataKey: (renderId: string) => string;
|
|
84
|
+
export declare const inputPropsKey: (hash: string) => string;
|
|
84
85
|
export declare const RENDERER_PATH_TOKEN = "remotion-bucket";
|
|
85
86
|
export declare const CONCAT_FOLDER_TOKEN = "remotion-concat";
|
|
86
87
|
export declare const REMOTION_CONCATED_TOKEN = "remotion-concated-token";
|
|
@@ -97,6 +98,13 @@ declare type WebhookOption = null | {
|
|
|
97
98
|
url: string;
|
|
98
99
|
secret: string | null;
|
|
99
100
|
};
|
|
101
|
+
export declare type SerializedInputProps = {
|
|
102
|
+
type: 'bucket-url';
|
|
103
|
+
hash: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: 'payload';
|
|
106
|
+
payload: unknown;
|
|
107
|
+
};
|
|
100
108
|
export declare type LambdaPayloads = {
|
|
101
109
|
info: {
|
|
102
110
|
type: LambdaRoutines.info;
|
|
@@ -106,7 +114,7 @@ export declare type LambdaPayloads = {
|
|
|
106
114
|
serveUrl: string;
|
|
107
115
|
composition: string;
|
|
108
116
|
framesPerLambda: number | null;
|
|
109
|
-
inputProps:
|
|
117
|
+
inputProps: SerializedInputProps;
|
|
110
118
|
codec: LambdaCodec;
|
|
111
119
|
imageFormat: ImageFormat;
|
|
112
120
|
crf: number | undefined;
|
|
@@ -139,7 +147,7 @@ export declare type LambdaPayloads = {
|
|
|
139
147
|
composition: string;
|
|
140
148
|
framesPerLambda: number | null;
|
|
141
149
|
bucketName: string;
|
|
142
|
-
inputProps:
|
|
150
|
+
inputProps: SerializedInputProps;
|
|
143
151
|
renderId: string;
|
|
144
152
|
imageFormat: ImageFormat;
|
|
145
153
|
codec: LambdaCodec;
|
|
@@ -186,7 +194,7 @@ export declare type LambdaPayloads = {
|
|
|
186
194
|
width: number;
|
|
187
195
|
durationInFrames: number;
|
|
188
196
|
retriesLeft: number;
|
|
189
|
-
inputProps:
|
|
197
|
+
inputProps: SerializedInputProps;
|
|
190
198
|
renderId: string;
|
|
191
199
|
imageFormat: ImageFormat;
|
|
192
200
|
codec: Exclude<Codec, 'h264'>;
|
|
@@ -210,7 +218,7 @@ export declare type LambdaPayloads = {
|
|
|
210
218
|
type: LambdaRoutines.still;
|
|
211
219
|
serveUrl: string;
|
|
212
220
|
composition: string;
|
|
213
|
-
inputProps:
|
|
221
|
+
inputProps: SerializedInputProps;
|
|
214
222
|
imageFormat: ImageFormat;
|
|
215
223
|
envVariables: Record<string, string> | undefined;
|
|
216
224
|
attempt: number;
|
|
@@ -246,7 +254,7 @@ export declare type RenderMetadata = {
|
|
|
246
254
|
usesOptimizationProfile: boolean;
|
|
247
255
|
type: 'still' | 'video';
|
|
248
256
|
imageFormat: ImageFormat;
|
|
249
|
-
inputProps:
|
|
257
|
+
inputProps: SerializedInputProps;
|
|
250
258
|
framesPerLambda: number;
|
|
251
259
|
memorySizeInMb: number;
|
|
252
260
|
lambdaVersion: string;
|
package/dist/shared/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
|
|
3
|
+
exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.inputPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
|
|
4
4
|
exports.MIN_MEMORY = 512;
|
|
5
5
|
exports.MAX_MEMORY = 10240;
|
|
6
6
|
exports.DEFAULT_MEMORY_SIZE = 2048;
|
|
@@ -79,6 +79,10 @@ const postRenderDataKey = (renderId) => {
|
|
|
79
79
|
return `${(0, exports.rendersPrefix)(renderId)}/post-render-metadata.json`;
|
|
80
80
|
};
|
|
81
81
|
exports.postRenderDataKey = postRenderDataKey;
|
|
82
|
+
const inputPropsKey = (hash) => {
|
|
83
|
+
return `input-props/${hash}.json`;
|
|
84
|
+
};
|
|
85
|
+
exports.inputPropsKey = inputPropsKey;
|
|
82
86
|
exports.RENDERER_PATH_TOKEN = 'remotion-bucket';
|
|
83
87
|
exports.CONCAT_FOLDER_TOKEN = 'remotion-concat';
|
|
84
88
|
exports.REMOTION_CONCATED_TOKEN = 'remotion-concated-token';
|
|
@@ -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<unknown>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 {
|
|
10
|
+
inputProps: serialized.payload,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const response = await (0, io_1.lambdaReadFile)({
|
|
15
|
+
bucketName,
|
|
16
|
+
expectedBucketOwner,
|
|
17
|
+
key: (0, constants_1.inputPropsKey)(serialized.hash),
|
|
18
|
+
region,
|
|
19
|
+
});
|
|
20
|
+
const body = await (0, stream_to_string_1.streamToString)(response);
|
|
21
|
+
const payload = JSON.parse(body);
|
|
22
|
+
return payload;
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
throw new Error('Failed to parse input props that were');
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.deserializeInputProps = deserializeInputProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const hi: (query: string) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const hi = async (query) => {
|
|
3
|
+
await fetch('https://plsduol1ca-dsn.algolianet.com/1/indexes/*/queries?x-algolia-agent=' +
|
|
4
|
+
encodeURIComponent('Remotion Preview DocSearch') +
|
|
5
|
+
'&x-algolia-api-key=3e42dbd4f895fe93ff5cf40d860c4a85&x-algolia-application-id=PLSDUOL1CA', {
|
|
6
|
+
headers: {
|
|
7
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
8
|
+
},
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
requests: [
|
|
11
|
+
{
|
|
12
|
+
query,
|
|
13
|
+
indexName: 'remotion',
|
|
14
|
+
params: encodeURIComponent('attributesToRetrieve=["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"]&attributesToSnippet=["hierarchy.lvl1:10","hierarchy.lvl2:10","hierarchy.lvl3:10","hierarchy.lvl4:10","hierarchy.lvl5:10","hierarchy.lvl6:10","content:10"]&snippetEllipsisText=…&highlightPreTag=<mark>&highlightPostTag=</mark>&hitsPerPage=20&facetFilters=[]'),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
}),
|
|
18
|
+
method: 'POST',
|
|
19
|
+
}).then((res) => res.json());
|
|
20
|
+
};
|
|
21
|
+
hi();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { SerializedInputProps } from './constants';
|
|
3
|
+
export declare const serializeInputProps: ({ inputProps, region, type, }: {
|
|
4
|
+
inputProps: unknown;
|
|
5
|
+
region: AwsRegion;
|
|
6
|
+
type: 'still' | 'video-or-audio';
|
|
7
|
+
}) => 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, }) => {
|
|
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 } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
16
|
+
region,
|
|
17
|
+
});
|
|
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": "3.2.
|
|
3
|
+
"version": "3.2.35",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@aws-sdk/client-service-quotas": "3.190.0",
|
|
32
32
|
"@aws-sdk/lib-storage": "3.190.0",
|
|
33
33
|
"@aws-sdk/s3-request-presigner": "3.190.0",
|
|
34
|
-
"@remotion/bundler": "3.2.
|
|
35
|
-
"@remotion/cli": "3.2.
|
|
36
|
-
"@remotion/renderer": "3.2.
|
|
34
|
+
"@remotion/bundler": "3.2.35",
|
|
35
|
+
"@remotion/cli": "3.2.35",
|
|
36
|
+
"@remotion/renderer": "3.2.35",
|
|
37
37
|
"aws-policies": "^1.0.1",
|
|
38
38
|
"mime-types": "2.1.34",
|
|
39
|
-
"remotion": "3.2.
|
|
39
|
+
"remotion": "3.2.35"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1bf079a1df57808460b1dd87de07d698388598da"
|
|
63
63
|
}
|
package/remotionlambda.zip
CHANGED
|
Binary file
|