@remotion/renderer 4.0.351 → 4.0.353

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.
@@ -52,7 +52,7 @@ const validate_videobitrate_1 = require("./validate-videobitrate");
52
52
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
53
53
  const SLOWEST_FRAME_COUNT = 10;
54
54
  const MAX_RECENT_FRAME_TIMINGS = 50;
55
- const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition: compositionWithPossibleUnevenDimensions, serializedInputPropsWithCustomSchema, pixelFormat: userPixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, colorSpace, repro, binariesDirectory, separateAudioTo, forSeamlessAacConcatenation, compositionStart, onBrowserDownload, onArtifact, metadata, hardwareAcceleration, chromeMode, offthreadVideoThreads, }) => {
55
+ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition: compositionWithPossibleUnevenDimensions, serializedInputPropsWithCustomSchema, pixelFormat: userPixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, colorSpace, repro, binariesDirectory, separateAudioTo, forSeamlessAacConcatenation, compositionStart, onBrowserDownload, onArtifact, metadata, hardwareAcceleration, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, }) => {
56
56
  var _a, _b;
57
57
  const pixelFormat = (_a = userPixelFormat !== null && userPixelFormat !== void 0 ? userPixelFormat : compositionWithPossibleUnevenDimensions.defaultPixelFormat) !== null && _a !== void 0 ? _a : pixel_format_1.DEFAULT_PIXEL_FORMAT;
58
58
  if (repro) {
@@ -393,6 +393,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition: c
393
393
  onArtifact,
394
394
  chromeMode,
395
395
  imageSequencePattern: null,
396
+ mediaCacheSizeInBytes,
396
397
  });
397
398
  return renderFramesProc;
398
399
  })
@@ -539,7 +540,7 @@ exports.internalRenderMedia = (0, wrap_with_error_handling_1.wrapWithErrorHandli
539
540
  * @description Render a video or an audio programmatically.
540
541
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
541
542
  */
542
- const renderMedia = ({ proResProfile, x264Preset, crf, composition, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, colorSpace, repro, binariesDirectory, separateAudioTo, forSeamlessAacConcatenation, onBrowserDownload, onArtifact, metadata, hardwareAcceleration, chromeMode, offthreadVideoThreads, compositionStart, }) => {
543
+ const renderMedia = ({ proResProfile, x264Preset, crf, composition, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, colorSpace, repro, binariesDirectory, separateAudioTo, forSeamlessAacConcatenation, onBrowserDownload, onArtifact, metadata, hardwareAcceleration, chromeMode, offthreadVideoThreads, compositionStart, mediaCacheSizeInBytes, }) => {
543
544
  var _a, _b;
544
545
  const indent = false;
545
546
  const logLevel = verbose || dumpBrowserLogs ? 'verbose' : (passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : 'info');
@@ -615,6 +616,7 @@ const renderMedia = ({ proResProfile, x264Preset, crf, composition, inputProps,
615
616
  compositionStart: compositionStart !== null && compositionStart !== void 0 ? compositionStart : 0,
616
617
  hardwareAcceleration: hardwareAcceleration !== null && hardwareAcceleration !== void 0 ? hardwareAcceleration : 'disable',
617
618
  chromeMode: chromeMode !== null && chromeMode !== void 0 ? chromeMode : 'headless-shell',
619
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
618
620
  });
619
621
  };
620
622
  exports.renderMedia = renderMedia;
@@ -53,6 +53,7 @@ const image_format_1 = require("./image-format");
53
53
  const jpeg_quality_1 = require("./jpeg-quality");
54
54
  const logger_1 = require("./logger");
55
55
  const make_cancel_signal_1 = require("./make-cancel-signal");
56
+ const get_available_memory_1 = require("./memory/get-available-memory");
56
57
  const open_browser_1 = require("./open-browser");
57
58
  const overwrite_1 = require("./overwrite");
58
59
  const prepare_server_1 = require("./prepare-server");
@@ -64,7 +65,7 @@ const validate_1 = require("./validate");
64
65
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
65
66
  const validate_scale_1 = require("./validate-scale");
66
67
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
67
- const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError, serializedInputPropsWithCustomSchema, envVariables, output, frame = 0, overwrite, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, jpegQuality, onBrowserLog, sourceMapGetter, logLevel, indent, serializedResolvedPropsWithCustomSchema, onBrowserDownload, onArtifact, chromeMode, }) => {
68
+ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError, serializedInputPropsWithCustomSchema, envVariables, output, frame = 0, overwrite, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, jpegQuality, onBrowserLog, sourceMapGetter, logLevel, indent, serializedResolvedPropsWithCustomSchema, onBrowserDownload, onArtifact, chromeMode, mediaCacheSizeInBytes, }) => {
68
69
  (0, validate_1.validateDimension)(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
69
70
  (0, validate_1.validateDimension)(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
70
71
  (0, validate_1.validateFps)(composition.fps, 'in the `config` object of `renderStill()`', false);
@@ -160,6 +161,8 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
160
161
  logLevel,
161
162
  onServeUrlVisited: () => undefined,
162
163
  isMainTab: true,
164
+ mediaCacheSizeInBytes,
165
+ initialMemoryAvailable: (0, get_available_memory_1.getAvailableMemory)(logLevel),
163
166
  });
164
167
  await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
165
168
  // eslint-disable-next-line max-params
@@ -294,7 +297,7 @@ exports.internalRenderStill = (0, wrap_with_error_handling_1.wrapWithErrorHandli
294
297
  */
295
298
  const renderStill = (options) => {
296
299
  var _a, _b;
297
- const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, offthreadVideoCacheSizeInBytes, logLevel: passedLogLevel, binariesDirectory, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, } = options;
300
+ const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, offthreadVideoCacheSizeInBytes, logLevel: passedLogLevel, binariesDirectory, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, } = options;
298
301
  if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
299
302
  throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
300
303
  }
