@remotion/lambda 4.0.0-alpha4 → 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 +24 -30
- package/dist/admin/generate-etag-list.js +4 -4
- package/dist/admin/make-layer-public.js +59 -87
- package/dist/api/clean-items.js +1 -1
- package/dist/api/create-function.d.ts +1 -3
- package/dist/api/create-function.js +8 -8
- package/dist/api/deploy-function.d.ts +0 -3
- package/dist/api/deploy-function.js +1 -7
- package/dist/api/deploy-site.js +4 -9
- package/dist/api/download-media.d.ts +0 -4
- package/dist/api/download-media.js +3 -7
- package/dist/api/estimate-price.d.ts +1 -3
- package/dist/api/estimate-price.js +3 -9
- package/dist/api/get-compositions-on-lambda.d.ts +2 -2
- package/dist/api/get-or-create-bucket.d.ts +0 -1
- package/dist/api/get-or-create-bucket.js +0 -3
- package/dist/api/get-sites.d.ts +0 -1
- package/dist/api/iam-validation/simulate.js +4 -2
- 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 +10 -6
- package/dist/api/render-media-on-lambda.js +5 -58
- package/dist/api/render-still-on-lambda.d.ts +7 -3
- package/dist/api/render-still-on-lambda.js +6 -3
- package/dist/api/upload-dir.js +7 -7
- package/dist/cli/args.d.ts +0 -2
- package/dist/cli/commands/functions/deploy.js +7 -9
- package/dist/cli/commands/functions/ls.js +4 -1
- package/dist/cli/commands/functions/rm.js +8 -2
- package/dist/cli/commands/functions/rmall.js +8 -2
- package/dist/cli/commands/quotas/increase.js +2 -2
- package/dist/cli/commands/render/render.js +22 -12
- package/dist/cli/commands/sites/create.js +7 -8
- package/dist/cli/commands/still.js +7 -5
- package/dist/cli/help.js +4 -0
- package/dist/cli/helpers/progress-bar.d.ts +1 -2
- package/dist/cli/helpers/progress-bar.js +3 -7
- package/dist/cli/index.js +3 -3
- package/dist/cli/log.d.ts +12 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/compositions.d.ts +1 -1
- package/dist/functions/compositions.js +0 -2
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +1 -3
- package/dist/functions/helpers/calculate-price-from-bucket.js +1 -2
- package/dist/functions/helpers/clean-tmpdir.js +7 -7
- package/dist/functions/helpers/concat-videos.d.ts +2 -4
- package/dist/functions/helpers/concat-videos.js +8 -11
- package/dist/functions/helpers/create-post-render-data.js +0 -2
- package/dist/functions/helpers/get-chromium-executable-path.js +6 -1
- 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/get-progress.js +0 -2
- package/dist/functions/helpers/io.d.ts +1 -1
- package/dist/functions/helpers/is-enosp-err.js +1 -1
- package/dist/functions/helpers/validate-composition.d.ts +3 -5
- package/dist/functions/helpers/validate-composition.js +1 -3
- package/dist/functions/index.d.ts +15 -4
- package/dist/functions/index.js +1 -1
- package/dist/functions/launch.js +10 -14
- package/dist/functions/renderer.js +15 -15
- package/dist/functions/start.js +1 -1
- package/dist/functions/still.js +7 -11
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1 -2
- 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/constants.d.ts +20 -17
- package/dist/shared/constants.js +1 -2
- package/dist/shared/function-zip-path.d.ts +0 -1
- package/dist/shared/function-zip-path.js +3 -4
- package/dist/shared/get-etag.js +4 -4
- package/dist/shared/hosted-layers.d.ts +2 -91
- package/dist/shared/hosted-layers.js +64 -363
- package/dist/shared/invoke-webhook.d.ts +1 -3
- 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 +9 -10
- package/remotionlambda-arm64.zip +0 -0
- package/remotionlambda-x64.zip +0 -0
- package/remotionlambda.zip +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sitesCreateSubcommand = exports.SITES_CREATE_SUBCOMMAND = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
5
6
|
const remotion_1 = require("remotion");
|
|
6
7
|
const deploy_site_1 = require("../../../api/deploy-site");
|
|
7
8
|
const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
|
|
@@ -29,14 +30,16 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
|
|
|
29
30
|
if (desiredSiteName !== undefined) {
|
|
30
31
|
(0, validate_site_name_1.validateSiteName)(desiredSiteName);
|
|
31
32
|
}
|
|
32
|
-
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(
|
|
33
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
34
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
35
|
+
cancelSignal: null,
|
|
36
|
+
});
|
|
33
37
|
const multiProgress = {
|
|
34
38
|
bundleProgress: {
|
|
35
39
|
doneIn: null,
|
|
36
40
|
progress: 0,
|
|
37
41
|
},
|
|
38
42
|
bucketProgress: {
|
|
39
|
-
bucketCreated: false,
|
|
40
43
|
doneIn: null,
|
|
41
44
|
},
|
|
42
45
|
deployProgress: {
|
|
@@ -57,10 +60,6 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
|
|
|
57
60
|
const cliBucketName = (_b = args_1.parsedLambdaCli['force-bucket-name']) !== null && _b !== void 0 ? _b : null;
|
|
58
61
|
const bucketName = cliBucketName !== null && cliBucketName !== void 0 ? cliBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
59
62
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
60
|
-
onBucketEnsured: () => {
|
|
61
|
-
multiProgress.bucketProgress.bucketCreated = true;
|
|
62
|
-
updateProgress();
|
|
63
|
-
},
|
|
64
63
|
})).bucketName;
|
|
65
64
|
multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
|
|
66
65
|
updateProgress();
|
|
@@ -86,8 +85,8 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
|
|
|
86
85
|
};
|
|
87
86
|
updateProgress();
|
|
88
87
|
},
|
|
89
|
-
enableCaching:
|
|
90
|
-
webpackOverride: (_c =
|
|
88
|
+
enableCaching: config_1.ConfigInternals.getWebpackCaching(),
|
|
89
|
+
webpackOverride: (_c = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _c !== void 0 ? _c : ((f) => f),
|
|
91
90
|
},
|
|
92
91
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
93
92
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stillCommand = exports.STILL_COMMAND = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
7
|
const download_media_1 = require("../../api/download-media");
|
|
7
8
|
const render_still_on_lambda_1 = require("../../api/render-still-on-lambda");
|
|
@@ -36,7 +37,7 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
36
37
|
}
|
|
37
38
|
const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
38
39
|
const outName = args_1.parsedLambdaCli['out-name'];
|
|
39
|
-
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout,
|
|
40
|
+
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, } = await cli_1.CliInternals.getCliOptions({
|
|
40
41
|
type: 'still',
|
|
41
42
|
isLambda: true,
|
|
42
43
|
remotionRoot,
|
|
@@ -46,12 +47,13 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
46
47
|
(0, validate_retries_1.validateMaxRetries)(maxRetries);
|
|
47
48
|
const privacy = (_c = args_1.parsedLambdaCli.privacy) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_OUTPUT_PRIVACY;
|
|
48
49
|
(0, validate_privacy_1.validatePrivacy)(privacy);
|
|
49
|
-
const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.
|
|
50
|
+
const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.determineFinalStillImageFormat({
|
|
50
51
|
downloadName,
|
|
51
52
|
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
52
|
-
|
|
53
|
-
cliFlag: (_e = cli_1.CliInternals.parsedCli['image-format']) !== null && _e !== void 0 ? _e : null,
|
|
53
|
+
cliFlag: (_d = cli_1.CliInternals.parsedCli['image-format']) !== null && _d !== void 0 ? _d : null,
|
|
54
54
|
isLambda: true,
|
|
55
|
+
fromUi: null,
|
|
56
|
+
configImageFormat: (_e = config_1.ConfigInternals.getUserPreferredStillImageFormat()) !== null && _e !== void 0 ? _e : null,
|
|
55
57
|
});
|
|
56
58
|
try {
|
|
57
59
|
log_1.Log.info(cli_1.CliInternals.chalk.gray(`functionName = ${functionName}, imageFormat = ${imageFormat} (${imageFormatReason})`));
|
|
@@ -66,7 +68,7 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
66
68
|
maxRetries,
|
|
67
69
|
envVariables,
|
|
68
70
|
frame: stillFrame,
|
|
69
|
-
|
|
71
|
+
jpegQuality,
|
|
70
72
|
logLevel,
|
|
71
73
|
outName,
|
|
72
74
|
chromiumOptions,
|
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();
|
|
@@ -4,10 +4,9 @@ export declare type BundleProgress = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
|
|
6
6
|
export declare type BucketCreationProgress = {
|
|
7
|
-
bucketCreated: boolean;
|
|
8
7
|
doneIn: number | null;
|
|
9
8
|
};
|
|
10
|
-
export declare const makeBucketProgress: ({
|
|
9
|
+
export declare const makeBucketProgress: ({ doneIn }: BucketCreationProgress) => string;
|
|
11
10
|
declare type UploadStats = {
|
|
12
11
|
addedFiles: number;
|
|
13
12
|
removedFiles: number;
|
|
@@ -14,17 +14,13 @@ const makeBundleProgress = ({ progress, doneIn }) => {
|
|
|
14
14
|
].join(' ');
|
|
15
15
|
};
|
|
16
16
|
exports.makeBundleProgress = makeBundleProgress;
|
|
17
|
-
const makeBucketProgress = ({
|
|
18
|
-
const
|
|
19
|
-
const statesFinished = states.filter(Boolean).map((p) => p).length;
|
|
20
|
-
const progress = statesFinished / states.length;
|
|
17
|
+
const makeBucketProgress = ({ doneIn }) => {
|
|
18
|
+
const progress = doneIn === null ? 0 : 1;
|
|
21
19
|
return [
|
|
22
20
|
`(2/3)`,
|
|
23
21
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
24
22
|
`${doneIn === null ? 'Creating' : 'Created'} bucket`,
|
|
25
|
-
doneIn === null
|
|
26
|
-
? `${statesFinished} / ${states.length}`
|
|
27
|
-
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
23
|
+
doneIn === null ? `0/1` : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
28
24
|
].join(' ');
|
|
29
25
|
};
|
|
30
26
|
exports.makeBucketProgress = makeBucketProgress;
|
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
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
export declare const Log: {
|
|
2
2
|
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
3
|
+
verboseAdvanced: (options: {
|
|
4
|
+
indent: boolean;
|
|
5
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
6
|
+
}, message?: any, ...optionalParams: any[]) => void;
|
|
3
7
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
8
|
+
infoAdvanced: (options: {
|
|
9
|
+
indent: boolean;
|
|
10
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
11
|
+
}, message?: any, ...optionalParams: any[]) => void;
|
|
4
12
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
13
|
+
warnAdvanced: (options: {
|
|
14
|
+
indent: boolean;
|
|
15
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
16
|
+
}, message?: any, ...optionalParams: any[]) => void;
|
|
5
17
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
6
18
|
};
|
|
@@ -3,6 +3,6 @@ declare type Options = {
|
|
|
3
3
|
expectedBucketOwner: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const compositionsHandler: (lambdaParams: LambdaPayload, options: Options) => Promise<{
|
|
6
|
-
compositions: import("remotion").
|
|
6
|
+
compositions: import("remotion").AnyCompMetadata[];
|
|
7
7
|
}>;
|
|
8
8
|
export {};
|
|
@@ -43,8 +43,6 @@ const compositionsHandler = async (lambdaParams, options) => {
|
|
|
43
43
|
puppeteerInstance: browserInstance,
|
|
44
44
|
inputProps,
|
|
45
45
|
envVariables: lambdaParams.envVariables,
|
|
46
|
-
ffmpegExecutable: null,
|
|
47
|
-
ffprobeExecutable: null,
|
|
48
46
|
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
|
|
49
47
|
chromiumOptions: lambdaParams.chromiumOptions,
|
|
50
48
|
port: null,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
2
|
import type { RenderMetadata } from '../../shared/constants';
|
|
3
|
-
import type { LambdaArchitecture } from '../../shared/validate-architecture';
|
|
4
3
|
import type { OutputFileMetadata } from './find-output-file-in-bucket';
|
|
5
|
-
export declare const estimatePriceFromBucket: ({ contents, renderMetadata, memorySizeInMb, outputFileMetadata,
|
|
4
|
+
export declare const estimatePriceFromBucket: ({ contents, renderMetadata, memorySizeInMb, outputFileMetadata, diskSizeInMb, lambdasInvoked, }: {
|
|
6
5
|
contents: _Object[];
|
|
7
6
|
renderMetadata: RenderMetadata | null;
|
|
8
7
|
memorySizeInMb: number;
|
|
9
8
|
outputFileMetadata: OutputFileMetadata | null;
|
|
10
|
-
architecture: LambdaArchitecture;
|
|
11
9
|
diskSizeInMb: number;
|
|
12
10
|
lambdasInvoked: number;
|
|
13
11
|
}) => number | null;
|
|
@@ -7,7 +7,7 @@ const parse_lambda_timings_key_1 = require("../../shared/parse-lambda-timings-ke
|
|
|
7
7
|
const calculate_chunk_times_1 = require("./calculate-chunk-times");
|
|
8
8
|
const get_current_region_1 = require("./get-current-region");
|
|
9
9
|
const get_time_to_finish_1 = require("./get-time-to-finish");
|
|
10
|
-
const estimatePriceFromBucket = ({ contents, renderMetadata, memorySizeInMb, outputFileMetadata,
|
|
10
|
+
const estimatePriceFromBucket = ({ contents, renderMetadata, memorySizeInMb, outputFileMetadata, diskSizeInMb, lambdasInvoked, }) => {
|
|
11
11
|
var _a, _b, _c;
|
|
12
12
|
if (!renderMetadata) {
|
|
13
13
|
return null;
|
|
@@ -35,7 +35,6 @@ const estimatePriceFromBucket = ({ contents, renderMetadata, memorySizeInMb, out
|
|
|
35
35
|
type: 'combined-time-for-cost-calculation',
|
|
36
36
|
}) + timeElapsedOfUnfinished,
|
|
37
37
|
memorySizeInMb,
|
|
38
|
-
architecture,
|
|
39
38
|
diskSizeInMb,
|
|
40
39
|
lambdasInvoked,
|
|
41
40
|
}).toPrecision(5));
|
|
@@ -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 = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AudioCodec
|
|
1
|
+
import type { AudioCodec } from '@remotion/renderer';
|
|
2
2
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
3
3
|
import type { LambdaCodec } from '../../shared/validate-lambda-codec';
|
|
4
4
|
import type { EnhancedErrorInfo } from './write-lambda-error';
|
|
@@ -11,14 +11,12 @@ export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId,
|
|
|
11
11
|
expectedBucketOwner: string;
|
|
12
12
|
onErrors: (errors: EnhancedErrorInfo[]) => Promise<void>;
|
|
13
13
|
}) => Promise<string[]>;
|
|
14
|
-
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops,
|
|
14
|
+
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, }: {
|
|
15
15
|
onProgress: (frames: number) => void;
|
|
16
16
|
numberOfFrames: number;
|
|
17
17
|
codec: LambdaCodec;
|
|
18
18
|
fps: number;
|
|
19
19
|
numberOfGifLoops: number | null;
|
|
20
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
21
|
-
remotionRoot: string;
|
|
22
20
|
files: string[];
|
|
23
21
|
outdir: string;
|
|
24
22
|
audioCodec: AudioCodec | null;
|
|
@@ -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
|
});
|
|
@@ -128,9 +128,8 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
128
128
|
});
|
|
129
129
|
};
|
|
130
130
|
exports.getAllFilesS3 = getAllFilesS3;
|
|
131
|
-
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops,
|
|
132
|
-
|
|
133
|
-
const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
|
|
131
|
+
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, }) => {
|
|
132
|
+
const outfile = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
|
|
134
133
|
const combine = (0, timer_1.timer)('Combine videos');
|
|
135
134
|
const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
|
|
136
135
|
await renderer_1.RenderInternals.combineVideos({
|
|
@@ -142,12 +141,10 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
|
|
|
142
141
|
codec,
|
|
143
142
|
fps,
|
|
144
143
|
numberOfGifLoops,
|
|
145
|
-
ffmpegExecutable,
|
|
146
|
-
remotionRoot,
|
|
147
144
|
audioCodec,
|
|
148
145
|
});
|
|
149
146
|
combine.end();
|
|
150
|
-
const cleanupChunksProm =
|
|
147
|
+
const cleanupChunksProm = node_fs_1.default.promises.rm(outdir, {
|
|
151
148
|
recursive: true,
|
|
152
149
|
});
|
|
153
150
|
return { outfile, cleanupChunksProm };
|
|
@@ -6,7 +6,6 @@ const constants_1 = require("../../shared/constants");
|
|
|
6
6
|
const get_most_expensive_chunks_1 = require("../../shared/get-most-expensive-chunks");
|
|
7
7
|
const parse_lambda_timings_key_1 = require("../../shared/parse-lambda-timings-key");
|
|
8
8
|
const calculate_chunk_times_1 = require("./calculate-chunk-times");
|
|
9
|
-
const get_current_architecture_1 = require("./get-current-architecture");
|
|
10
9
|
const get_files_to_delete_1 = require("./get-files-to-delete");
|
|
11
10
|
const get_retry_stats_1 = require("./get-retry-stats");
|
|
12
11
|
const get_time_to_finish_1 = require("./get-time-to-finish");
|
|
@@ -20,7 +19,6 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
|
|
|
20
19
|
durationInMiliseconds: times,
|
|
21
20
|
memorySizeInMb,
|
|
22
21
|
region,
|
|
23
|
-
architecture: (0, get_current_architecture_1.getCurrentArchitecture)(),
|
|
24
22
|
lambdasInvoked: renderMetadata.estimatedTotalLambdaInvokations,
|
|
25
23
|
// We cannot determine the ephemeral storage size, so we
|
|
26
24
|
// overestimate the price, but will only have a miniscule effect (~0.2%)
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.executablePath = void 0;
|
|
5
|
-
if (/^AWS_Lambda_nodejs(?:
|
|
5
|
+
if (/^AWS_Lambda_nodejs(?:18)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') ===
|
|
6
|
+
true) {
|
|
6
7
|
if (process.env.FONTCONFIG_PATH === undefined) {
|
|
7
8
|
process.env.FONTCONFIG_PATH = '/opt';
|
|
8
9
|
process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
|
|
9
10
|
}
|
|
10
11
|
process.env.LD_LIBRARY_PATH = '/opt/lib:/opt/bin';
|
|
12
|
+
process.env.FFMPEG_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffmpeg';
|
|
13
|
+
process.env.FFPROBE_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffprobe';
|
|
14
|
+
process.env.FFMPEG_CWD = '/opt/ffmpeg';
|
|
15
|
+
process.env.COMPOSITOR_PATH = './compositor';
|
|
11
16
|
}
|
|
12
17
|
const executablePath = () => {
|
|
13
18
|
return '/opt/bin/chromium';
|
|
@@ -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
|
}
|
|
@@ -12,7 +12,6 @@ const expected_out_name_1 = require("./expected-out-name");
|
|
|
12
12
|
const find_output_file_in_bucket_1 = require("./find-output-file-in-bucket");
|
|
13
13
|
const format_costs_info_1 = require("./format-costs-info");
|
|
14
14
|
const get_cleanup_progress_1 = require("./get-cleanup-progress");
|
|
15
|
-
const get_current_architecture_1 = require("./get-current-architecture");
|
|
16
15
|
const get_current_region_1 = require("./get-current-region");
|
|
17
16
|
const get_encoding_metadata_1 = require("./get-encoding-metadata");
|
|
18
17
|
const get_final_encoding_status_1 = require("./get-final-encoding-status");
|
|
@@ -116,7 +115,6 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
116
115
|
renderMetadata,
|
|
117
116
|
memorySizeInMb,
|
|
118
117
|
outputFileMetadata: outputFile,
|
|
119
|
-
architecture: (0, get_current_architecture_1.getCurrentArchitecture)(),
|
|
120
118
|
lambdasInvoked: (_b = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _b !== void 0 ? _b : 0,
|
|
121
119
|
// We cannot determine the ephemeral storage size, so we
|
|
122
120
|
// overestimate the price, but will only have a miniscule effect (~0.2%)
|
|
@@ -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';
|
|
@@ -11,6 +11,6 @@ const isErrInsufficientResourcesErr = (err) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.isErrInsufficientResourcesErr = isErrInsufficientResourcesErr;
|
|
13
13
|
const isBrowserCrashedError = (err) => {
|
|
14
|
-
return err.includes('Target closed.');
|
|
14
|
+
return err.includes('Target closed.') || err.includes('Session closed');
|
|
15
15
|
};
|
|
16
16
|
exports.isBrowserCrashedError = isBrowserCrashedError;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChromiumOptions, DownloadMap,
|
|
2
|
-
import type {
|
|
1
|
+
import type { ChromiumOptions, DownloadMap, openBrowser } from '@remotion/renderer';
|
|
2
|
+
import type { AnyCompMetadata } from 'remotion';
|
|
3
3
|
import type { Await } from '../../shared/await';
|
|
4
4
|
declare type ValidateCompositionOptions = {
|
|
5
5
|
serveUrl: string;
|
|
@@ -7,8 +7,6 @@ declare type ValidateCompositionOptions = {
|
|
|
7
7
|
browserInstance: Await<ReturnType<typeof openBrowser>>;
|
|
8
8
|
inputProps: unknown;
|
|
9
9
|
envVariables: Record<string, string> | undefined;
|
|
10
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
11
|
-
ffprobeExecutable: FfmpegExecutable;
|
|
12
10
|
timeoutInMilliseconds: number;
|
|
13
11
|
chromiumOptions: ChromiumOptions;
|
|
14
12
|
port: number | null;
|
|
@@ -16,5 +14,5 @@ declare type ValidateCompositionOptions = {
|
|
|
16
14
|
forceHeight: number | null;
|
|
17
15
|
forceWidth: number | null;
|
|
18
16
|
};
|
|
19
|
-
export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds,
|
|
17
|
+
export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, downloadMap, forceHeight, forceWidth, }: ValidateCompositionOptions) => Promise<AnyCompMetadata>;
|
|
20
18
|
export {};
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateComposition = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const get_chromium_executable_path_1 = require("./get-chromium-executable-path");
|
|
6
|
-
const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds,
|
|
6
|
+
const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, downloadMap, forceHeight, forceWidth, }) => {
|
|
7
7
|
const compositions = await (0, renderer_1.getCompositions)(serveUrl, {
|
|
8
8
|
puppeteerInstance: browserInstance,
|
|
9
9
|
inputProps: inputProps,
|
|
10
10
|
envVariables,
|
|
11
|
-
ffmpegExecutable,
|
|
12
|
-
ffprobeExecutable,
|
|
13
11
|
timeoutInMilliseconds,
|
|
14
12
|
chromiumOptions,
|
|
15
13
|
port,
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { LambdaPayload } from '../shared/constants';
|
|
2
|
-
|
|
3
|
-
import type { LambdaReturnValues } from '../shared/return-values';
|
|
4
|
-
export declare const handler: <T extends LambdaRoutines>(params: LambdaPayload, context: {
|
|
2
|
+
export declare const handler: (params: LambdaPayload, context: {
|
|
5
3
|
invokedFunctionArn: string;
|
|
6
4
|
getRemainingTimeInMillis: () => number;
|
|
7
|
-
}) => Promise<
|
|
5
|
+
}) => Promise<void> | Promise<Promise<{
|
|
6
|
+
output: string;
|
|
7
|
+
size: number;
|
|
8
|
+
bucketName: string;
|
|
9
|
+
estimatedPrice: import("../shared/constants").CostsInfo;
|
|
10
|
+
renderId: string;
|
|
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/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const progress_1 = require("./progress");
|
|
|
13
13
|
const renderer_2 = require("./renderer");
|
|
14
14
|
const start_1 = require("./start");
|
|
15
15
|
const still_1 = require("./still");
|
|
16
|
-
const handler =
|
|
16
|
+
const handler = (params, context) => {
|
|
17
17
|
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
18
18
|
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
19
19
|
if (!context || !context.invokedFunctionArn) {
|
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");
|
|
@@ -149,8 +149,6 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
149
149
|
browserInstance,
|
|
150
150
|
inputProps: await inputPropsPromise,
|
|
151
151
|
envVariables: params.envVariables,
|
|
152
|
-
ffmpegExecutable: null,
|
|
153
|
-
ffprobeExecutable: null,
|
|
154
152
|
timeoutInMilliseconds: params.timeoutInMilliseconds,
|
|
155
153
|
chromiumOptions: params.chromiumOptions,
|
|
156
154
|
port: null,
|
|
@@ -213,7 +211,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
213
211
|
envVariables: params.envVariables,
|
|
214
212
|
pixelFormat: params.pixelFormat,
|
|
215
213
|
proResProfile: params.proResProfile,
|
|
216
|
-
|
|
214
|
+
jpegQuality: params.jpegQuality,
|
|
217
215
|
privacy: params.privacy,
|
|
218
216
|
logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
|
|
219
217
|
attempt: 1,
|
|
@@ -364,13 +362,13 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
364
362
|
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
365
363
|
};
|
|
366
364
|
const fps = comp.fps / params.everyNthFrame;
|
|
367
|
-
const outdir = (0,
|
|
368
|
-
if ((0,
|
|
369
|
-
(
|
|
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, {
|
|
370
368
|
recursive: true,
|
|
371
369
|
});
|
|
372
370
|
}
|
|
373
|
-
(0,
|
|
371
|
+
(0, node_fs_1.mkdirSync)(outdir);
|
|
374
372
|
const files = await (0, concat_videos_1.getAllFilesS3)({
|
|
375
373
|
bucket: params.bucketName,
|
|
376
374
|
expectedFiles: chunkCount,
|
|
@@ -387,18 +385,16 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
387
385
|
codec: params.codec,
|
|
388
386
|
fps,
|
|
389
387
|
numberOfGifLoops: params.numberOfGifLoops,
|
|
390
|
-
ffmpegExecutable: null,
|
|
391
|
-
remotionRoot: process.cwd(),
|
|
392
388
|
files,
|
|
393
389
|
outdir,
|
|
394
390
|
audioCodec: params.audioCodec,
|
|
395
391
|
});
|
|
396
392
|
const encodingStop = Date.now();
|
|
397
|
-
const outputSize =
|
|
393
|
+
const outputSize = node_fs_1.default.statSync(outfile);
|
|
398
394
|
await (0, io_1.lambdaWriteFile)({
|
|
399
395
|
bucketName: renderBucketName,
|
|
400
396
|
key,
|
|
401
|
-
body:
|
|
397
|
+
body: node_fs_1.default.createReadStream(outfile),
|
|
402
398
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
403
399
|
privacy: params.privacy,
|
|
404
400
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -477,7 +473,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
477
473
|
customCredentials: null,
|
|
478
474
|
});
|
|
479
475
|
renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
|
|
480
|
-
await Promise.all([cleanupChunksProm,
|
|
476
|
+
await Promise.all([cleanupChunksProm, node_fs_1.default.promises.rm(outfile)]);
|
|
481
477
|
clearTimeout(webhookDueToTimeout);
|
|
482
478
|
if (params.webhook && !webhookInvoked) {
|
|
483
479
|
try {
|