@remotion/lambda 4.0.0-publish.3 → 4.0.0-reorg.5
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 +1 -0
- package/dist/api/deploy-site.js +2 -3
- package/dist/api/presign-url.d.ts +2 -1
- package/dist/api/render-media-on-lambda.d.ts +10 -6
- package/dist/api/render-media-on-lambda.js +9 -4
- package/dist/api/render-still-on-lambda.d.ts +6 -5
- package/dist/api/render-still-on-lambda.js +4 -4
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/commands/render/progress.d.ts +1 -1
- package/dist/cli/commands/render/render.js +4 -1
- package/dist/cli/commands/sites/create.js +2 -3
- package/dist/cli/index.js +1 -1
- package/dist/functions/chunk-optimization/is-valid-profile.js +2 -2
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +2 -2
- package/dist/functions/chunk-optimization/plan-frame-ranges.js +7 -6
- package/dist/functions/chunk-optimization/s3-optimization-file.js +1 -0
- package/dist/functions/chunk-optimization/types.d.ts +1 -0
- package/dist/functions/helpers/concat-videos.d.ts +2 -1
- package/dist/functions/helpers/concat-videos.js +2 -1
- package/dist/functions/helpers/io.d.ts +3 -1
- package/dist/functions/helpers/io.js +3 -1
- package/dist/functions/helpers/read-with-progress.d.ts +2 -2
- package/dist/functions/helpers/read-with-progress.js +8 -1
- package/dist/functions/helpers/validate-composition.d.ts +2 -2
- package/dist/functions/helpers/write-lambda-error.js +1 -0
- package/dist/functions/helpers/write-post-render-data.js +1 -0
- package/dist/functions/index.js +4 -4
- package/dist/functions/launch.js +26 -16
- package/dist/functions/renderer.js +16 -11
- package/dist/functions/start.js +5 -2
- package/dist/functions/still.js +9 -6
- package/dist/shared/bundle-site.d.ts +1 -1
- package/dist/shared/check-credentials.js +2 -2
- package/dist/shared/constants.d.ts +16 -4
- package/dist/shared/constants.js +1 -1
- package/dist/shared/content-disposition-header.d.ts +7 -0
- package/dist/shared/content-disposition-header.js +19 -0
- package/dist/shared/truthy.d.ts +3 -0
- package/dist/shared/truthy.js +7 -0
- package/dist/shared/validate-download-behavior.d.ts +1 -0
- package/dist/shared/validate-download-behavior.js +21 -0
- package/dist/shared/validate-lambda-codec.d.ts +1 -1
- package/dist/shared/validate-lambda-codec.js +9 -1
- package/dist/shared/validate-presign-expiration.d.ts +0 -2
- package/dist/shared/validate-presign-expiration.js +7 -7
- package/package.json +7 -6
- package/remotionlambda.zip +0 -0
- package/dist/cli/helpers/format-bytes.d.ts +0 -6
- package/dist/cli/helpers/format-bytes.js +0 -103
- package/dist/shared/chunk.d.ts +0 -1
- package/dist/shared/chunk.js +0 -11
package/dist/api/deploy-site.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deploySite = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
4
|
const delete_site_1 = require("../api/delete-site");
|
|
6
5
|
const bundle_site_1 = require("../shared/bundle-site");
|
|
7
6
|
const constants_1 = require("../shared/constants");
|
|
@@ -46,8 +45,8 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
|
|
|
46
45
|
});
|
|
47
46
|
const bundled = await (0, bundle_site_1.bundleSite)(entryPoint, (_a = options === null || options === void 0 ? void 0 : options.onBundleProgress) !== null && _a !== void 0 ? _a : (() => undefined), {
|
|
48
47
|
publicPath: `/${subFolder}/`,
|
|
49
|
-
webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b :
|
|
50
|
-
enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c :
|
|
48
|
+
webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : ((f) => f),
|
|
49
|
+
enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : true,
|
|
51
50
|
});
|
|
52
51
|
await Promise.all([
|
|
53
52
|
(0, upload_dir_1.uploadDir)({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
2
|
-
|
|
2
|
+
declare type PresignURLInput = {
|
|
3
3
|
region: AwsRegion;
|
|
4
4
|
bucketName: string;
|
|
5
5
|
objectKey: string;
|
|
@@ -17,3 +17,4 @@ export declare type PresignURLInput = {
|
|
|
17
17
|
* @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
|
|
18
18
|
*/
|
|
19
19
|
export declare const presignUrl: ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: PresignURLInput) => Promise<string | null>;
|
|
20
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ChromiumOptions } from '@remotion/renderer';
|
|
2
|
-
import type { FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from 'remotion';
|
|
1
|
+
import type { ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
|
|
3
2
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
4
|
-
import type { Privacy } from '../shared/constants';
|
|
3
|
+
import type { OutNameInput, Privacy } from '../shared/constants';
|
|
4
|
+
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
5
5
|
import type { LambdaCodec } from '../shared/validate-lambda-codec';
|
|
6
6
|
export declare type RenderMediaOnLambdaInput = {
|
|
7
7
|
region: AwsRegion;
|
|
@@ -21,10 +21,14 @@ export declare type RenderMediaOnLambdaInput = {
|
|
|
21
21
|
framesPerLambda?: number;
|
|
22
22
|
logLevel?: LogLevel;
|
|
23
23
|
frameRange?: FrameRange;
|
|
24
|
-
outName?:
|
|
24
|
+
outName?: OutNameInput;
|
|
25
25
|
timeoutInMilliseconds?: number;
|
|
26
26
|
chromiumOptions?: ChromiumOptions;
|
|
27
27
|
scale?: number;
|
|
28
|
+
everyNthFrame?: number;
|
|
29
|
+
numberOfGifLoops?: number | null;
|
|
30
|
+
concurrencyPerLambda?: number;
|
|
31
|
+
downloadBehavior?: DownloadBehavior | null;
|
|
28
32
|
};
|
|
29
33
|
export declare type RenderMediaOnLambdaOutput = {
|
|
30
34
|
renderId: string;
|
|
@@ -48,8 +52,8 @@ export declare type RenderMediaOnLambdaOutput = {
|
|
|
48
52
|
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
|
|
49
53
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
50
54
|
*/
|
|
51
|
-
export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
55
|
+
export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
52
56
|
/**
|
|
53
57
|
* @deprecated Renamed to renderMediaOnLambda()
|
|
54
58
|
*/
|
|
55
|
-
export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
59
|
+
export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
4
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
6
5
|
const constants_1 = require("../shared/constants");
|
|
7
6
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
7
|
+
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
8
8
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
9
9
|
const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
|
|
10
10
|
const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
@@ -26,10 +26,11 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
26
26
|
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
|
|
27
27
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
28
28
|
*/
|
|
29
|
-
const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, }) => {
|
|
29
|
+
const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }) => {
|
|
30
30
|
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
31
31
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
32
32
|
(0, validate_frames_per_lambda_1.validateFramesPerLambda)(framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null);
|
|
33
|
+
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
33
34
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
34
35
|
const res = await (0, call_lambda_1.callLambda)({
|
|
35
36
|
functionName,
|
|
@@ -48,12 +49,16 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
|
|
|
48
49
|
quality,
|
|
49
50
|
maxRetries,
|
|
50
51
|
privacy,
|
|
51
|
-
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel :
|
|
52
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
52
53
|
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
53
54
|
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
54
|
-
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds :
|
|
55
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
55
56
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
56
57
|
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
58
|
+
everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
|
|
59
|
+
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
|
|
60
|
+
concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
|
|
61
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
57
62
|
},
|
|
58
63
|
region,
|
|
59
64
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ChromiumOptions } from '@remotion/renderer';
|
|
2
|
-
import type { LogLevel, StillImageFormat } from 'remotion';
|
|
1
|
+
import type { ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
|
|
3
2
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
4
|
-
import type { CostsInfo } from '../shared/constants';
|
|
3
|
+
import type { CostsInfo, OutNameInput } from '../shared/constants';
|
|
4
|
+
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
5
5
|
export declare type RenderStillOnLambdaInput = {
|
|
6
6
|
region: AwsRegion;
|
|
7
7
|
functionName: string;
|
|
@@ -15,10 +15,11 @@ export declare type RenderStillOnLambdaInput = {
|
|
|
15
15
|
quality?: number;
|
|
16
16
|
frame?: number;
|
|
17
17
|
logLevel?: LogLevel;
|
|
18
|
-
outName?:
|
|
18
|
+
outName?: OutNameInput;
|
|
19
19
|
timeoutInMilliseconds?: number;
|
|
20
20
|
chromiumOptions?: ChromiumOptions;
|
|
21
21
|
scale?: number;
|
|
22
|
+
downloadBehavior?: DownloadBehavior;
|
|
22
23
|
};
|
|
23
24
|
export declare type RenderStillOnLambdaOutput = {
|
|
24
25
|
estimatedPrice: CostsInfo;
|
|
@@ -43,4 +44,4 @@ export declare type RenderStillOnLambdaOutput = {
|
|
|
43
44
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
44
45
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
45
46
|
*/
|
|
46
|
-
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
47
|
+
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderStillOnLambda = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
4
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
6
5
|
const constants_1 = require("../shared/constants");
|
|
7
6
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
@@ -21,7 +20,7 @@ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
|
21
20
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
22
21
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
23
22
|
*/
|
|
24
|
-
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, }) => {
|
|
23
|
+
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
|
|
25
24
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
26
25
|
const res = await (0, call_lambda_1.callLambda)({
|
|
27
26
|
functionName,
|
|
@@ -37,11 +36,12 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
37
36
|
frame: frame !== null && frame !== void 0 ? frame : 0,
|
|
38
37
|
privacy,
|
|
39
38
|
attempt: 1,
|
|
40
|
-
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel :
|
|
39
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
41
40
|
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
42
|
-
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds :
|
|
41
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
43
42
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
44
43
|
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
44
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
45
45
|
},
|
|
46
46
|
region,
|
|
47
47
|
});
|
package/dist/cli/args.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ declare type LambdaCommandLineOptions = {
|
|
|
19
19
|
['disable-cloudwatch']: boolean;
|
|
20
20
|
['max-retries']: number;
|
|
21
21
|
['frames-per-lambda']: number;
|
|
22
|
+
['concurrency-per-lambda']: number;
|
|
22
23
|
['out-name']: string | undefined;
|
|
23
24
|
['architecture']: LambdaArchitecture;
|
|
24
25
|
['custom-role-arn']: string | undefined;
|
|
@@ -10,7 +10,7 @@ declare type ChunkProgress = {
|
|
|
10
10
|
chunksInvoked: number;
|
|
11
11
|
doneIn: number | null;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
declare type MultiRenderProgress = {
|
|
14
14
|
lambdaInvokeProgress: LambdaInvokeProgress;
|
|
15
15
|
chunkProgress: ChunkProgress;
|
|
16
16
|
encodingProgress: EncodingProgress;
|
|
@@ -38,7 +38,7 @@ const renderCommand = async (args) => {
|
|
|
38
38
|
(0, quit_1.quit)(1);
|
|
39
39
|
}
|
|
40
40
|
const outName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
41
|
-
const { chromiumOptions, codec, crf, envVariables, frameRange, imageFormat, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, } = await cli_1.CliInternals.getCliOptions({
|
|
41
|
+
const { chromiumOptions, codec, crf, envVariables, frameRange, imageFormat, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, } = await cli_1.CliInternals.getCliOptions({
|
|
42
42
|
type: 'series',
|
|
43
43
|
isLambda: true,
|
|
44
44
|
});
|
|
@@ -72,6 +72,9 @@ const renderCommand = async (args) => {
|
|
|
72
72
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
73
73
|
chromiumOptions,
|
|
74
74
|
scale,
|
|
75
|
+
numberOfGifLoops,
|
|
76
|
+
everyNthFrame,
|
|
77
|
+
concurrencyPerLambda: args_1.parsedLambdaCli['concurrency-per-lambda'],
|
|
75
78
|
});
|
|
76
79
|
const totalSteps = outName ? 5 : 4;
|
|
77
80
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(cli_1.CliInternals.quietFlagProvided());
|
|
@@ -7,7 +7,6 @@ exports.sitesCreateSubcommand = exports.SITES_CREATE_SUBCOMMAND = void 0;
|
|
|
7
7
|
const cli_1 = require("@remotion/cli");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const remotion_1 = require("remotion");
|
|
11
10
|
const deploy_site_1 = require("../../../api/deploy-site");
|
|
12
11
|
const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
|
|
13
12
|
const constants_1 = require("../../../shared/constants");
|
|
@@ -97,8 +96,8 @@ const sitesCreateSubcommand = async (args) => {
|
|
|
97
96
|
};
|
|
98
97
|
updateProgress();
|
|
99
98
|
},
|
|
100
|
-
enableCaching:
|
|
101
|
-
webpackOverride: (_b =
|
|
99
|
+
enableCaching: cli_1.ConfigInternals.getWebpackCaching(),
|
|
100
|
+
webpackOverride: (_b = cli_1.ConfigInternals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : ((f) => f),
|
|
102
101
|
},
|
|
103
102
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
104
103
|
});
|
package/dist/cli/index.js
CHANGED
|
@@ -133,7 +133,7 @@ AWS returned an "TooManyRequestsException" error message which could mean you re
|
|
|
133
133
|
};
|
|
134
134
|
exports.executeCommand = executeCommand;
|
|
135
135
|
const cli = async () => {
|
|
136
|
-
await cli_1.CliInternals.initializeRenderCli('lambda');
|
|
136
|
+
await cli_1.CliInternals.initializeRenderCli(cli_1.CliInternals.findRemotionRoot(), 'lambda');
|
|
137
137
|
await (0, exports.executeCommand)(args_1.parsedLambdaCli._);
|
|
138
138
|
};
|
|
139
139
|
exports.cli = cli;
|
|
@@ -4,9 +4,9 @@ exports.isValidOptimizationProfile = void 0;
|
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const isValidOptimizationProfile = (profile) => {
|
|
6
6
|
return profile.every((timing) => {
|
|
7
|
-
const frames = renderer_1.RenderInternals.
|
|
7
|
+
const frames = renderer_1.RenderInternals.getFramesToRender(timing.frameRange, 1);
|
|
8
8
|
const values = Object.values(timing.timings);
|
|
9
|
-
return frames === values.length && values.every((v) => v > 0);
|
|
9
|
+
return frames.length === values.length && values.every((v) => v > 0);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
exports.isValidOptimizationProfile = isValidOptimizationProfile;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { OptimizationProfile } from './types';
|
|
2
|
-
export declare const planFrameRanges: ({
|
|
3
|
-
chunkCount: number;
|
|
2
|
+
export declare const planFrameRanges: ({ framesPerLambda, optimization, shouldUseOptimization, frameRange, everyNthFrame, }: {
|
|
4
3
|
framesPerLambda: number;
|
|
5
4
|
optimization: OptimizationProfile | null;
|
|
6
5
|
shouldUseOptimization: boolean;
|
|
7
6
|
frameRange: [number, number];
|
|
7
|
+
everyNthFrame: number;
|
|
8
8
|
}) => {
|
|
9
9
|
chunks: [
|
|
10
10
|
number,
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.planFrameRanges = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const can_use_optimization_1 = require("./can-use-optimization");
|
|
6
|
-
const planFrameRanges = ({
|
|
6
|
+
const planFrameRanges = ({ framesPerLambda, optimization, shouldUseOptimization, frameRange, everyNthFrame, }) => {
|
|
7
|
+
const framesToRender = renderer_1.RenderInternals.getFramesToRender(frameRange, everyNthFrame);
|
|
8
|
+
const chunkCount = Math.ceil(framesToRender.length / framesPerLambda);
|
|
7
9
|
if ((0, can_use_optimization_1.canUseOptimization)({
|
|
8
10
|
optimization,
|
|
9
11
|
framesPerLambda,
|
|
@@ -15,13 +17,12 @@ const planFrameRanges = ({ chunkCount, framesPerLambda, optimization, shouldUseO
|
|
|
15
17
|
didUseOptimization: true,
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
|
-
const
|
|
20
|
+
const firstFrame = frameRange[0];
|
|
19
21
|
return {
|
|
20
22
|
chunks: new Array(chunkCount).fill(1).map((_, i) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
];
|
|
23
|
+
const start = i * framesPerLambda * everyNthFrame + firstFrame;
|
|
24
|
+
const end = Math.min(framesToRender[framesToRender.length - 1], (i + 1) * framesPerLambda * everyNthFrame - 1) + firstFrame;
|
|
25
|
+
return [start, end];
|
|
25
26
|
}),
|
|
26
27
|
didUseOptimization: false,
|
|
27
28
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
2
|
import type { LambdaCodec } from '../../shared/validate-lambda-codec';
|
|
3
|
-
export declare const concatVideosS3: ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, }: {
|
|
3
|
+
export declare const concatVideosS3: ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, numberOfGifLoops, }: {
|
|
4
4
|
bucket: string;
|
|
5
5
|
expectedFiles: number;
|
|
6
6
|
onProgress: (frames: number, encodingStart: number) => void;
|
|
@@ -10,6 +10,7 @@ export declare const concatVideosS3: ({ bucket, expectedFiles, onProgress, numbe
|
|
|
10
10
|
codec: LambdaCodec;
|
|
11
11
|
expectedBucketOwner: string;
|
|
12
12
|
fps: number;
|
|
13
|
+
numberOfGifLoops: number | null;
|
|
13
14
|
}) => Promise<{
|
|
14
15
|
outfile: string;
|
|
15
16
|
cleanupChunksProm: Promise<void>;
|
|
@@ -112,7 +112,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
112
112
|
loop();
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
|
-
const concatVideosS3 = async ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, }) => {
|
|
115
|
+
const concatVideosS3 = async ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, numberOfGifLoops, }) => {
|
|
116
116
|
var _a;
|
|
117
117
|
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
118
118
|
if ((0, fs_1.existsSync)(outdir)) {
|
|
@@ -142,6 +142,7 @@ const concatVideosS3 = async ({ bucket, expectedFiles, onProgress, numberOfFrame
|
|
|
142
142
|
numberOfFrames,
|
|
143
143
|
codec: codecForCombining,
|
|
144
144
|
fps,
|
|
145
|
+
numberOfGifLoops,
|
|
145
146
|
});
|
|
146
147
|
combine.end();
|
|
147
148
|
const cleanupChunksProm = ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(outdir, {
|
|
@@ -3,6 +3,7 @@ import type { ReadStream } from 'fs';
|
|
|
3
3
|
import type { Readable } from 'stream';
|
|
4
4
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
5
5
|
import type { Privacy } from '../../shared/constants';
|
|
6
|
+
import type { DownloadBehavior } from '../../shared/content-disposition-header';
|
|
6
7
|
export declare type LambdaLSInput = {
|
|
7
8
|
bucketName: string;
|
|
8
9
|
prefix: string;
|
|
@@ -12,13 +13,14 @@ export declare type LambdaLSInput = {
|
|
|
12
13
|
};
|
|
13
14
|
export declare type LambdaLsReturnType = Promise<_Object[]>;
|
|
14
15
|
export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
|
|
15
|
-
export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, }: {
|
|
16
|
+
export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }: {
|
|
16
17
|
bucketName: string;
|
|
17
18
|
key: string;
|
|
18
19
|
body: ReadStream | string;
|
|
19
20
|
region: AwsRegion;
|
|
20
21
|
privacy: Privacy;
|
|
21
22
|
expectedBucketOwner: string | null;
|
|
23
|
+
downloadBehavior: DownloadBehavior | null;
|
|
22
24
|
}) => Promise<void>;
|
|
23
25
|
export declare const lambdaReadFile: ({ bucketName, key, region, expectedBucketOwner, }: {
|
|
24
26
|
bucketName: string;
|
|
@@ -7,6 +7,7 @@ exports.lambdaReadFile = exports.lambdaWriteFile = exports.lambdaLs = void 0;
|
|
|
7
7
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
8
|
const mime_types_1 = __importDefault(require("mime-types"));
|
|
9
9
|
const aws_clients_1 = require("../../shared/aws-clients");
|
|
10
|
+
const content_disposition_header_1 = require("../../shared/content-disposition-header");
|
|
10
11
|
const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }) => {
|
|
11
12
|
var _a, _b, _c;
|
|
12
13
|
try {
|
|
@@ -46,7 +47,7 @@ const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, conti
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
exports.lambdaLs = lambdaLs;
|
|
49
|
-
const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, }) => {
|
|
50
|
+
const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }) => {
|
|
50
51
|
await (0, aws_clients_1.getS3Client)(region).send(new client_s3_1.PutObjectCommand({
|
|
51
52
|
Bucket: bucketName,
|
|
52
53
|
Key: key,
|
|
@@ -54,6 +55,7 @@ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expecte
|
|
|
54
55
|
ACL: privacy === 'private' ? 'private' : 'public-read',
|
|
55
56
|
ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
|
|
56
57
|
ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
|
|
58
|
+
ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
|
|
57
59
|
}));
|
|
58
60
|
};
|
|
59
61
|
exports.lambdaWriteFile = lambdaWriteFile;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
2
|
export declare type LambdaReadFileProgress = (progress: {
|
|
3
|
-
totalSize: number
|
|
3
|
+
totalSize: number;
|
|
4
4
|
downloaded: number;
|
|
5
|
-
percent: number
|
|
5
|
+
percent: number;
|
|
6
6
|
}) => unknown;
|
|
7
7
|
export declare const lambdaDownloadFileWithProgress: ({ bucketName, key, region, expectedBucketOwner, outputPath, onProgress, }: {
|
|
8
8
|
bucketName: string;
|
|
@@ -15,7 +15,14 @@ const lambdaDownloadFileWithProgress = async ({ bucketName, key, region, expecte
|
|
|
15
15
|
const presigned = await (0, s3_request_presigner_1.getSignedUrl)(client, command);
|
|
16
16
|
const { to, sizeInBytes } = await renderer_1.RenderInternals.downloadFile({
|
|
17
17
|
url: presigned,
|
|
18
|
-
onProgress,
|
|
18
|
+
onProgress: ({ downloaded, percent, totalSize }) => {
|
|
19
|
+
// On Lambda, it should always be a number
|
|
20
|
+
onProgress({
|
|
21
|
+
downloaded,
|
|
22
|
+
percent: percent,
|
|
23
|
+
totalSize: totalSize,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
19
26
|
to: () => outputPath,
|
|
20
27
|
});
|
|
21
28
|
return { sizeInBytes, to };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChromiumOptions, openBrowser } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
1
|
+
import type { ChromiumOptions, FfmpegExecutable, openBrowser } from '@remotion/renderer';
|
|
2
|
+
import type { TCompMetadata } from 'remotion';
|
|
3
3
|
import type { Await } from '../../shared/await';
|
|
4
4
|
declare type ValidateCompositionOptions = {
|
|
5
5
|
serveUrl: string;
|
|
@@ -33,6 +33,7 @@ const writeLambdaError = async ({ bucketName, renderId, errorInfo, expectedBucke
|
|
|
33
33
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
34
34
|
privacy: 'private',
|
|
35
35
|
expectedBucketOwner,
|
|
36
|
+
downloadBehavior: null,
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
39
|
exports.writeLambdaError = writeLambdaError;
|
package/dist/functions/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const constants_1 = require("../shared/constants");
|
|
6
6
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
7
7
|
const is_warm_1 = require("./helpers/is-warm");
|
|
@@ -9,7 +9,7 @@ const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
|
|
|
9
9
|
const info_1 = require("./info");
|
|
10
10
|
const launch_1 = require("./launch");
|
|
11
11
|
const progress_1 = require("./progress");
|
|
12
|
-
const
|
|
12
|
+
const renderer_2 = require("./renderer");
|
|
13
13
|
const start_1 = require("./start");
|
|
14
14
|
const still_1 = require("./still");
|
|
15
15
|
const handler = async (params, context) => {
|
|
@@ -56,10 +56,10 @@ const handler = async (params, context) => {
|
|
|
56
56
|
(0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.renderer, {
|
|
57
57
|
renderId: params.renderId,
|
|
58
58
|
chunk: String(params.chunk),
|
|
59
|
-
dumpLogs: String(
|
|
59
|
+
dumpLogs: String(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')),
|
|
60
60
|
inputProps: JSON.stringify(params.inputProps),
|
|
61
61
|
});
|
|
62
|
-
return (0,
|
|
62
|
+
return (0, renderer_2.rendererHandler)(params, {
|
|
63
63
|
expectedBucketOwner: currentUserId,
|
|
64
64
|
isWarm,
|
|
65
65
|
});
|