@remotion/renderer 4.0.178 → 4.0.180

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.
@@ -3,10 +3,11 @@ import type { LogLevel } from '../log-level';
3
3
  import type { FrameAndAssets } from '../render-frames';
4
4
  import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
5
5
  import type { DownloadMap } from './download-map';
6
- export declare const convertAssetsToFileUrls: ({ assets, onDownload, downloadMap, indent, logLevel, }: {
6
+ export declare const convertAssetsToFileUrls: ({ assets, onDownload, downloadMap, indent, logLevel, binariesDirectory, }: {
7
7
  assets: FrameAndAssets[];
8
8
  onDownload: RenderMediaOnDownload;
9
9
  downloadMap: DownloadMap;
10
10
  indent: boolean;
11
11
  logLevel: LogLevel;
12
+ binariesDirectory: string | null;
12
13
  }) => Promise<AudioOrVideoAsset[][]>;
@@ -9,7 +9,7 @@ const chunk = (input, size) => {
9
9
  : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
10
10
  }, []);
11
11
  };
12
- const convertAssetsToFileUrls = async ({ assets, onDownload, downloadMap, indent, logLevel, }) => {
12
+ const convertAssetsToFileUrls = async ({ assets, onDownload, downloadMap, indent, logLevel, binariesDirectory, }) => {
13
13
  const chunks = chunk(assets, 1000);
14
14
  const results = [];
15
15
  for (const ch of chunks) {
@@ -21,6 +21,9 @@ const convertAssetsToFileUrls = async ({ assets, onDownload, downloadMap, indent
21
21
  downloadMap,
22
22
  indent,
23
23
  logLevel,
24
+ binariesDirectory,
25
+ cancelSignalForAudioAnalysis: undefined,
26
+ shouldAnalyzeAudioImmediately: true,
24
27
  });
25
28
  });
26
29
  return Promise.all(frameAssetPromises);
@@ -1,16 +1,20 @@
1
1
  import type { AudioOrVideoAsset } from 'remotion/no-react';
2
2
  import type { LogLevel } from '../log-level';
3
+ import type { CancelSignal } from '../make-cancel-signal';
3
4
  import type { DownloadMap } from './download-map';
4
5
  export type RenderMediaOnDownload = (src: string) => ((progress: {
5
6
  percent: number | null;
6
7
  downloaded: number;
7
8
  totalSize: number | null;
8
9
  }) => void) | undefined | void;
9
- export declare const downloadAsset: ({ src, downloadMap, indent, logLevel, }: {
10
+ export declare const downloadAsset: ({ src, downloadMap, indent, logLevel, shouldAnalyzeAudioImmediately, binariesDirectory, cancelSignalForAudioAnalysis, }: {
10
11
  src: string;
11
12
  downloadMap: DownloadMap;
12
13
  indent: boolean;
13
14
  logLevel: LogLevel;
15
+ shouldAnalyzeAudioImmediately: boolean;
16
+ binariesDirectory: string | null;
17
+ cancelSignalForAudioAnalysis: CancelSignal | undefined;
14
18
  }) => Promise<string>;
15
19
  export declare const markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
16
20
  export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, contentDisposition, contentType, }: {
@@ -19,11 +23,14 @@ export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, conte
19
23
  contentDisposition: string | null;
20
24
  contentType: string | null;
21
25
  }) => string;
22
- export declare const downloadAndMapAssetsToFileUrl: ({ renderAsset, onDownload, downloadMap, logLevel, indent, }: {
26
+ export declare const downloadAndMapAssetsToFileUrl: ({ renderAsset, onDownload, downloadMap, logLevel, indent, binariesDirectory, cancelSignalForAudioAnalysis, shouldAnalyzeAudioImmediately, }: {
23
27
  renderAsset: AudioOrVideoAsset;
24
28
  onDownload: RenderMediaOnDownload | null;
25
29
  downloadMap: DownloadMap;
26
30
  logLevel: LogLevel;
27
31
  indent: boolean;
32
+ shouldAnalyzeAudioImmediately: boolean;
33
+ binariesDirectory: string | null;
34
+ cancelSignalForAudioAnalysis: CancelSignal | undefined;
28
35
  }) => Promise<AudioOrVideoAsset>;
29
36
  export declare const attachDownloadListenerToEmitter: (downloadMap: DownloadMap, onDownload: RenderMediaOnDownload | null) => () => void;
@@ -34,6 +34,7 @@ const compress_assets_1 = require("../compress-assets");
34
34
  const ensure_output_directory_1 = require("../ensure-output-directory");
35
35
  const mime_types_1 = require("../mime-types");
36
36
  const download_file_1 = require("./download-file");
37
+ const get_audio_channels_1 = require("./get-audio-channels");
37
38
  const sanitize_filepath_1 = require("./sanitize-filepath");
38
39
  const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
39
40
  var _a, _b;
@@ -112,7 +113,7 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
112
113
  throw new TypeError(errMessage);
113
114
  }
114
115
  }
115
- const downloadAsset = async ({ src, downloadMap, indent, logLevel, }) => {
116
+ const downloadAsset = async ({ src, downloadMap, indent, logLevel, shouldAnalyzeAudioImmediately, binariesDirectory, cancelSignalForAudioAnalysis, }) => {
116
117
  var _a, _b, _c;
117
118
  if ((0, compress_assets_1.isAssetCompressed)(src)) {
118
119
  return src;
@@ -181,6 +182,16 @@ const downloadAsset = async ({ src, downloadMap, indent, logLevel, }) => {
181
182
  logLevel,
182
183
  });
183
184
  notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to });
185
+ if (shouldAnalyzeAudioImmediately) {
186
+ await (0, get_audio_channels_1.getAudioChannelsAndDuration)({
187
+ binariesDirectory,
188
+ downloadMap,
189
+ src: to,
190
+ indent,
191
+ logLevel,
192
+ cancelSignal: cancelSignalForAudioAnalysis,
193
+ });
194
+ }
184
195
  return to;
185
196
  };
