@remotion/lambda 4.0.44 → 4.0.45
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/cli/helpers/validate.d.ts +4 -0
- package/dist/cli/helpers/validate.js +8 -0
- package/dist/functions/index.js +1 -0
- package/dist/functions/launch.js +1 -0
- package/dist/functions/streaming/streaming.d.ts +6 -54
- package/dist/functions/streaming/streaming.js +16 -60
- package/dist/shared/constants.d.ts +1 -0
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
|
|
4
|
+
/* eslint-disable prefer-destructuring */
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
exports.validateFps = remotion_1.Internals.validateFps;
|
|
7
|
+
exports.validateDimension = remotion_1.Internals.validateDimension;
|
|
8
|
+
exports.validateDurationInFrames = remotion_1.Internals.validateDurationInFrames;
|
package/dist/functions/index.js
CHANGED
|
@@ -129,6 +129,7 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
129
129
|
renderId: params.renderId,
|
|
130
130
|
isWarm,
|
|
131
131
|
});
|
|
132
|
+
renderer_1.RenderInternals.setLogLevel(params.logLevel);
|
|
132
133
|
const response = await (0, merge_1.mergeHandler)(params, {
|
|
133
134
|
expectedBucketOwner: currentUserId,
|
|
134
135
|
});
|
package/dist/functions/launch.js
CHANGED
|
@@ -292,6 +292,7 @@ const launchHandler = async (params, options) => {
|
|
|
292
292
|
outName: params.outName,
|
|
293
293
|
serializedResolvedProps: allChunksAvailable.serializedResolvedProps,
|
|
294
294
|
inputProps: allChunksAvailable.inputProps,
|
|
295
|
+
logLevel: params.logLevel,
|
|
295
296
|
},
|
|
296
297
|
retries: 2,
|
|
297
298
|
});
|
|
@@ -1,60 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
declare const chunkRendered: "chunk-rendered";
|
|
6
|
-
declare const messageTypes: {
|
|
7
|
-
readonly '1': {
|
|
8
|
-
readonly type: "frames-rendered";
|
|
9
|
-
};
|
|
10
|
-
readonly '2': {
|
|
11
|
-
readonly type: "error-occurred";
|
|
12
|
-
};
|
|
13
|
-
readonly '3': {
|
|
14
|
-
readonly type: "render-id-determined";
|
|
15
|
-
};
|
|
16
|
-
readonly '4': {
|
|
17
|
-
readonly type: "chunk-rendered";
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type MessageTypeId = keyof typeof messageTypes;
|
|
21
|
-
type MessageType = (typeof messageTypes)[MessageTypeId]['type'];
|
|
22
|
-
export declare const formatMap: {
|
|
23
|
-
[key in MessageType]: 'json' | 'binary';
|
|
2
|
+
type OnMessage = (type: 'error' | 'success', nonce: string, data: Buffer) => void;
|
|
3
|
+
export declare const makeStreaming: (onMessage: OnMessage) => {
|
|
4
|
+
addData: (data: Buffer) => void;
|
|
24
5
|
};
|
|
6
|
+
export declare const makePayloadMessage: (nonce: number, data: Buffer, status: 0 | 1) => Buffer;
|
|
25
7
|
export type StreamingPayload = {
|
|
26
|
-
type:
|
|
27
|
-
|
|
28
|
-
frames: number;
|
|
29
|
-
};
|
|
30
|
-
} | {
|
|
31
|
-
type: typeof chunkRendered;
|
|
32
|
-
payload: Buffer;
|
|
33
|
-
} | {
|
|
34
|
-
type: typeof errorOccurred;
|
|
35
|
-
payload: {
|
|
36
|
-
error: string;
|
|
37
|
-
};
|
|
38
|
-
} | {
|
|
39
|
-
type: typeof renderIdDetermined;
|
|
40
|
-
payload: {
|
|
41
|
-
renderId: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export declare const messageTypeIdToMessage: (messageTypeId: MessageTypeId) => MessageType;
|
|
45
|
-
export declare const messageTypeToMessageId: (messageType: MessageType) => MessageTypeId;
|
|
46
|
-
export type OnMessage = (options: {
|
|
47
|
-
successType: 'error' | 'success';
|
|
48
|
-
message: StreamingPayload;
|
|
49
|
-
}) => void;
|
|
50
|
-
export declare const makeStreaming: (options: {
|
|
51
|
-
onMessage: OnMessage;
|
|
52
|
-
}) => {
|
|
53
|
-
addData: (data: Buffer) => void;
|
|
8
|
+
type: 'frames-rendered';
|
|
9
|
+
frames: number;
|
|
54
10
|
};
|
|
55
|
-
export declare const makePayloadMessage: ({ message, status, }: {
|
|
56
|
-
message: StreamingPayload;
|
|
57
|
-
status: 0 | 1;
|
|
58
|
-
}) => Buffer;
|
|
59
11
|
export type OnStream = (payload: StreamingPayload) => void;
|
|
60
12
|
export {};
|
|
@@ -1,53 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePayloadMessage = exports.makeStreaming =
|
|
4
|
-
const
|
|
5
|
-
const errorOccurred = 'error-occurred';
|
|
6
|
-
const renderIdDetermined = 'render-id-determined';
|
|
7
|
-
const chunkRendered = 'chunk-rendered';
|
|
8
|
-
const messageTypes = {
|
|
9
|
-
'1': { type: framesRendered },
|
|
10
|
-
'2': { type: errorOccurred },
|
|
11
|
-
'3': { type: renderIdDetermined },
|
|
12
|
-
'4': { type: chunkRendered },
|
|
13
|
-
};
|
|
14
|
-
exports.formatMap = {
|
|
15
|
-
[framesRendered]: 'json',
|
|
16
|
-
[errorOccurred]: 'json',
|
|
17
|
-
[renderIdDetermined]: 'json',
|
|
18
|
-
[chunkRendered]: 'binary',
|
|
19
|
-
};
|
|
20
|
-
const messageTypeIdToMessage = (messageTypeId) => {
|
|
21
|
-
const types = messageTypes[messageTypeId];
|
|
22
|
-
if (!types) {
|
|
23
|
-
throw new Error(`Unknown message type id ${messageTypeId}`);
|
|
24
|
-
}
|
|
25
|
-
return types.type;
|
|
26
|
-
};
|
|
27
|
-
exports.messageTypeIdToMessage = messageTypeIdToMessage;
|
|
28
|
-
const messageTypeToMessageId = (messageType) => {
|
|
29
|
-
const id = Object.keys(messageTypes).find((key) => messageTypes[key].type === messageType);
|
|
30
|
-
if (!id) {
|
|
31
|
-
throw new Error(`Unknown message type ${messageType}`);
|
|
32
|
-
}
|
|
33
|
-
return id;
|
|
34
|
-
};
|
|
35
|
-
exports.messageTypeToMessageId = messageTypeToMessageId;
|
|
36
|
-
const magicSeparator = Buffer.from('remotion_buffer:');
|
|
37
|
-
const makeStreaming = (options) => {
|
|
3
|
+
exports.makePayloadMessage = exports.makeStreaming = void 0;
|
|
4
|
+
const makeStreaming = (onMessage) => {
|
|
38
5
|
let outputBuffer = Buffer.from('');
|
|
6
|
+
const separator = Buffer.from('remotion_buffer:');
|
|
39
7
|
let unprocessedBuffers = [];
|
|
40
8
|
let missingData = null;
|
|
41
9
|
const processInput = () => {
|
|
42
|
-
let separatorIndex = outputBuffer.indexOf(
|
|
10
|
+
let separatorIndex = outputBuffer.indexOf(separator);
|
|
43
11
|
if (separatorIndex === -1) {
|
|
44
12
|
return;
|
|
45
13
|
}
|
|
46
|
-
separatorIndex +=
|
|
47
|
-
let
|
|
14
|
+
separatorIndex += separator.length;
|
|
15
|
+
let nonceString = '';
|
|
48
16
|
let lengthString = '';
|
|
49
17
|
let statusString = '';
|
|
50
|
-
// Each message
|
|
18
|
+
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
51
19
|
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
52
20
|
// we'll extract the data and pass it to the callback.
|
|
53
21
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -59,7 +27,7 @@ const makeStreaming = (options) => {
|
|
|
59
27
|
break;
|
|
60
28
|
}
|
|
61
29
|
separatorIndex++;
|
|
62
|
-
|
|
30
|
+
nonceString += String.fromCharCode(nextDigit);
|
|
63
31
|
}
|
|
64
32
|
// eslint-disable-next-line no-constant-condition
|
|
65
33
|
while (true) {
|
|
@@ -90,17 +58,7 @@ const makeStreaming = (options) => {
|
|
|
90
58
|
return;
|
|
91
59
|
}
|
|
92
60
|
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
93
|
-
|
|
94
|
-
const payload = {
|
|
95
|
-
type: messageType,
|
|
96
|
-
payload: exports.formatMap[messageType] === 'json'
|
|
97
|
-
? JSON.parse(data.toString('utf-8'))
|
|
98
|
-
: data,
|
|
99
|
-
};
|
|
100
|
-
options.onMessage({
|
|
101
|
-
successType: status === 1 ? 'error' : 'success',
|
|
102
|
-
message: payload,
|
|
103
|
-
});
|
|
61
|
+
onMessage(status === 1 ? 'error' : 'success', nonceString, data);
|
|
104
62
|
missingData = null;
|
|
105
63
|
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
106
64
|
processInput();
|
|
@@ -108,7 +66,7 @@ const makeStreaming = (options) => {
|
|
|
108
66
|
return {
|
|
109
67
|
addData: (data) => {
|
|
110
68
|
unprocessedBuffers.push(data);
|
|
111
|
-
const separatorIndex = data.indexOf(
|
|
69
|
+
const separatorIndex = data.indexOf(separator);
|
|
112
70
|
if (separatorIndex === -1) {
|
|
113
71
|
if (missingData) {
|
|
114
72
|
missingData.dataMissing -= data.length;
|
|
@@ -120,24 +78,22 @@ const makeStreaming = (options) => {
|
|
|
120
78
|
unprocessedBuffers.unshift(outputBuffer);
|
|
121
79
|
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
122
80
|
unprocessedBuffers = [];
|
|
81
|
+
console.log('the unprocessed input is now', new TextDecoder('utf-8').decode(outputBuffer));
|
|
123
82
|
processInput();
|
|
124
83
|
},
|
|
125
84
|
};
|
|
126
85
|
};
|
|
127
86
|
exports.makeStreaming = makeStreaming;
|
|
128
|
-
const makePayloadMessage = (
|
|
129
|
-
const body = exports.formatMap[message.type] === 'json'
|
|
130
|
-
? Buffer.from(JSON.stringify(message.payload))
|
|
131
|
-
: message.payload;
|
|
87
|
+
const makePayloadMessage = (nonce, data, status) => {
|
|
132
88
|
const concat = Buffer.concat([
|
|
133
|
-
|
|
134
|
-
Buffer.from(
|
|
89
|
+
Buffer.from('remotion_buffer:'),
|
|
90
|
+
Buffer.from(nonce.toString()),
|
|
135
91
|
Buffer.from(':'),
|
|
136
|
-
Buffer.from(
|
|
92
|
+
Buffer.from(data.length.toString()),
|
|
137
93
|
Buffer.from(':'),
|
|
138
94
|
Buffer.from(String(status)),
|
|
139
95
|
Buffer.from(':'),
|
|
140
|
-
|
|
96
|
+
data,
|
|
141
97
|
]);
|
|
142
98
|
return concat;
|
|
143
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.45",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.21.4",
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"remotion": "4.0.
|
|
32
|
-
"
|
|
29
|
+
"@remotion/cli": "4.0.45",
|
|
30
|
+
"@remotion/bundler": "4.0.45",
|
|
31
|
+
"@remotion/renderer": "4.0.45",
|
|
32
|
+
"remotion": "4.0.45"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"ts-node": "^10.8.0",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"@remotion/bundler": "4.0.
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
46
|
+
"@remotion/bundler": "4.0.45",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.45"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.45"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|