@remotion/lambda 4.0.132 → 4.0.134
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/functions/helpers/can-concat-seamlessly.d.ts +1 -1
- package/dist/functions/helpers/can-concat-seamlessly.js +6 -1
- package/dist/functions/helpers/concat-videos.d.ts +2 -1
- package/dist/functions/helpers/concat-videos.js +5 -4
- package/dist/functions/helpers/merge-chunks.js +4 -0
- package/dist/functions/helpers/render-has-audio-video.js +4 -1
- package/dist/functions/launch.js +1 -0
- package/dist/functions/merge.js +0 -3
- package/dist/functions/renderer.js +16 -5
- package/dist/shared/constants.d.ts +3 -1
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AudioCodec } from '@remotion/renderer';
|
|
2
|
-
export declare const canConcatAudioSeamlessly: (audioCodec: AudioCodec | null) => boolean;
|
|
2
|
+
export declare const canConcatAudioSeamlessly: (audioCodec: AudioCodec | null, chunkDurationInFrames: number) => boolean;
|
|
3
3
|
export declare const canConcatVideoSeamlessly: (codec: string) => boolean;
|
|
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.canConcatVideoSeamlessly = exports.canConcatAudioSeamlessly = void 0;
|
|
4
4
|
// Cannot do WAV yet, because currently assumes AAC in+outpoint
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
-
const canConcatAudioSeamlessly = (audioCodec) => {
|
|
6
|
+
const canConcatAudioSeamlessly = (audioCodec, chunkDurationInFrames) => {
|
|
7
|
+
// Rendering a chunk that is too small generates too much overhead
|
|
8
|
+
// and is currently buggy
|
|
9
|
+
if (chunkDurationInFrames <= 4) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
7
12
|
return audioCodec === 'aac';
|
|
8
13
|
};
|
|
9
14
|
exports.canConcatAudioSeamlessly = canConcatAudioSeamlessly;
|
|
@@ -12,7 +12,7 @@ export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId,
|
|
|
12
12
|
onErrors: (errors: EnhancedErrorInfo[]) => void;
|
|
13
13
|
logLevel: LogLevel;
|
|
14
14
|
}) => Promise<string[]>;
|
|
15
|
-
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, framesPerLambda, binariesDirectory, cancelSignal, preferLossless, }: {
|
|
15
|
+
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, framesPerLambda, binariesDirectory, cancelSignal, preferLossless, muted, }: {
|
|
16
16
|
onProgress: (frames: number) => void;
|
|
17
17
|
numberOfFrames: number;
|
|
18
18
|
codec: LambdaCodec;
|
|
@@ -27,6 +27,7 @@ export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps,
|
|
|
27
27
|
binariesDirectory: string | null;
|
|
28
28
|
cancelSignal: CancelSignal | undefined;
|
|
29
29
|
preferLossless: boolean;
|
|
30
|
+
muted: boolean;
|
|
30
31
|
}) => Promise<{
|
|
31
32
|
outfile: string;
|
|
32
33
|
cleanupChunksProm: Promise<void>;
|
|
@@ -88,7 +88,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
88
88
|
.map((file) => getChunkDownloadOutputLocation({ outdir, file })));
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel },
|
|
91
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `Found ${filesInBucket.length} out of ${expectedFiles}`);
|
|
92
92
|
const errors = (await (0, inspect_errors_1.inspectErrors)({
|
|
93
93
|
bucket,
|
|
94
94
|
contents: errorContents,
|
|
@@ -134,7 +134,7 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
exports.getAllFilesS3 = getAllFilesS3;
|
|
137
|
-
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, framesPerLambda, binariesDirectory, cancelSignal, preferLossless, }) => {
|
|
137
|
+
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, audioBitrate, logLevel, framesPerLambda, binariesDirectory, cancelSignal, preferLossless, muted, }) => {
|
|
138
138
|
const outfile = (0, node_path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), `concat.${renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec)}`);
|
|
139
139
|
const combine = (0, timer_1.timer)('Combine chunks', logLevel);
|
|
140
140
|
const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
|
|
@@ -145,9 +145,9 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
|
|
|
145
145
|
preferLossless,
|
|
146
146
|
separateAudioTo: null,
|
|
147
147
|
});
|
|
148
|
-
const seamlessAudio = (0, can_concat_seamlessly_1.canConcatAudioSeamlessly)(resolvedAudioCodec);
|
|
148
|
+
const seamlessAudio = (0, can_concat_seamlessly_1.canConcatAudioSeamlessly)(resolvedAudioCodec, framesPerLambda);
|
|
149
149
|
const seamlessVideo = (0, can_concat_seamlessly_1.canConcatVideoSeamlessly)(codec);
|
|
150
|
-
await renderer_1.RenderInternals.
|
|
150
|
+
await renderer_1.RenderInternals.combineChunks({
|
|
151
151
|
files,
|
|
152
152
|
filelistDir,
|
|
153
153
|
output: outfile,
|
|
@@ -165,6 +165,7 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
|
|
|
165
165
|
cancelSignal,
|
|
166
166
|
seamlessAudio,
|
|
167
167
|
seamlessVideo,
|
|
168
|
+
muted,
|
|
168
169
|
});
|
|
169
170
|
combine.end();
|
|
170
171
|
const cleanupChunksProm = node_fs_1.default.promises.rm(outdir, {
|
|
@@ -99,6 +99,9 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
99
99
|
compositionStart: options.compositionStart,
|
|
100
100
|
});
|
|
101
101
|
const encodingStart = Date.now();
|
|
102
|
+
if (options.renderMetadata.type === 'still') {
|
|
103
|
+
throw new Error('Cannot merge stills');
|
|
104
|
+
}
|
|
102
105
|
const { outfile, cleanupChunksProm } = await (0, concat_videos_1.concatVideosS3)({
|
|
103
106
|
onProgress,
|
|
104
107
|
numberOfFrames: options.frameCountLength,
|
|
@@ -114,6 +117,7 @@ const mergeChunksAndFinishRender = async (options) => {
|
|
|
114
117
|
binariesDirectory: options.binariesDirectory,
|
|
115
118
|
cancelSignal: undefined,
|
|
116
119
|
preferLossless: options.preferLossless,
|
|
120
|
+
muted: options.renderMetadata.muted,
|
|
117
121
|
});
|
|
118
122
|
const encodingStop = Date.now();
|
|
119
123
|
const outputSize = fs_1.default.statSync(outfile);
|
|
@@ -6,10 +6,13 @@ const lambdaRenderHasAudioVideo = (renderMetadata) => {
|
|
|
6
6
|
if (renderMetadata.type === 'still') {
|
|
7
7
|
throw new Error('Cannot merge stills');
|
|
8
8
|
}
|
|
9
|
+
const support = renderer_1.RenderInternals.codecSupportsMedia(renderMetadata.codec);
|
|
9
10
|
const hasVideo = renderMetadata
|
|
10
11
|
? !renderer_1.RenderInternals.isAudioCodec(renderMetadata.codec)
|
|
11
12
|
: false;
|
|
12
|
-
const hasAudio = renderMetadata
|
|
13
|
+
const hasAudio = renderMetadata
|
|
14
|
+
? !renderMetadata.muted && support.audio
|
|
15
|
+
: false;
|
|
13
16
|
return {
|
|
14
17
|
hasAudio,
|
|
15
18
|
hasVideo,
|
package/dist/functions/launch.js
CHANGED
|
@@ -189,6 +189,7 @@ const innerLaunchHandler = async ({ functionName, params, options, onAllChunksAv
|
|
|
189
189
|
colorSpace: params.colorSpace,
|
|
190
190
|
preferLossless: params.preferLossless,
|
|
191
191
|
compositionStart: realFrameRange[0],
|
|
192
|
+
framesPerLambda,
|
|
192
193
|
};
|
|
193
194
|
return payload;
|
|
194
195
|
});
|
package/dist/functions/merge.js
CHANGED
|
@@ -23,9 +23,6 @@ const mergeHandler = async (params, options) => {
|
|
|
23
23
|
if (!renderMetadata.codec) {
|
|
24
24
|
throw new Error('expected codec');
|
|
25
25
|
}
|
|
26
|
-
if (renderMetadata.type === 'still') {
|
|
27
|
-
throw new Error('Cannot merge stills');
|
|
28
|
-
}
|
|
29
26
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
30
27
|
? null
|
|
31
28
|
: (_b = (_a = params.outName) === null || _a === void 0 ? void 0 : _a.s3OutputProvider) !== null && _b !== void 0 ? _b : null);
|
|
@@ -66,7 +66,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
66
66
|
codec: params.codec,
|
|
67
67
|
preferLossless: params.preferLossless,
|
|
68
68
|
});
|
|
69
|
-
const seamlessAudio = (0, can_concat_seamlessly_1.canConcatAudioSeamlessly)(defaultAudioCodec);
|
|
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
72
|
const chunkCodec = params.codec === 'gif'
|
|
@@ -82,11 +82,22 @@ const renderHandler = async (params, options, logs) => {
|
|
|
82
82
|
? renderer_1.RenderInternals.getExtensionFromAudioCodec(audioCodec)
|
|
83
83
|
: null;
|
|
84
84
|
const videoOutputLocation = node_path_1.default.join(outdir, `${chunk}.${videoExtension}`);
|
|
85
|
-
const
|
|
85
|
+
const willRenderAudioEval = renderer_1.RenderInternals.getShouldRenderAudio({
|
|
86
|
+
assetsInfo: null,
|
|
87
|
+
codec: params.codec,
|
|
88
|
+
enforceAudioTrack: true,
|
|
89
|
+
muted: params.muted,
|
|
90
|
+
});
|
|
91
|
+
if (willRenderAudioEval === 'maybe') {
|
|
92
|
+
throw new Error('Cannot determine whether to render audio or not');
|
|
93
|
+
}
|
|
94
|
+
const audioOutputLocation = willRenderAudioEval === 'no'
|
|
86
95
|
? null
|
|
87
|
-
:
|
|
88
|
-
?
|
|
89
|
-
:
|
|
96
|
+
: renderer_1.RenderInternals.isAudioCodec(params.codec)
|
|
97
|
+
? null
|
|
98
|
+
: audioExtension
|
|
99
|
+
? node_path_1.default.join(outdir, `${chunk}.${audioExtension}`)
|
|
100
|
+
: null;
|
|
90
101
|
const resolvedProps = await resolvedPropsPromise;
|
|
91
102
|
const serializedInputPropsWithCustomSchema = await inputPropsPromise;
|
|
92
103
|
await new Promise((resolve, reject) => {
|
|
@@ -263,6 +263,7 @@ export type LambdaPayloads = {
|
|
|
263
263
|
deleteAfter: DeleteAfter | null;
|
|
264
264
|
colorSpace: ColorSpace;
|
|
265
265
|
compositionStart: number;
|
|
266
|
+
framesPerLambda: number;
|
|
266
267
|
};
|
|
267
268
|
still: {
|
|
268
269
|
type: LambdaRoutines.still;
|
|
@@ -321,12 +322,14 @@ export type EncodingProgress = {
|
|
|
321
322
|
type Discriminated = {
|
|
322
323
|
type: 'still';
|
|
323
324
|
imageFormat: StillImageFormat;
|
|
325
|
+
codec: null;
|
|
324
326
|
} | {
|
|
325
327
|
type: 'video';
|
|
326
328
|
imageFormat: VideoImageFormat;
|
|
327
329
|
muted: boolean;
|
|
328
330
|
frameRange: [number, number];
|
|
329
331
|
everyNthFrame: number;
|
|
332
|
+
codec: LambdaCodec;
|
|
330
333
|
};
|
|
331
334
|
export type RenderMetadata = Discriminated & {
|
|
332
335
|
siteId: string;
|
|
@@ -336,7 +339,6 @@ export type RenderMetadata = Discriminated & {
|
|
|
336
339
|
estimatedTotalLambdaInvokations: number;
|
|
337
340
|
estimatedRenderLambdaInvokations: number;
|
|
338
341
|
compositionId: string;
|
|
339
|
-
codec: LambdaCodec | null;
|
|
340
342
|
audioCodec: AudioCodec | null;
|
|
341
343
|
inputProps: SerializedInputProps;
|
|
342
344
|
framesPerLambda: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.134",
|
|
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/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"
|
|
32
|
-
"remotion": "4.0.
|
|
29
|
+
"@remotion/cli": "4.0.134",
|
|
30
|
+
"@remotion/bundler": "4.0.134",
|
|
31
|
+
"remotion": "4.0.134",
|
|
32
|
+
"@remotion/renderer": "4.0.134"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.276",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"ts-node": "^10.8.0",
|
|
45
45
|
"vitest": "0.31.1",
|
|
46
46
|
"zip-lib": "^0.7.2",
|
|
47
|
-
"@remotion/bundler": "4.0.
|
|
48
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
47
|
+
"@remotion/bundler": "4.0.134",
|
|
48
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.134"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@remotion/bundler": "4.0.
|
|
51
|
+
"@remotion/bundler": "4.0.134"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|