@@ -344,6 +347,7 @@ const renderStill = (options) => {
344
347
  onArtifact: onArtifact !== null && onArtifact !== void 0 ? onArtifact : null,
345
348
  chromeMode: chromeMode !== null && chromeMode !== void 0 ? chromeMode : 'headless-shell',
346
349
  offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
350
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
347
351
  });
348
352
  };
349
353
  exports.renderStill = renderStill;
@@ -8,13 +8,14 @@ const handle_javascript_exception_1 = require("./error-handling/handle-javascrip
8
8
  const find_closest_package_json_1 = require("./find-closest-package-json");
9
9
  const get_browser_instance_1 = require("./get-browser-instance");
10
10
  const logger_1 = require("./logger");
11
+ const get_available_memory_1 = require("./memory/get-available-memory");
11
12
  const prepare_server_1 = require("./prepare-server");
12
13
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
13
14
  const seek_to_frame_1 = require("./seek-to-frame");
14
15
  const set_props_and_env_1 = require("./set-props-and-env");
15
16
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
16
17
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
17
- const innerSelectComposition = async ({ page, serializedInputPropsWithCustomSchema, envVariables, serveUrl, timeoutInMilliseconds, port, id, indent, logLevel, onServeUrlVisited, }) => {
18
+ const innerSelectComposition = async ({ page, serializedInputPropsWithCustomSchema, envVariables, serveUrl, timeoutInMilliseconds, port, id, indent, logLevel, onServeUrlVisited, mediaCacheSizeInBytes, }) => {
18
19
  (0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
19
20
  await (0, set_props_and_env_1.setPropsAndEnv)({
20
21
  serializedInputPropsWithCustomSchema,
@@ -31,6 +32,8 @@ const innerSelectComposition = async ({ page, serializedInputPropsWithCustomSche
31
32
  logLevel,
32
33
  onServeUrlVisited,
33
34
  isMainTab: true,
35
+ mediaCacheSizeInBytes,
36
+ initialMemoryAvailable: (0, get_available_memory_1.getAvailableMemory)(logLevel),
34
37
  });
35
38
  await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
36
39
  page,
@@ -91,7 +94,7 @@ const innerSelectComposition = async ({ page, serializedInputPropsWithCustomSche
91
94
  };
92
95
  const internalSelectCompositionRaw = async (options) => {
93
96
  const cleanup = [];
94
- const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id, serializedInputPropsWithCustomSchema, onBrowserLog, server, timeoutInMilliseconds, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, onServeUrlVisited, chromeMode, } = options;
97
+ const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id, serializedInputPropsWithCustomSchema, onBrowserLog, server, timeoutInMilliseconds, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, onServeUrlVisited, chromeMode, mediaCacheSizeInBytes, } = options;
95
98
  const [{ page, cleanupPage }, serverUsed] = await Promise.all([
96
99
  (0, get_browser_instance_1.getPageAndCleanupFn)({
97
100
  passedInInstance: puppeteerInstance,
@@ -150,6 +153,7 @@ const internalSelectCompositionRaw = async (options) => {
150
153
  onBrowserDownload,
151
154
  onServeUrlVisited,
152
155
  chromeMode,
156
+ mediaCacheSizeInBytes,
153
157
  })
154
158
  .then((data) => {
155
159
  return resolve(data);
@@ -175,7 +179,7 @@ exports.internalSelectComposition = (0, wrap_with_error_handling_1.wrapWithError
175
179
  * @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
176
180
  */
177
181
  const selectComposition = async (options) => {
178
- const { id, serveUrl, browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, verbose, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, chromeMode, offthreadVideoThreads, } = options;
182
+ const { id, serveUrl, browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, verbose, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, } = options;
179
183
  const indent = false;
180
184
  const logLevel = passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : (verbose ? 'verbose' : 'info');
181
185
  const data = await (0, exports.internalSelectComposition)({
@@ -206,6 +210,7 @@ const selectComposition = async (options) => {
206
210
  onServeUrlVisited: () => undefined,
207
211
  chromeMode: chromeMode !== null && chromeMode !== void 0 ? chromeMode : 'headless-shell',
208
212
  offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
213
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
209
214
  });
210
215
  return data.metadata;
211
216
  };
@@ -15,6 +15,8 @@ type SetPropsAndEnv = {
15
15
  logLevel: LogLevel;
16
16
  onServeUrlVisited: () => void;
17
17
  isMainTab: boolean;
18
+ mediaCacheSizeInBytes: number | null;
19
+ initialMemoryAvailable: number | null;
18
20
  };
19
21
  export declare const setPropsAndEnv: (params: SetPropsAndEnv) => Promise<unknown>;
20
22
  export {};
@@ -10,15 +10,17 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
10
10
  const redirect_status_codes_1 = require("./redirect-status-codes");
11
11
  const truthy_1 = require("./truthy");
12
12
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
13
- const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, indent, logLevel, onServeUrlVisited, isMainTab, }) => {
13
+ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, indent, logLevel, onServeUrlVisited, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable, }) => {
14
14
  (0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
15
15
  const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
16
16
  page.setDefaultTimeout(actualTimeout);
17
17
  page.setDefaultNavigationTimeout(actualTimeout);
18
18
  const urlToVisit = (0, normalize_serve_url_1.normalizeServeUrl)(serveUrl);
19
- await page.evaluateOnNewDocument((timeout, mainTab) => {
19
+ await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable) => {
20
20
  window.remotion_puppeteerTimeout = timeout;
21
21
  window.remotion_isMainTab = mainTab;
22
+ window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
23
+ window.remotion_initialMemoryAvailable = initMemoryAvailable;
22
24
  // To make useRemotionEnvironment() work
23
25
  if (window.process === undefined) {
24
26
  // @ts-expect-error
@@ -28,7 +30,7 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
28
30
  window.process.env = {};
29
31
  }
30
32
  window.process.env.NODE_ENV = 'production';
31
- }, actualTimeout, isMainTab);
33
+ }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable);
32
34
  await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
33
35
  if (envVariables) {
34
36
  await page.evaluateOnNewDocument((input) => {
@@ -82,6 +84,8 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
82
84
  logLevel,
83
85
  onServeUrlVisited,
84
86
  isMainTab,
87
+ mediaCacheSizeInBytes,
88
+ initialMemoryAvailable,
85
89
  });
86
90
  };
87
91
  const [pageRes, error] = await (0, goto_page_or_throw_1.gotoPageOrThrow)(page, urlToVisit, actualTimeout);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.351",
6
+ "version": "4.0.353",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.17.1",
21
- "remotion": "4.0.351",
22
- "@remotion/streaming": "4.0.351"
21
+ "remotion": "4.0.353",
22
+ "@remotion/streaming": "4.0.353"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -33,17 +33,17 @@
33
33
  "react-dom": "19.0.0",
34
34
  "@types/ws": "8.5.10",
35
35
  "eslint": "9.19.0",
36
- "@remotion/example-videos": "4.0.351",
37
- "@remotion/eslint-config-internal": "4.0.351"
36
+ "@remotion/example-videos": "4.0.353",
37
+ "@remotion/eslint-config-internal": "4.0.353"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@remotion/compositor-darwin-arm64": "4.0.351",
41
- "@remotion/compositor-darwin-x64": "4.0.351",
42
- "@remotion/compositor-linux-arm64-gnu": "4.0.351",
43
- "@remotion/compositor-linux-arm64-musl": "4.0.351",
44
- "@remotion/compositor-linux-x64-gnu": "4.0.351",
45
- "@remotion/compositor-linux-x64-musl": "4.0.351",
46
- "@remotion/compositor-win32-x64-msvc": "4.0.351"
40
+ "@remotion/compositor-darwin-x64": "4.0.353",
41
+ "@remotion/compositor-darwin-arm64": "4.0.353",
42
+ "@remotion/compositor-linux-arm64-gnu": "4.0.353",
43
+ "@remotion/compositor-linux-arm64-musl": "4.0.353",
44
+ "@remotion/compositor-linux-x64-musl": "4.0.353",
45
+ "@remotion/compositor-win32-x64-msvc": "4.0.353",
46
+ "@remotion/compositor-linux-x64-gnu": "4.0.353"
47
47
  },
48
48
  "keywords": [
49
49
  "remotion",