@remotion/lambda 4.0.149 → 4.0.151

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.
@@ -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: "verbose" | "info" | "warn" | "error";
62
+ value: "error" | "verbose" | "info" | "warn";
63
63
  source: string;
64
64
  };
65
- setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
66
- type: "verbose" | "info" | "warn" | "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;
@@ -3,5 +3,8 @@ export declare const planFrameRanges: ({ framesPerLambda, frameRange, everyNthFr
3
3
  frameRange: [number, number];
4
4
  everyNthFrame: number;
5
5
  }) => {
6
- chunks: [number, number][];
6
+ chunks: [
7
+ number,
8
+ number
9
+ ][];
7
10
  };
@@ -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: string) => boolean;
3
+ export declare const canConcatVideoSeamlessly: (codec: Codec) => boolean;
@@ -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 * defaults_1.ENCODING_PROGRESS_STEP_SIZE),
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: frameCount === null ? 0 : 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,
@@ -13,7 +13,7 @@ export declare const mergeChunksAndFinishRender: (options: {
13
13
  bucketName: string;
14
14
  renderId: string;
15
15
  expectedBucketOwner: string;
16
- frameCountLength: number;
16
+ numberOfFrames: number;
17
17
  codec: LambdaCodec;
18
18
  chunkCount: number;
19
19
  fps: number;
@@ -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 = 0;
28
+ let lastProgressUploaded = Date.now();
28
29
  const onProgress = (framesEncoded) => {
29
- const deltaSinceLastProgressUploaded = framesEncoded - lastProgressUploaded;
30
- if (deltaSinceLastProgressUploaded < 200) {
30
+ const deltaSinceLastProgressUploaded = Date.now() - lastProgressUploaded;
31
+ if (deltaSinceLastProgressUploaded < 1500 &&
32
+ framesEncoded !== options.numberOfFrames) {
31
33
  return;
32
34
  }
33
- lastProgressUploaded = framesEncoded;
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 / constants_1.ENCODING_PROGRESS_STEP_SIZE)),
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.frameCountLength,
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.frameCountLength / constants_1.ENCODING_PROGRESS_STEP_SIZE)),
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 {};
@@ -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
- frameCountLength: frameCount.length,
277
+ numberOfFrames: frameCount.length,
278
278
  audioCodec: params.audioCodec,
279
279
  chunkCount: chunks.length,
280
280
  codec: params.codec,
@@ -37,7 +37,7 @@ const mergeHandler = async (params, options) => {
37
37
  downloadBehavior: renderMetadata.downloadBehavior,
38
38
  expectedBucketOwner: options.expectedBucketOwner,
39
39
  fps,
40
- frameCountLength: frameCount.length,
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 === 'gif'
73
- ? 'h264-mkv'
74
- : seamlessVideo
75
- ? 'h264-ts'
76
- : params.codec;
77
- const audioCodec = seamlessAudio
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)
@@ -1,5 +1,5 @@
1
1
  export declare const LambdaInternals: {
2
- executeCommand: (args: string[], remotionRoot: string, logLevel: "verbose" | "info" | "warn" | "error") => Promise<void>;
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: "verbose" | "info" | "warn" | "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;
@@ -56,11 +56,11 @@ export declare const LambdaInternals: {
56
56
  getValue: ({ commandLine }: {
57
57
  commandLine: Record<string, unknown>;
58
58
  }) => {
59
- value: "verbose" | "info" | "warn" | "error";
59
+ value: "error" | "verbose" | "info" | "warn";
60
60
  source: string;
61
61
  };
62
- setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
63
- type: "verbose" | "info" | "warn" | "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/";
@@ -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.ENCODING_PROGRESS_STEP_SIZE = 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;
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.149",
3
+ "version": "4.0.151",
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/bundler": "4.0.149",
29
- "@remotion/renderer": "4.0.149",
30
- "@remotion/cli": "4.0.149",
31
- "remotion": "4.0.149"
28
+ "@remotion/bundler": "4.0.151",
29
+ "@remotion/cli": "4.0.151",
30
+ "@remotion/renderer": "4.0.151",
31
+ "remotion": "4.0.151"
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/bundler": "4.0.149",
48
- "@remotion/compositor-linux-arm64-gnu": "4.0.149"
47
+ "@remotion/compositor-linux-arm64-gnu": "4.0.151",
48
+ "@remotion/bundler": "4.0.151"
49
49
  },
50
50
  "peerDependencies": {
51
- "@remotion/bundler": "4.0.149"
51
+ "@remotion/bundler": "4.0.151"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
Binary file