@remotion/lambda 4.0.54 → 4.0.56
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/helpers/concat-videos.d.ts +3 -2
- package/dist/functions/helpers/concat-videos.js +3 -1
- package/dist/functions/helpers/merge-chunks.d.ts +2 -1
- package/dist/functions/helpers/merge-chunks.js +1 -0
- package/dist/functions/launch.js +1 -0
- package/dist/functions/merge.js +1 -0
- package/dist/functions/streaming/streaming.d.ts +12 -0
- package/dist/functions/streaming/streaming.js +100 -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AudioCodec } from '@remotion/renderer';
|
|
1
|
+
import type { AudioCodec, LogLevel } 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,7 +11,7 @@ export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId,
|
|
|
11
11
|
expectedBucketOwner: string;
|
|
12
12
|
onErrors: (errors: EnhancedErrorInfo[]) => void;
|
|
13
13
|
}) => Promise<string[]>;
|
|
14
|
-
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, }: {
|
|
14
|
+
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, }: {
|
|
15
15
|
onProgress: (frames: number) => void;
|
|
16
16
|
numberOfFrames: number;
|
|
17
17
|
codec: LambdaCodec;
|
|
@@ -21,6 +21,7 @@ export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps,
|
|
|
21
21
|
outdir: string;
|
|
22
22
|
audioCodec: AudioCodec | null;
|
|
23
23
|
audioBitrate: string | null;
|
|
24
|
+
logLevel: LogLevel;
|
|
24
25
|
}) => Promise<{
|
|
25
26
|
outfile: string;
|
|
26
27
|
cleanupChunksProm: Promise<void>;
|
|
@@ -133,7 +133,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
135
|
exports.getAllFilesS3 = getAllFilesS3;
|
|
136
|
-
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, }) => {
|
|
136
|
+
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, }) => {
|
|
137
137
|
const outfile = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
|
|
138
138
|
const combine = (0, timer_1.timer)('Combine videos');
|
|
139
139
|
const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
|
|
@@ -148,6 +148,8 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
|
|
|
148
148
|
numberOfGifLoops,
|
|
149
149
|
audioCodec,
|
|
150
150
|
audioBitrate,
|
|
151
|
+
indent: false,
|
|
152
|
+
logLevel,
|
|
151
153
|
});
|
|
152
154
|
combine.end();
|
|
153
155
|
const cleanupChunksProm = node_fs_1.default.promises.rm(outdir, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AudioCodec } from '@remotion/renderer';
|
|
1
|
+
import type { AudioCodec, LogLevel } from '@remotion/renderer';
|
|
2
2
|
import type { CustomCredentials } from '../../shared/aws-clients';
|
|
3
3
|
import type { PostRenderData, Privacy, RenderMetadata, SerializedInputProps } from '../../shared/constants';
|
|
4
4
|
import type { DownloadBehavior } from '../../shared/content-disposition-header';
|
|
@@ -28,4 +28,5 @@ export declare const mergeChunksAndFinishRender: (options: {
|
|
|
28
28
|
renderMetadata: RenderMetadata;
|
|
29
29
|
onAllChunks: OnAllChunksAvailable;
|
|
30
30
|
audioBitrate: string | null;
|
|
31
|
+
logLevel: LogLevel;
|
|
31
32
|
}) => Promise<PostRenderData>;
|
|
@@ -100,6 +100,7 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
100
100
|
outdir,
|
|
101
101
|
audioCodec: options.audioCodec,
|
|
102
102
|
audioBitrate: options.audioBitrate,
|
|
103
|
+
logLevel: options.logLevel,
|
|
103
104
|
});
|
|
104
105
|
const encodingStop = Date.now();
|
|
105
106
|
const outputSize = fs_1.default.statSync(outfile);
|
package/dist/functions/launch.js
CHANGED
package/dist/functions/merge.js
CHANGED
|
@@ -51,6 +51,7 @@ const mergeHandler = async (params, options) => {
|
|
|
51
51
|
renderer_1.RenderInternals.Log.info('All chunks have been downloaded now.');
|
|
52
52
|
},
|
|
53
53
|
audioBitrate: renderMetadata.audioBitrate,
|
|
54
|
+
logLevel: params.logLevel,
|
|
54
55
|
});
|
|
55
56
|
return { type: 'success', postRenderData };
|
|
56
57
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type OnMessage = (type: 'error' | 'success', nonce: string, data: Buffer) => void;
|
|
3
|
+
export declare const makeStreaming: (onMessage: OnMessage) => {
|
|
4
|
+
addData: (data: Buffer) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const makePayloadMessage: (nonce: number, data: Buffer, status: 0 | 1) => Buffer;
|
|
7
|
+
export type StreamingPayload = {
|
|
8
|
+
type: 'frames-rendered';
|
|
9
|
+
frames: number;
|
|
10
|
+
};
|
|
11
|
+
export type OnStream = (payload: StreamingPayload) => void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePayloadMessage = exports.makeStreaming = void 0;
|
|
4
|
+
const makeStreaming = (onMessage) => {
|
|
5
|
+
let outputBuffer = Buffer.from('');
|
|
6
|
+
const separator = Buffer.from('remotion_buffer:');
|
|
7
|
+
let unprocessedBuffers = [];
|
|
8
|
+
let missingData = null;
|
|
9
|
+
const processInput = () => {
|
|
10
|
+
let separatorIndex = outputBuffer.indexOf(separator);
|
|
11
|
+
if (separatorIndex === -1) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
separatorIndex += separator.length;
|
|
15
|
+
let nonceString = '';
|
|
16
|
+
let lengthString = '';
|
|
17
|
+
let statusString = '';
|
|
18
|
+
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
19
|
+
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
20
|
+
// we'll extract the data and pass it to the callback.
|
|
21
|
+
// eslint-disable-next-line no-constant-condition
|
|
22
|
+
while (true) {
|
|
23
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
24
|
+
// 0x3a is the character ":"
|
|
25
|
+
if (nextDigit === 0x3a) {
|
|
26
|
+
separatorIndex++;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
separatorIndex++;
|
|
30
|
+
nonceString += String.fromCharCode(nextDigit);
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line no-constant-condition
|
|
33
|
+
while (true) {
|
|
34
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
35
|
+
if (nextDigit === 0x3a) {
|
|
36
|
+
separatorIndex++;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
separatorIndex++;
|
|
40
|
+
lengthString += String.fromCharCode(nextDigit);
|
|
41
|
+
}
|
|
42
|
+
// eslint-disable-next-line no-constant-condition
|
|
43
|
+
while (true) {
|
|
44
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
45
|
+
if (nextDigit === 0x3a) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
separatorIndex++;
|
|
49
|
+
statusString += String.fromCharCode(nextDigit);
|
|
50
|
+
}
|
|
51
|
+
const length = Number(lengthString);
|
|
52
|
+
const status = Number(statusString);
|
|
53
|
+
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
54
|
+
if (dataLength < length) {
|
|
55
|
+
missingData = {
|
|
56
|
+
dataMissing: length - dataLength,
|
|
57
|
+
};
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
61
|
+
onMessage(status === 1 ? 'error' : 'success', nonceString, data);
|
|
62
|
+
missingData = null;
|
|
63
|
+
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
64
|
+
processInput();
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
addData: (data) => {
|
|
68
|
+
unprocessedBuffers.push(data);
|
|
69
|
+
const separatorIndex = data.indexOf(separator);
|
|
70
|
+
if (separatorIndex === -1) {
|
|
71
|
+
if (missingData) {
|
|
72
|
+
missingData.dataMissing -= data.length;
|
|
73
|
+
}
|
|
74
|
+
if (!missingData || missingData.dataMissing > 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
unprocessedBuffers.unshift(outputBuffer);
|
|
79
|
+
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
80
|
+
unprocessedBuffers = [];
|
|
81
|
+
console.log('the unprocessed input is now', new TextDecoder('utf-8').decode(outputBuffer));
|
|
82
|
+
processInput();
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.makeStreaming = makeStreaming;
|
|
87
|
+
const makePayloadMessage = (nonce, data, status) => {
|
|
88
|
+
const concat = Buffer.concat([
|
|
89
|
+
Buffer.from('remotion_buffer:'),
|
|
90
|
+
Buffer.from(nonce.toString()),
|
|
91
|
+
Buffer.from(':'),
|
|
92
|
+
Buffer.from(data.length.toString()),
|
|
93
|
+
Buffer.from(':'),
|
|
94
|
+
Buffer.from(String(status)),
|
|
95
|
+
Buffer.from(':'),
|
|
96
|
+
data,
|
|
97
|
+
]);
|
|
98
|
+
return concat;
|
|
99
|
+
};
|
|
100
|
+
exports.makePayloadMessage = makePayloadMessage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.56",
|
|
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.22.3",
|
|
29
|
-
"@remotion/bundler": "4.0.
|
|
30
|
-
"@remotion/renderer": "4.0.
|
|
31
|
-
"remotion": "4.0.
|
|
32
|
-
"@remotion/cli": "4.0.
|
|
29
|
+
"@remotion/bundler": "4.0.56",
|
|
30
|
+
"@remotion/renderer": "4.0.56",
|
|
31
|
+
"remotion": "4.0.56",
|
|
32
|
+
"@remotion/cli": "4.0.56"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.276",
|
|
@@ -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.56",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.56"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.56"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|