186
197
  exports.downloadAsset = downloadAsset;
@@ -237,13 +248,16 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
237
248
  return node_path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
238
249
  };
239
250
  exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
240
- const downloadAndMapAssetsToFileUrl = async ({ renderAsset, onDownload, downloadMap, logLevel, indent, }) => {
251
+ const downloadAndMapAssetsToFileUrl = async ({ renderAsset, onDownload, downloadMap, logLevel, indent, binariesDirectory, cancelSignalForAudioAnalysis, shouldAnalyzeAudioImmediately, }) => {
241
252
  const cleanup = (0, exports.attachDownloadListenerToEmitter)(downloadMap, onDownload);
242
253
  const newSrc = await (0, exports.downloadAsset)({
243
254
  src: renderAsset.src,
244
255
  downloadMap,
245
256
  indent,
246
257
  logLevel,
258
+ shouldAnalyzeAudioImmediately,
259
+ binariesDirectory,
260
+ cancelSignalForAudioAnalysis,
247
261
  });
248
262
  cleanup();
249
263
  return {
@@ -13,21 +13,29 @@ const getAudioChannelsAndDurationWithoutCache = async ({ src, indent, logLevel,
13
13
  ]
14
14
  .reduce((acc, val) => acc.concat(val), [])
15
15
  .filter(Boolean);
16
- const task = await (0, call_ffmpeg_1.callFf)({
17
- bin: 'ffprobe',
18
- args,
19
- indent,
20
- logLevel,
21
- binariesDirectory,
22
- cancelSignal,
23
- });
24
- const channels = task.stdout.match(/channels=([0-9]+)/);
25
- const duration = task.stdout.match(/duration=([0-9.]+)/);
26
- const result = {
27
- channels: channels ? parseInt(channels[1], 10) : 0,
28
- duration: duration ? parseFloat(duration[1]) : null,
29
- };
30
- return result;
16
+ try {
17
+ const task = await (0, call_ffmpeg_1.callFf)({
18
+ bin: 'ffprobe',
19
+ args,
20
+ indent,
21
+ logLevel,
22
+ binariesDirectory,
23
+ cancelSignal,
24
+ });
25
+ const channels = task.stdout.match(/channels=([0-9]+)/);
26
+ const duration = task.stdout.match(/duration=([0-9.]+)/);
27
+ const result = {
28
+ channels: channels ? parseInt(channels[1], 10) : 0,
29
+ duration: duration ? parseFloat(duration[1]) : null,
30
+ };
31
+ return result;
32
+ }
33
+ catch (err) {
34
+ if (err.message.includes('This file cannot be read by `ffprobe`. Is it a valid multimedia file?')) {
35
+ throw new Error('This file cannot be read by `ffprobe`. Is it a valid multimedia file?');
36
+ }
37
+ throw err;
38
+ }
31
39
  };
32
40
  exports.getAudioChannelsAndDurationWithoutCache = getAudioChannelsAndDurationWithoutCache;
33
41
  async function getAudioChannelsAndDurationUnlimited({ downloadMap, src, indent, logLevel, binariesDirectory, cancelSignal, }) {
@@ -27,6 +27,9 @@ const shouldLogBrowserMessage = (message) => {
27
27
  if (message.includes('AttributionReportingCrossAppWeb cannot be enabled in this configuration')) {
28
28
  return false;
29
29
  }
30
+ if (message.includes('Trying to Produce a Memory representation from a non-existent mailbox.')) {
31
+ return false;
32
+ }
30
33
  if (message.includes('Received HEADERS for invalid stream')) {
31
34
  return false;
32
35
  }
package/dist/client.d.ts CHANGED
@@ -467,19 +467,19 @@ export declare const BrowserSafeApis: {
467
467
  cliFlag: "gl";
468
468
  docLink: string;
469
469
  name: string;
470
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
470
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
471
471
  ssrName: string;
472
472
  description: () => import("react/jsx-runtime").JSX.Element;
473
473
  getValue: ({ commandLine }: {
474
474
  commandLine: Record<string, unknown>;
475
475
  }) => {
476
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
476
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
477
477
  source: string;
478
478
  } | {
479
479
  value: null;
480
480
  source: string;
481
481
  };
482
- setConfig: (value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
482
+ setConfig: (value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
483
483
  };
484
484
  enableLambdaInsights: {
485
485
  name: string;
@@ -18,7 +18,7 @@ const startLongRunningCompositor = ({ maximumFrameCacheItemsInBytes, logLevel, i
18
18
  return (0, exports.startCompositor)({
19
19
  type: 'StartLongRunningProcess',
20
20
  payload: {
21
- concurrency: (0, get_concurrency_1.getActualConcurrency)(null),
21
+ concurrency: (0, get_concurrency_1.resolveConcurrency)(null),
22
22
  maximum_frame_cache_size_in_bytes: maximumFrameCacheItemsInBytes,
23
23
  verbose: (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose'),
24
24
  },
@@ -22,6 +22,7 @@ const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, down
22
22
  downloadMap,
23
23
  indent,
24
24
  logLevel,
25
+ binariesDirectory,
25
26
  });
26
27
  (0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)(downloadMap);
27
28
  const assetPositions = (0, calculate_asset_positions_1.calculateAssetPositions)(fileUrlAssets);
@@ -4,9 +4,6 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
4
4
  filters: PreprocessedAudioTrack[];
5
5
  downloadMap: DownloadMap;
6
6
  }) => Promise<{
7
- complexFilterFlag: [
8
- string,
9
- string
10
- ] | null;
7
+ complexFilterFlag: [string, string] | null;
11
8
  cleanup: () => void;
12
9
  }>;
@@ -1 +1 @@
1
- export declare const getActualConcurrency: (userPreference: number | string | null) => number;
1
+ export declare const resolveConcurrency: (userPreference: number | string | null) => number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getActualConcurrency = void 0;
3
+ exports.resolveConcurrency = void 0;
4
4
  const get_cpu_count_1 = require("./get-cpu-count");
5
- const getActualConcurrency = (userPreference) => {
5
+ const resolveConcurrency = (userPreference) => {
6
6
  const maxCpus = (0, get_cpu_count_1.getCpuCount)();
7
7
  if (userPreference === null) {
8
8
  return Math.round(Math.min(8, Math.max(1, maxCpus / 2)));
@@ -24,4 +24,4 @@ const getActualConcurrency = (userPreference) => {
24
24
  }
25
25
  return rounded;
26
26
  };
27
- exports.getActualConcurrency = getActualConcurrency;
27
+ exports.resolveConcurrency = resolveConcurrency;
@@ -0,0 +1,3 @@
1
+ import type { Page } from './browser/BrowserPage';
2
+ import type { HTTPResponse } from './browser/HTTPResponse';
3
+ export declare const gotoPageOrThrow: (page: Page, urlToVisit: string, actualTimeout: number) => Promise<[HTTPResponse, null] | [null, Error]>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gotoPageOrThrow = void 0;
4
+ const gotoPageOrThrow = async (page, urlToVisit, actualTimeout) => {
5
+ try {
6
+ const pageRes = await page.goto({ url: urlToVisit, timeout: actualTimeout });
7
+ if (pageRes === null) {
8
+ return [null, new Error(`Visited "${urlToVisit}" but got no response.`)];
9
+ }
10
+ return [pageRes, null];
11
+ }
12
+ catch (err) {
13
+ return [null, err];
14
+ }
15
+ };
16
+ exports.gotoPageOrThrow = gotoPageOrThrow;
package/dist/index.d.ts CHANGED
@@ -50,7 +50,7 @@ export type { AudioCodec };
50
50
  import type { AudioCodec } from './options/audio-codec';
51
51
  import { toMegabytes } from './to-megabytes';
52
52
  export declare const RenderInternals: {
53
- getActualConcurrency: (userPreference: string | number | null) => number;
53
+ resolveConcurrency: (userPreference: string | number | null) => number;
54
54
  serveStatic: (path: string | null, options: {
55
55
  port: number | null;
56
56
  downloadMap: import("./assets/download-map").DownloadMap;
@@ -141,8 +141,8 @@ export declare const RenderInternals: {
141
141
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
142
142
  DEFAULT_BROWSER: "chrome";
143
143
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
144
- DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
145
- validateOpenGlRenderer: (option: unknown) => "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
144
+ DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
145
+ validateOpenGlRenderer: (option: unknown) => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
146
146
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
147
147
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
148
148
  validateJpegQuality: (q: unknown) => void;
@@ -338,7 +338,7 @@ export declare const RenderInternals: {
338
338
  makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif")[]>;
339
339
  defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">;
340
340
  getExecutablePath: ({ indent, logLevel, type, binariesDirectory, }: {
341
- type: "compositor" | "ffmpeg" | "ffprobe";
341
+ type: "ffmpeg" | "ffprobe" | "compositor";
342
342
  indent: boolean;
343
343
  logLevel: "verbose" | "info" | "warn" | "error";
344
344
  binariesDirectory: string | null;
@@ -354,8 +354,8 @@ export declare const RenderInternals: {
354
354
  }) => execa.ExecaChildProcess<string>;
355
355
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
356
356
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
357
- DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
358
- DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
357
+ DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
358
+ DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
359
359
  DEFAULT_JPEG_QUALITY: number;
360
360
  chalk: {
361
361
  enabled: () => boolean;
@@ -454,7 +454,7 @@ export declare const RenderInternals: {
454
454
  frame: number;
455
455
  serializedInputPropsWithCustomSchema: string;
456
456
  serializedResolvedPropsWithCustomSchema: string;
457
- imageFormat: "png" | "jpeg" | "pdf" | "webp";
457
+ imageFormat: "jpeg" | "png" | "webp" | "pdf";
458
458
  jpegQuality: number;
459
459
  puppeteerInstance: HeadlessBrowser | null;
460
460
  envVariables: Record<string, string>;
@@ -755,7 +755,7 @@ export declare const RenderInternals: {
755
755
  onFrameUpdate: ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void) | null;
756
756
  outputDir: string | null;
757
757
  envVariables: Record<string, string>;
758
- imageFormat: "png" | "jpeg" | "none";
758
+ imageFormat: "jpeg" | "png" | "none";
759
759
  jpegQuality: number;
760
760
  frameRange: import("./frame-range").FrameRange | null;
761
761
  everyNthFrame: number;
package/dist/index.js CHANGED
@@ -121,7 +121,7 @@ const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
121
121
  const validate_videobitrate_1 = require("./validate-videobitrate");
122
122
  const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
123
123
  exports.RenderInternals = {
124
- getActualConcurrency: get_concurrency_1.getActualConcurrency,
124
+ resolveConcurrency: get_concurrency_1.resolveConcurrency,
125
125
  serveStatic: serve_static_1.serveStatic,
126
126
  validateEvenDimensionsWithCodec: validate_even_dimensions_with_codec_1.validateEvenDimensionsWithCodec,
127
127
  getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
@@ -93,7 +93,15 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
93
93
  closed = true;
94
94
  });
95
95
  let extractStart = Date.now();
96
- (0, download_and_map_assets_to_file_1.downloadAsset)({ src, downloadMap, indent, logLevel })
96
+ (0, download_and_map_assets_to_file_1.downloadAsset)({
97
+ src,
98
+ downloadMap,
99
+ indent,
100
+ logLevel,
101
+ binariesDirectory,
102
+ cancelSignalForAudioAnalysis: undefined,
103
+ shouldAnalyzeAudioImmediately: true,
104
+ })
97
105
  .then((to) => {
98
106
  return new Promise((resolve, reject) => {
99
107
  if (closed) {
@@ -1,19 +1,19 @@
1
1
  export declare const validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
2
2
  export type OpenGlRenderer = (typeof validOpenGlRenderers)[number];
3
3
  export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
4
- export declare const getChromiumOpenGlRenderer: () => "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
4
+ export declare const getChromiumOpenGlRenderer: () => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
5
5
  export declare const setChromiumOpenGlRenderer: (renderer: OpenGlRenderer) => void;
6
6
  export declare const glOption: {
7
7
  cliFlag: "gl";
8
8
  docLink: string;
9
9
  name: string;
10
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
10
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
11
11
  ssrName: string;
12
12
  description: () => import("react/jsx-runtime").JSX.Element;
13
13
  getValue: ({ commandLine }: {
14
14
  commandLine: Record<string, unknown>;
15
15
  }) => {
16
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
16
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
17
17
  source: string;
18
18
  } | {
19
19
  value: null;
@@ -245,19 +245,19 @@ export declare const allOptions: {
245
245
  cliFlag: "gl";
246
246
  docLink: string;
247
247
  name: string;
248
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
248
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
249
249
  ssrName: string;
250
250
  description: () => import("react/jsx-runtime").JSX.Element;
251
251
  getValue: ({ commandLine }: {
252
252
  commandLine: Record<string, unknown>;
253
253
  }) => {
254
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
254
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
255
255
  source: string;
256
256
  } | {
257
257
  value: null;
258
258
  source: string;
259
259
  };
260
- setConfig: (value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
260
+ setConfig: (value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
261
261
  };
262
262
  enableLambdaInsights: {
263
263
  name: string;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  /// <reference types="bun-types" />
4
3
  /// <reference types="node" />
5
4
  /// <reference types="node" />
6
5
  /// <reference types="node" />
7
6
  /// <reference types="bun-types" />
8
7
  /// <reference types="bun-types" />
8
+ /// <reference types="node" />
9
9
  import type { NetworkInterfaceInfo } from 'os';
10
10
  import os from 'os';
11
11
  type PortConfig = {
@@ -13,7 +13,7 @@ type PortConfig = {
13
13
  hostsToTry: string[];
14
14
  };
15
15
  export declare const getPortConfig: (preferIpv4: boolean) => PortConfig;
16
- export declare const getHostToBind: (flattened: os.NetworkInterfaceInfo[], preferIpv4: boolean) => "::" | "0.0.0.0";
16
+ export declare const getHostToBind: (flattened: os.NetworkInterfaceInfo[], preferIpv4: boolean) => "0.0.0.0" | "::";
17
17
  export declare const getHostsToTry: (flattened: os.NetworkInterfaceInfo[]) => string[];
18
18
  export declare const flattenNetworkInterfaces: (networkInterfaces: NodeJS.Dict<NetworkInterfaceInfo[]>) => NetworkInterfaceInfo[];
19
19
  export declare const isIpV6Supported: (flattened: os.NetworkInterfaceInfo[]) => boolean;
@@ -41,7 +41,7 @@ const validate_1 = require("./validate");
41
41
  const validate_scale_1 = require("./validate-scale");
42
42
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
43
43
  const MAX_RETRIES_PER_FRAME = 1;
44
- const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency: concurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourceMapGetter, logLevel, indent, parallelEncodingEnabled, compositionStart, forSeamlessAacConcatenation, onArtifact, }) => {
44
+ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, resolvedConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourceMapGetter, logLevel, indent, parallelEncodingEnabled, compositionStart, forSeamlessAacConcatenation, onArtifact, binariesDirectory, }) => {
45
45
  if (outputDir) {
46
46
  if (!node_fs_1.default.existsSync(outputDir)) {
47
47
  node_fs_1.default.mkdirSync(outputDir, {
@@ -124,11 +124,11 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
124
124
  page.off('console', logCallback);
125
125
  return page;
126
126
  };
127
- const concurrencyOrFramesToRender = Math.min(framesToRender.length, concurrency);
127
+ const concurrencyOrFramesToRender = Math.min(framesToRender.length, resolvedConcurrency);
128
128
  const getPool = async (context) => {
129
129
  const pages = new Array(concurrencyOrFramesToRender)
130
130
  .fill(true)
131
- .map((_, i) => makePage(context, realFrameRange[i]));
131
+ .map((_, i) => makePage(context, framesToRender[i]));
132
132
  const puppeteerPages = await Promise.all(pages);
133
133
  const pool = new pool_1.Pool(puppeteerPages);
134
134
  return pool;
@@ -146,6 +146,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
146
146
  onStart === null || onStart === void 0 ? void 0 : onStart({
147
147
  frameCount: framesToRender.length,
148
148
  parallelEncoding: parallelEncodingEnabled,
149
+ resolvedConcurrency,
149
150
  });
150
151
  const assets = [];
151
152
  let stopped = false;
@@ -259,6 +260,9 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
259
260
  downloadMap,
260
261
  indent,
261
262
  logLevel,
263
+ binariesDirectory,
264
+ cancelSignalForAudioAnalysis: cancelSignal,
265
+ shouldAnalyzeAudioImmediately: true,
262
266
  }).catch((err) => {
263
267
  const truncateWithEllipsis = renderAsset.src.substring(0, 1000) +
264
268
  (renderAsset.src.length > 1000 ? '...' : '');
@@ -431,7 +435,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
431
435
  onBrowserDownload,
432
436
  });
433
437
  const browserInstance = puppeteerInstance !== null && puppeteerInstance !== void 0 ? puppeteerInstance : makeBrowser();
434
- const actualConcurrency = (0, get_concurrency_1.getActualConcurrency)(concurrency);
438
+ const resolvedConcurrency = (0, get_concurrency_1.resolveConcurrency)(concurrency);
435
439
  const openedPages = [];
436
440
  return new Promise((resolve, reject) => {
437
441
  const cleanup = [];
@@ -449,7 +453,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
449
453
  webpackConfigOrServeUrl: webpackBundleOrServeUrl,
450
454
  port,
451
455
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
452
- concurrency: actualConcurrency,
456
+ concurrency: resolvedConcurrency,
453
457
  logLevel,
454
458
  indent,
455
459
  offthreadVideoCacheSizeInBytes,
@@ -463,7 +467,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
463
467
  ]).then(([{ server: openedServer, cleanupServer }, pInstance]) => {
464
468
  const { serveUrl, offthreadPort, compositor, sourceMap, downloadMap } = openedServer;
465
469
  const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(pInstance, logLevel, indent);
466
- const cycle = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency, logLevel, indent);
470
+ const cycle = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, resolvedConcurrency, logLevel, indent);
467
471
  cleanup.push(() => {
468
472
  cycle.stopCycling();
469
473
  return Promise.resolve();
@@ -474,7 +478,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
474
478
  pagesArray: openedPages,
475
479
  serveUrl,
476
480
  composition,
477
- actualConcurrency,
481
+ resolvedConcurrency,
478
482
  onDownload,
479
483
  proxyPort: offthreadPort,
480
484
  makeBrowser,
@@ -122,12 +122,12 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
122
122
  logLevel,
123
123
  tag: 'renderMedia()',
124
124
  }, 'Free memory:', freeMemory, 'Estimated usage parallel encoding', estimatedUsage);
125
- const actualConcurrency = (0, get_concurrency_1.getActualConcurrency)(concurrency);
125
+ const resolvedConcurrency = (0, get_concurrency_1.resolveConcurrency)(concurrency);
126
126
  logger_1.Log.verbose({
127
127
  indent,
128
128
  logLevel,
129
129
  tag: 'renderMedia()',
130
- }, 'Using concurrency:', actualConcurrency);
130
+ }, 'Using concurrency:', resolvedConcurrency);
131
131
  logger_1.Log.verbose({
132
132
  indent,
133
133
  logLevel,
@@ -272,7 +272,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
272
272
  Promise.resolve(createPrestitcherIfNecessary())
273
273
  .then(() => {
274
274
  return (0, prepare_server_1.makeOrReuseServer)(reusedServer, {
275
- concurrency: actualConcurrency,
275
+ concurrency: resolvedConcurrency,
276
276
  indent,
277
277
  port,
278
278
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setPropsAndEnv = void 0;
4
4
  const version_1 = require("remotion/version");
5
5
  const TimeoutSettings_1 = require("./browser/TimeoutSettings");
6
+ const goto_page_or_throw_1 = require("./goto-page-or-throw");
6
7
  const logger_1 = require("./logger");
7
8
  const normalize_serve_url_1 = require("./normalize-serve-url");
8
9
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
@@ -68,11 +69,6 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
68
69
  return false;
69
70
  };
70
71
  });
71
- const pageRes = await page.goto({ url: urlToVisit, timeout: actualTimeout });
72
- if (pageRes === null) {
73
- throw new Error(`Visited "${urlToVisit}" but got no response.`);
74
- }
75
- const status = pageRes.status();
76
72
  const retry = async () => {
77
73
  await new Promise((resolve) => {
78
74
  setTimeout(() => {
@@ -95,6 +91,15 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
95
91
  onServeUrlVisited,
96
92
  });
97
93
  };
94
+ const [pageRes, error] = await (0, goto_page_or_throw_1.gotoPageOrThrow)(page, urlToVisit, actualTimeout);
95
+ if (error !== null) {
96
+ if (error.message.includes('ECONNRESET') ||
97
+ error.message.includes('ERR_CONNECTION_TIMED_OUT')) {
98
+ return retry();
99
+ }
100
+ throw error;
101
+ }
102
+ const status = pageRes.status();
98
103
  // S3 in rare occasions returns a 500 or 503 error code for GET operations.
99
104
  // Usually it is fixed by retrying.
100
105
  if (status >= 500 && status <= 504 && retriesRemaining > 0) {
package/dist/types.d.ts CHANGED
@@ -6,4 +6,5 @@ export type RenderFramesOutput = {
6
6
  export type OnStartData = {
7
7
  frameCount: number;
8
8
  parallelEncoding: boolean;
9
+ resolvedConcurrency: number;
9
10
  };
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.178",
6
+ "version": "4.0.180",
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,7 +18,7 @@
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.178"
21
+ "remotion": "4.0.180"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -31,16 +31,16 @@
31
31
  "react": "18.3.1",
32
32
  "react-dom": "18.3.1",
33
33
  "@types/ws": "8.5.10",
34
- "@remotion/streaming": "4.0.178"
34
+ "@remotion/streaming": "4.0.180"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@remotion/compositor-darwin-arm64": "4.0.178",
38
- "@remotion/compositor-darwin-x64": "4.0.178",
39
- "@remotion/compositor-linux-x64-gnu": "4.0.178",
40
- "@remotion/compositor-linux-arm64-gnu": "4.0.178",
41
- "@remotion/compositor-linux-arm64-musl": "4.0.178",
42
- "@remotion/compositor-linux-x64-musl": "4.0.178",
43
- "@remotion/compositor-win32-x64-msvc": "4.0.178"
37
+ "@remotion/compositor-darwin-arm64": "4.0.180",
38
+ "@remotion/compositor-linux-arm64-gnu": "4.0.180",
39
+ "@remotion/compositor-darwin-x64": "4.0.180",
40
+ "@remotion/compositor-linux-x64-gnu": "4.0.180",
41
+ "@remotion/compositor-win32-x64-msvc": "4.0.180",
42
+ "@remotion/compositor-linux-arm64-musl": "4.0.180",
43
+ "@remotion/compositor-linux-x64-musl": "4.0.180"
44
44
  },
45
45
  "keywords": [
46
46
  "remotion",