@remotion/lambda 4.0.150 → 4.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/deploy-site.d.ts +3 -3
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/helpers/can-concat-seamlessly.d.ts +2 -2
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-metadata.d.ts +2 -1
- package/dist/functions/helpers/get-encoding-metadata.js +2 -3
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -0
- package/dist/functions/helpers/get-encoding-progress-step-size.js +7 -0
- package/dist/functions/helpers/get-progress.js +4 -1
- package/dist/functions/helpers/merge-chunks.d.ts +1 -1
- package/dist/functions/helpers/merge-chunks.js +10 -7
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/launch.js +1 -1
- package/dist/functions/merge.js +1 -1
- package/dist/functions/renderer.js +6 -8
- package/dist/internals.d.ts +6 -6
- package/dist/shared/constants.d.ts +0 -1
- package/dist/shared/constants.js +1 -3
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
- package/dist/functions/streaming/streaming.d.ts +0 -75
- package/dist/functions/streaming/streaming.js +0 -160
|
@@ -59,11 +59,11 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
|
|
|
59
59
|
getValue: ({ commandLine }: {
|
|
60
60
|
commandLine: Record<string, unknown>;
|
|
61
61
|
}) => {
|
|
62
|
-
value: "error" | "
|
|
62
|
+
value: "error" | "verbose" | "info" | "warn";
|
|
63
63
|
source: string;
|
|
64
64
|
};
|
|
65
|
-
setConfig: (newLogLevel: "error" | "
|
|
66
|
-
type: "error" | "
|
|
65
|
+
setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
|
|
66
|
+
type: "error" | "verbose" | "info" | "warn";
|
|
67
67
|
};
|
|
68
68
|
readonly throwIfSiteExists: {
|
|
69
69
|
cliFlag: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AudioCodec } from '@remotion/renderer';
|
|
1
|
+
import type { AudioCodec, Codec } from '@remotion/renderer';
|
|
2
2
|
export declare const canConcatAudioSeamlessly: (audioCodec: AudioCodec | null, chunkDurationInFrames: number) => boolean;
|
|
3
|
-
export declare const canConcatVideoSeamlessly: (codec:
|
|
3
|
+
export declare const canConcatVideoSeamlessly: (codec: Codec) => boolean;
|
|
@@ -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";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
2
|
import type { EncodingProgress } from '../../defaults';
|
|
3
|
-
export declare const getEncodingMetadata: ({ exists, frameCount, }: {
|
|
3
|
+
export declare const getEncodingMetadata: ({ exists, frameCount, stepSize, }: {
|
|
4
4
|
exists: _Object | undefined;
|
|
5
5
|
frameCount: number;
|
|
6
|
+
stepSize: number;
|
|
6
7
|
}) => EncodingProgress | null;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEncodingMetadata = void 0;
|
|
4
|
-
const defaults_1 = require("../../defaults");
|
|
5
4
|
const chunk_progress_1 = require("../../shared/chunk-progress");
|
|
6
|
-
const getEncodingMetadata = ({ exists, frameCount, }) => {
|
|
5
|
+
const getEncodingMetadata = ({ exists, frameCount, stepSize, }) => {
|
|
7
6
|
if (!exists) {
|
|
8
7
|
return null;
|
|
9
8
|
}
|
|
10
9
|
const framesEncoded = (0, chunk_progress_1.getProgressOfChunk)(exists.ETag);
|
|
11
10
|
// We only report every 100 frames encoded so that we are able to report up to 2000 * 100 ETags => 200000 frames
|
|
12
11
|
return {
|
|
13
|
-
framesEncoded: Math.min(frameCount, framesEncoded *
|
|
12
|
+
framesEncoded: Math.min(frameCount, framesEncoded * stepSize),
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
15
|
exports.getEncodingMetadata = getEncodingMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getEncodingProgressStepSize: (totalFrames: number) => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEncodingProgressStepSize = void 0;
|
|
4
|
+
const getEncodingProgressStepSize = (totalFrames) => {
|
|
5
|
+
return Math.min(100, Math.max(5, totalFrames / 10));
|
|
6
|
+
};
|
|
7
|
+
exports.getEncodingProgressStepSize = getEncodingProgressStepSize;
|
|
@@ -15,6 +15,7 @@ const format_costs_info_1 = require("./format-costs-info");
|
|
|
15
15
|
const get_cleanup_progress_1 = require("./get-cleanup-progress");
|
|
16
16
|
const get_current_region_1 = require("./get-current-region");
|
|
17
17
|
const get_encoding_metadata_1 = require("./get-encoding-metadata");
|
|
18
|
+
const get_encoding_progress_step_size_1 = require("./get-encoding-progress-step-size");
|
|
18
19
|
const get_final_encoding_status_1 = require("./get-final-encoding-status");
|
|
19
20
|
const get_lambdas_invoked_stats_1 = require("./get-lambdas-invoked-stats");
|
|
20
21
|
const get_overall_progress_1 = require("./get-overall-progress");
|
|
@@ -168,9 +169,11 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
168
169
|
const frameCount = renderMetadata
|
|
169
170
|
? renderer_1.RenderInternals.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length
|
|
170
171
|
: null;
|
|
172
|
+
const frameCountOrNull = frameCount === null ? 0 : frameCount;
|
|
171
173
|
const encodingStatus = (0, get_encoding_metadata_1.getEncodingMetadata)({
|
|
172
174
|
exists: contents.find((c) => c.Key === (0, constants_1.encodingProgressKey)(renderId)),
|
|
173
|
-
frameCount:
|
|
175
|
+
frameCount: frameCountOrNull,
|
|
176
|
+
stepSize: (0, get_encoding_progress_step_size_1.getEncodingProgressStepSize)(frameCountOrNull),
|
|
174
177
|
});
|
|
175
178
|
const finalEncodingStatus = (0, get_final_encoding_status_1.getFinalEncodingStatus)({
|
|
176
179
|
encodingProgress: encodingStatus,
|
|
@@ -15,6 +15,7 @@ const concat_videos_1 = require("./concat-videos");
|
|
|
15
15
|
const create_post_render_data_1 = require("./create-post-render-data");
|
|
16
16
|
const delete_chunks_1 = require("./delete-chunks");
|
|
17
17
|
const get_current_region_1 = require("./get-current-region");
|
|
18
|
+
const get_encoding_progress_step_size_1 = require("./get-encoding-progress-step-size");
|
|
18
19
|
const get_files_to_delete_1 = require("./get-files-to-delete");
|
|
19
20
|
const get_output_url_from_metadata_1 = require("./get-output-url-from-metadata");
|
|
20
21
|
const inspect_errors_1 = require("./inspect-errors");
|
|
@@ -24,17 +25,18 @@ const timer_1 = require("./timer");
|
|
|
24
25
|
const write_lambda_error_1 = require("./write-lambda-error");
|
|
25
26
|
const write_post_render_data_1 = require("./write-post-render-data");
|
|
26
27
|
const mergeChunksAndFinishRender = async (options) => {
|
|
27
|
-
let lastProgressUploaded =
|
|
28
|
+
let lastProgressUploaded = Date.now();
|
|
28
29
|
const onProgress = (framesEncoded) => {
|
|
29
|
-
const deltaSinceLastProgressUploaded =
|
|
30
|
-
if (deltaSinceLastProgressUploaded <
|
|
30
|
+
const deltaSinceLastProgressUploaded = Date.now() - lastProgressUploaded;
|
|
31
|
+
if (deltaSinceLastProgressUploaded < 1500 &&
|
|
32
|
+
framesEncoded !== options.numberOfFrames) {
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
|
-
lastProgressUploaded =
|
|
35
|
+
lastProgressUploaded = Date.now();
|
|
34
36
|
(0, io_1.lambdaWriteFile)({
|
|
35
37
|
bucketName: options.bucketName,
|
|
36
38
|
key: (0, constants_1.encodingProgressKey)(options.renderId),
|
|
37
|
-
body: String(Math.round(framesEncoded /
|
|
39
|
+
body: String(Math.round(framesEncoded / (0, get_encoding_progress_step_size_1.getEncodingProgressStepSize)(options.numberOfFrames))),
|
|
38
40
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
39
41
|
privacy: 'private',
|
|
40
42
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -104,7 +106,7 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
104
106
|
}
|
|
105
107
|
const { outfile, cleanupChunksProm } = await (0, concat_videos_1.concatVideosS3)({
|
|
106
108
|
onProgress,
|
|
107
|
-
numberOfFrames: options.
|
|
109
|
+
numberOfFrames: options.numberOfFrames,
|
|
108
110
|
codec: options.codec,
|
|
109
111
|
fps: options.fps,
|
|
110
112
|
numberOfGifLoops: options.numberOfGifLoops,
|
|
@@ -142,7 +144,8 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
142
144
|
const finalEncodingProgressProm = (0, io_1.lambdaWriteFile)({
|
|
143
145
|
bucketName: options.bucketName,
|
|
144
146
|
key: (0, constants_1.encodingProgressKey)(options.renderId),
|
|
145
|
-
body: String(Math.ceil(options.
|
|
147
|
+
body: String(Math.ceil(options.numberOfFrames /
|
|
148
|
+
(0, get_encoding_progress_step_size_1.getEncodingProgressStepSize)(options.numberOfFrames))),
|
|
146
149
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
147
150
|
privacy: 'private',
|
|
148
151
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
4
4
|
type: z.ZodLiteral<"render-id-determined">;
|
|
5
5
|
renderId: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
renderId: string;
|
|
8
7
|
type: "render-id-determined";
|
|
9
|
-
}, {
|
|
10
8
|
renderId: string;
|
|
9
|
+
}, {
|
|
11
10
|
type: "render-id-determined";
|
|
11
|
+
renderId: string;
|
|
12
12
|
}>]>;
|
|
13
13
|
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
14
|
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
-
renderId: string;
|
|
16
15
|
type: "render-id-determined";
|
|
16
|
+
renderId: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
19
|
export {};
|
package/dist/functions/launch.js
CHANGED
|
@@ -274,7 +274,7 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
274
274
|
bucketName: params.bucketName,
|
|
275
275
|
renderId: params.renderId,
|
|
276
276
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
277
|
-
|
|
277
|
+
numberOfFrames: frameCount.length,
|
|
278
278
|
audioCodec: params.audioCodec,
|
|
279
279
|
chunkCount: chunks.length,
|
|
280
280
|
codec: params.codec,
|
package/dist/functions/merge.js
CHANGED
|
@@ -37,7 +37,7 @@ const mergeHandler = async (params, options) => {
|
|
|
37
37
|
downloadBehavior: renderMetadata.downloadBehavior,
|
|
38
38
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
39
39
|
fps,
|
|
40
|
-
|
|
40
|
+
numberOfFrames: frameCount.length,
|
|
41
41
|
inputProps: params.inputProps,
|
|
42
42
|
key,
|
|
43
43
|
numberOfGifLoops: renderMetadata.numberOfGifLoops,
|
|
@@ -69,14 +69,12 @@ const renderHandler = async (params, options, logs) => {
|
|
|
69
69
|
const seamlessAudio = (0, can_concat_seamlessly_1.canConcatAudioSeamlessly)(defaultAudioCodec, params.framesPerLambda);
|
|
70
70
|
const seamlessVideo = (0, can_concat_seamlessly_1.canConcatVideoSeamlessly)(params.codec);
|
|
71
71
|
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: params.logLevel }, `Preparing for rendering a chunk. Audio = ${seamlessAudio ? 'seamless' : 'normal'}, Video = ${seamlessVideo ? 'seamless' : 'normal'}`, params.logLevel);
|
|
72
|
-
const chunkCodec = params.codec === '
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
? defaultAudioCodec
|
|
79
|
-
: 'pcm-16';
|
|
72
|
+
const chunkCodec = seamlessVideo && params.codec === 'h264' ? 'h264-ts' : params.codec;
|
|
73
|
+
const audioCodec = defaultAudioCodec === null
|
|
74
|
+
? null
|
|
75
|
+
: seamlessAudio
|
|
76
|
+
? defaultAudioCodec
|
|
77
|
+
: 'pcm-16';
|
|
80
78
|
const videoExtension = renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, audioCodec);
|
|
81
79
|
const audioExtension = audioCodec
|
|
82
80
|
? renderer_1.RenderInternals.getExtensionFromAudioCodec(audioCodec)
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const LambdaInternals: {
|
|
2
|
-
executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "
|
|
2
|
+
executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "verbose" | "info" | "warn") => Promise<void>;
|
|
3
3
|
makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, }: import("./api/make-lambda-payload").InnerRenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
|
|
4
4
|
getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, }: import(".").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
|
|
5
5
|
makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, }: import("./api/render-still-on-lambda").RenderStillOnLambdaNonNullInput) => Promise<{
|
|
@@ -14,7 +14,7 @@ export declare const LambdaInternals: {
|
|
|
14
14
|
maxRetries: number;
|
|
15
15
|
frame: number;
|
|
16
16
|
privacy: import("./defaults").Privacy;
|
|
17
|
-
logLevel: "error" | "
|
|
17
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
18
18
|
outName: import("./defaults").OutNameInput | null;
|
|
19
19
|
timeoutInMilliseconds: number;
|
|
20
20
|
chromiumOptions: import("@remotion/renderer").ChromiumOptions;
|
|
@@ -30,7 +30,7 @@ export declare const LambdaInternals: {
|
|
|
30
30
|
internalDeploySite: (args_0: {
|
|
31
31
|
entryPoint: string;
|
|
32
32
|
bucketName: string;
|
|
33
|
-
region: "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" | "
|
|
33
|
+
region: "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";
|
|
34
34
|
} & {
|
|
35
35
|
siteName: string;
|
|
36
36
|
options: {
|
|
@@ -56,11 +56,11 @@ export declare const LambdaInternals: {
|
|
|
56
56
|
getValue: ({ commandLine }: {
|
|
57
57
|
commandLine: Record<string, unknown>;
|
|
58
58
|
}) => {
|
|
59
|
-
value: "error" | "
|
|
59
|
+
value: "error" | "verbose" | "info" | "warn";
|
|
60
60
|
source: string;
|
|
61
61
|
};
|
|
62
|
-
setConfig: (newLogLevel: "error" | "
|
|
63
|
-
type: "error" | "
|
|
62
|
+
setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
|
|
63
|
+
type: "error" | "verbose" | "info" | "warn";
|
|
64
64
|
};
|
|
65
65
|
readonly throwIfSiteExists: {
|
|
66
66
|
cliFlag: string;
|
|
@@ -27,7 +27,6 @@ export declare const MIN_EPHEMERAL_STORAGE_IN_MB = 512;
|
|
|
27
27
|
export declare const MAX_EPHEMERAL_STORAGE_IN_MB = 10240;
|
|
28
28
|
export declare const DEFAULT_OUTPUT_PRIVACY: Privacy;
|
|
29
29
|
export declare const DEFAULT_CLOUDWATCH_RETENTION_PERIOD = 14;
|
|
30
|
-
export declare const ENCODING_PROGRESS_STEP_SIZE = 100;
|
|
31
30
|
export declare const REMOTION_BUCKET_PREFIX = "remotionlambda-";
|
|
32
31
|
export declare const RENDER_FN_PREFIX = "remotion-render-";
|
|
33
32
|
export declare const LOG_GROUP_PREFIX = "/aws/lambda/";
|
package/dist/shared/constants.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.defaultPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = 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.LAMBDA_INSIGHTS_PREFIX = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.
|
|
4
|
-
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = void 0;
|
|
3
|
+
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.resolvedPropsKey = exports.inputPropsKey = exports.defaultPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = 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.LAMBDA_INSIGHTS_PREFIX = 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_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
|
|
5
4
|
exports.MIN_MEMORY = 512;
|
|
6
5
|
exports.MAX_MEMORY = 10240;
|
|
7
6
|
exports.DEFAULT_MEMORY_SIZE = 2048;
|
|
@@ -20,7 +19,6 @@ exports.MIN_EPHEMERAL_STORAGE_IN_MB = 512;
|
|
|
20
19
|
exports.MAX_EPHEMERAL_STORAGE_IN_MB = 10240;
|
|
21
20
|
exports.DEFAULT_OUTPUT_PRIVACY = 'public';
|
|
22
21
|
exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = 14;
|
|
23
|
-
exports.ENCODING_PROGRESS_STEP_SIZE = 100;
|
|
24
22
|
exports.REMOTION_BUCKET_PREFIX = 'remotionlambda-';
|
|
25
23
|
exports.RENDER_FN_PREFIX = 'remotion-render-';
|
|
26
24
|
exports.LOG_GROUP_PREFIX = '/aws/lambda/';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.152",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@aws-sdk/s3-request-presigner": "3.382.0",
|
|
26
26
|
"mime-types": "2.1.34",
|
|
27
27
|
"zod": "3.22.3",
|
|
28
|
-
"@remotion/
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"remotion": "4.0.
|
|
28
|
+
"@remotion/cli": "4.0.152",
|
|
29
|
+
"@remotion/renderer": "4.0.152",
|
|
30
|
+
"@remotion/bundler": "4.0.152",
|
|
31
|
+
"remotion": "4.0.152"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jonny/eslint-config": "3.0.281",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"ts-node": "10.9.2",
|
|
45
45
|
"vitest": "0.31.1",
|
|
46
46
|
"zip-lib": "^0.7.2",
|
|
47
|
-
"@remotion/
|
|
48
|
-
"@remotion/
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.152",
|
|
48
|
+
"@remotion/bundler": "4.0.152"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.152"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare const framesRendered: "frames-rendered";
|
|
3
|
-
declare const errorOccurred: "error-occurred";
|
|
4
|
-
declare const renderIdDetermined: "render-id-determined";
|
|
5
|
-
declare const videoChunkRendered: "video-chunk-rendered";
|
|
6
|
-
declare const audioChunkRendered: "audio-chunk-rendered";
|
|
7
|
-
declare const responseJson: "response-json";
|
|
8
|
-
declare const messageTypes: {
|
|
9
|
-
readonly '1': {
|
|
10
|
-
readonly type: "frames-rendered";
|
|
11
|
-
};
|
|
12
|
-
readonly '2': {
|
|
13
|
-
readonly type: "error-occurred";
|
|
14
|
-
};
|
|
15
|
-
readonly '3': {
|
|
16
|
-
readonly type: "render-id-determined";
|
|
17
|
-
};
|
|
18
|
-
readonly '4': {
|
|
19
|
-
readonly type: "video-chunk-rendered";
|
|
20
|
-
};
|
|
21
|
-
readonly '5': {
|
|
22
|
-
readonly type: "audio-chunk-rendered";
|
|
23
|
-
};
|
|
24
|
-
readonly '6': {
|
|
25
|
-
readonly type: "response-json";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
type MessageTypeId = keyof typeof messageTypes;
|
|
29
|
-
type MessageType = (typeof messageTypes)[MessageTypeId]['type'];
|
|
30
|
-
export declare const formatMap: {
|
|
31
|
-
[key in MessageType]: 'json' | 'binary';
|
|
32
|
-
};
|
|
33
|
-
export type StreamingPayload = {
|
|
34
|
-
type: typeof framesRendered;
|
|
35
|
-
payload: {
|
|
36
|
-
frames: number;
|
|
37
|
-
};
|
|
38
|
-
} | {
|
|
39
|
-
type: typeof videoChunkRendered;
|
|
40
|
-
payload: Buffer;
|
|
41
|
-
} | {
|
|
42
|
-
type: typeof audioChunkRendered;
|
|
43
|
-
payload: Buffer;
|
|
44
|
-
} | {
|
|
45
|
-
type: typeof errorOccurred;
|
|
46
|
-
payload: {
|
|
47
|
-
error: string;
|
|
48
|
-
};
|
|
49
|
-
} | {
|
|
50
|
-
type: typeof renderIdDetermined;
|
|
51
|
-
payload: {
|
|
52
|
-
renderId: string;
|
|
53
|
-
};
|
|
54
|
-
} | {
|
|
55
|
-
type: typeof responseJson;
|
|
56
|
-
payload: Record<string, unknown>;
|
|
57
|
-
};
|
|
58
|
-
export declare const messageTypeIdToMessage: (messageTypeId: MessageTypeId) => MessageType;
|
|
59
|
-
export declare const messageTypeToMessageId: (messageType: MessageType) => MessageTypeId;
|
|
60
|
-
type StreamingMessage = {
|
|
61
|
-
successType: 'error' | 'success';
|
|
62
|
-
message: StreamingPayload;
|
|
63
|
-
};
|
|
64
|
-
export type OnMessage = (options: StreamingMessage) => void;
|
|
65
|
-
export declare const makeStreaming: (options: {
|
|
66
|
-
onMessage: OnMessage;
|
|
67
|
-
}) => {
|
|
68
|
-
addData: (data: Buffer) => void;
|
|
69
|
-
};
|
|
70
|
-
export declare const makePayloadMessage: ({ message, status, }: {
|
|
71
|
-
message: StreamingPayload;
|
|
72
|
-
status: 0 | 1;
|
|
73
|
-
}) => Buffer;
|
|
74
|
-
export type OnStream = (payload: StreamingPayload) => Promise<void>;
|
|
75
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePayloadMessage = exports.makeStreaming = exports.messageTypeToMessageId = exports.messageTypeIdToMessage = exports.formatMap = void 0;
|
|
4
|
-
const framesRendered = 'frames-rendered';
|
|
5
|
-
const errorOccurred = 'error-occurred';
|
|
6
|
-
const renderIdDetermined = 'render-id-determined';
|
|
7
|
-
const videoChunkRendered = 'video-chunk-rendered';
|
|
8
|
-
const audioChunkRendered = 'audio-chunk-rendered';
|
|
9
|
-
const responseJson = 'response-json';
|
|
10
|
-
const messageTypes = {
|
|
11
|
-
'1': { type: framesRendered },
|
|
12
|
-
'2': { type: errorOccurred },
|
|
13
|
-
'3': { type: renderIdDetermined },
|
|
14
|
-
'4': { type: videoChunkRendered },
|
|
15
|
-
'5': { type: audioChunkRendered },
|
|
16
|
-
'6': { type: responseJson },
|
|
17
|
-
};
|
|
18
|
-
exports.formatMap = {
|
|
19
|
-
[framesRendered]: 'json',
|
|
20
|
-
[errorOccurred]: 'json',
|
|
21
|
-
[renderIdDetermined]: 'json',
|
|
22
|
-
[responseJson]: 'json',
|
|
23
|
-
[videoChunkRendered]: 'binary',
|
|
24
|
-
[audioChunkRendered]: 'binary',
|
|
25
|
-
};
|
|
26
|
-
const messageTypeIdToMessage = (messageTypeId) => {
|
|
27
|
-
const types = messageTypes[messageTypeId];
|
|
28
|
-
if (!types) {
|
|
29
|
-
throw new Error(`Unknown message type id ${messageTypeId}`);
|
|
30
|
-
}
|
|
31
|
-
return types.type;
|
|
32
|
-
};
|
|
33
|
-
exports.messageTypeIdToMessage = messageTypeIdToMessage;
|
|
34
|
-
const messageTypeToMessageId = (messageType) => {
|
|
35
|
-
const id = Object.keys(messageTypes).find((key) => messageTypes[key].type === messageType);
|
|
36
|
-
if (!id) {
|
|
37
|
-
throw new Error(`Unknown message type ${messageType}`);
|
|
38
|
-
}
|
|
39
|
-
return id;
|
|
40
|
-
};
|
|
41
|
-
exports.messageTypeToMessageId = messageTypeToMessageId;
|
|
42
|
-
const magicSeparator = Buffer.from('remotion_buffer:');
|
|
43
|
-
const parseJsonOrThrowSource = (data, type) => {
|
|
44
|
-
const asString = data.toString('utf-8');
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(asString);
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
throw new Error(`Invalid JSON (${type}): ${asString}`);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const makeStreaming = (options) => {
|
|
53
|
-
let outputBuffer = Buffer.from('');
|
|
54
|
-
let unprocessedBuffers = [];
|
|
55
|
-
let missingData = null;
|
|
56
|
-
const processInput = () => {
|
|
57
|
-
let separatorIndex = outputBuffer.indexOf(magicSeparator);
|
|
58
|
-
if (separatorIndex === -1) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
separatorIndex += magicSeparator.length;
|
|
62
|
-
let messageTypeString = '';
|
|
63
|
-
let lengthString = '';
|
|
64
|
-
let statusString = '';
|
|
65
|
-
// Each message has the structure with `remotion_buffer:{[message_type_id]}:{[length]}`
|
|
66
|
-
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
67
|
-
// we'll extract the data and pass it to the callback.
|
|
68
|
-
// eslint-disable-next-line no-constant-condition
|
|
69
|
-
while (true) {
|
|
70
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
71
|
-
// 0x3a is the character ":"
|
|
72
|
-
if (nextDigit === 0x3a) {
|
|
73
|
-
separatorIndex++;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
separatorIndex++;
|
|
77
|
-
messageTypeString += String.fromCharCode(nextDigit);
|
|
78
|
-
}
|
|
79
|
-
// eslint-disable-next-line no-constant-condition
|
|
80
|
-
while (true) {
|
|
81
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
82
|
-
if (nextDigit === 0x3a) {
|
|
83
|
-
separatorIndex++;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
separatorIndex++;
|
|
87
|
-
lengthString += String.fromCharCode(nextDigit);
|
|
88
|
-
}
|
|
89
|
-
// eslint-disable-next-line no-constant-condition
|
|
90
|
-
while (true) {
|
|
91
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
92
|
-
if (nextDigit === 0x3a) {
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
separatorIndex++;
|
|
96
|
-
statusString += String.fromCharCode(nextDigit);
|
|
97
|
-
}
|
|
98
|
-
const length = Number(lengthString);
|
|
99
|
-
const status = Number(statusString);
|
|
100
|
-
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
101
|
-
if (dataLength < length) {
|
|
102
|
-
missingData = {
|
|
103
|
-
dataMissing: length - dataLength,
|
|
104
|
-
};
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
108
|
-
const messageType = (0, exports.messageTypeIdToMessage)(messageTypeString);
|
|
109
|
-
const innerPayload = exports.formatMap[messageType] === 'json'
|
|
110
|
-
? parseJsonOrThrowSource(data, messageType)
|
|
111
|
-
: data;
|
|
112
|
-
const payload = {
|
|
113
|
-
type: messageType,
|
|
114
|
-
payload: innerPayload,
|
|
115
|
-
};
|
|
116
|
-
options.onMessage({
|
|
117
|
-
successType: status === 1 ? 'error' : 'success',
|
|
118
|
-
message: payload,
|
|
119
|
-
});
|
|
120
|
-
missingData = null;
|
|
121
|
-
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
122
|
-
processInput();
|
|
123
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
addData: (data) => {
|
|
126
|
-
unprocessedBuffers.push(data);
|
|
127
|
-
const separatorIndex = data.indexOf(magicSeparator);
|
|
128
|
-
if (separatorIndex === -1) {
|
|
129
|
-
if (missingData) {
|
|
130
|
-
missingData.dataMissing -= data.length;
|
|
131
|
-
}
|
|
132
|
-
if (!missingData || missingData.dataMissing > 0) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
unprocessedBuffers.unshift(outputBuffer);
|
|
137
|
-
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
138
|
-
unprocessedBuffers = [];
|
|
139
|
-
processInput();
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
exports.makeStreaming = makeStreaming;
|
|
144
|
-
const makePayloadMessage = ({ message, status, }) => {
|
|
145
|
-
const body = exports.formatMap[message.type] === 'json'
|
|
146
|
-
? Buffer.from(JSON.stringify(message.payload))
|
|
147
|
-
: message.payload;
|
|
148
|
-
const concat = Buffer.concat([
|
|
149
|
-
magicSeparator,
|
|
150
|
-
Buffer.from((0, exports.messageTypeToMessageId)(message.type).toString()),
|
|
151
|
-
Buffer.from(':'),
|
|
152
|
-
Buffer.from(body.length.toString()),
|
|
153
|
-
Buffer.from(':'),
|
|
154
|
-
Buffer.from(String(status)),
|
|
155
|
-
Buffer.from(':'),
|
|
156
|
-
body,
|
|
157
|
-
]);
|
|
158
|
-
return concat;
|
|
159
|
-
};
|
|
160
|
-
exports.makePayloadMessage = makePayloadMessage;
|