@remotion/renderer 4.0.226 → 4.0.228

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.
Files changed (71) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +0 -2
  2. package/dist/assets/download-map.d.ts +0 -3
  3. package/dist/assets/download-map.js +0 -1
  4. package/dist/browser-instances.js +1 -1
  5. package/dist/client.d.ts +48 -1
  6. package/dist/client.js +2 -0
  7. package/dist/combine-audio.js +1 -1
  8. package/dist/compositor/compose.d.ts +1 -21
  9. package/dist/compositor/compose.js +2 -34
  10. package/dist/compositor/compositor.js +1 -1
  11. package/dist/compositor/payloads.d.ts +0 -35
  12. package/dist/crf.d.ts +4 -2
  13. package/dist/crf.js +12 -6
  14. package/dist/delete-directory.js +1 -1
  15. package/dist/error-handling/handle-javascript-exception.js +1 -0
  16. package/dist/ffmpeg-args.d.ts +6 -1
  17. package/dist/ffmpeg-args.js +14 -5
  18. package/dist/get-browser-instance.js +3 -2
  19. package/dist/get-codec-name.d.ts +5 -1
  20. package/dist/get-codec-name.js +38 -15
  21. package/dist/get-cpu-count.js +1 -1
  22. package/dist/get-local-browser-executable.d.ts +6 -1
  23. package/dist/get-local-browser-executable.js +9 -4
  24. package/dist/get-port.js +1 -0
  25. package/dist/index.d.ts +5 -5
  26. package/dist/logger.d.ts +4 -4
  27. package/dist/logger.js +20 -1
  28. package/dist/open-browser.js +5 -1
  29. package/dist/options/audio-codec.d.ts +1 -1
  30. package/dist/options/audio-codec.js +1 -0
  31. package/dist/options/hardware-acceleration.d.ts +18 -0
  32. package/dist/options/hardware-acceleration.js +56 -0
  33. package/dist/options/index.d.ts +15 -0
  34. package/dist/options/index.js +2 -0
  35. package/dist/options/options-map.d.ts +30 -0
  36. package/dist/options/options-map.js +3 -0
  37. package/dist/path-normalize.js +1 -1
  38. package/dist/prespawn-ffmpeg.d.ts +2 -0
  39. package/dist/prespawn-ffmpeg.js +3 -0
  40. package/dist/provide-screenshot.d.ts +1 -3
  41. package/dist/provide-screenshot.js +1 -2
  42. package/dist/puppeteer-evaluate.js +2 -3
  43. package/dist/puppeteer-screenshot.d.ts +0 -2
  44. package/dist/puppeteer-screenshot.js +0 -1
  45. package/dist/render-frames.js +4 -7
  46. package/dist/render-media.d.ts +1 -1
  47. package/dist/render-media.js +12 -8
  48. package/dist/render-still.js +10 -13
  49. package/dist/screenshot-dom-element.d.ts +1 -3
  50. package/dist/screenshot-dom-element.js +1 -2
  51. package/dist/screenshot-task.d.ts +1 -3
  52. package/dist/screenshot-task.js +8 -16
  53. package/dist/serve-handler/index.js +2 -2
  54. package/dist/stitch-frames-to-video.d.ts +2 -2
  55. package/dist/stitch-frames-to-video.js +7 -2
  56. package/dist/take-frame.d.ts +18 -0
  57. package/dist/take-frame.js +34 -0
  58. package/ensure-browser.mjs +13 -1
  59. package/eslint.config.mjs +34 -0
  60. package/package.json +15 -14
  61. package/Cargo.lock +0 -952
  62. package/Cargo.toml +0 -26
  63. package/build.ts +0 -311
  64. package/dist/browser/BrowserConnector.d.ts +0 -19
  65. package/dist/browser/BrowserConnector.js +0 -17
  66. package/dist/browser/PuppeteerNode.d.ts +0 -30
  67. package/dist/browser/PuppeteerNode.js +0 -52
  68. package/dist/browser/node.d.ts +0 -2
  69. package/dist/browser/node.js +0 -5
  70. package/dist/copy-to-clipboard.d.ts +0 -2
  71. package/dist/copy-to-clipboard.js +0 -18
package/dist/logger.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Log = exports.secondverboseTag = exports.verboseTag = exports.INDENT_TOKEN = void 0;
4
+ /* eslint-disable no-console */
4
5
  const chalk_1 = require("./chalk");
5
6
  const is_color_supported_1 = require("./chalk/is-color-supported");
6
7
  const log_level_1 = require("./log-level");
@@ -19,6 +20,10 @@ exports.Log = {
19
20
  verbose: (options, ...args) => {
20
21
  (0, repro_1.writeInRepro)('verbose', ...args);
21
22
  if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'verbose')) {
23
+ if (args.length === 0) {
24
+ // Lambda will print "undefined" otherwise
25
+ return process.stdout.write('\n');
26
+ }
22
27
  return console.log(...[
23
28
  options.indent ? exports.INDENT_TOKEN : null,
24
29
  options.tag ? (0, exports.verboseTag)(options.tag) : null,
@@ -30,12 +35,22 @@ exports.Log = {
30
35
  info: (options, ...args) => {
31
36
  (0, repro_1.writeInRepro)('info', ...args);
32
37
  if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'info')) {
33
- return console.log(...[options.indent ? exports.INDENT_TOKEN : null].filter(truthy_1.truthy).concat(args));
38
+ if (args.length === 0) {
39
+ // Lambda will print "undefined" otherwise
40
+ return process.stdout.write('\n');
41
+ }
42
+ return console.log(...[options.indent ? exports.INDENT_TOKEN : null]
43
+ .filter(truthy_1.truthy)
44
+ .concat(args !== null && args !== void 0 ? args : []));
34
45
  }
35
46
  },
36
47
  warn: (options, ...args) => {
37
48
  (0, repro_1.writeInRepro)('warn', ...args);
38
49
  if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'warn')) {
50
+ if (args.length === 0) {
51
+ // Lambda will print "undefined" otherwise
52
+ return process.stdout.write('\n');
53
+ }
39
54
  return console.warn(...[options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null]
40
55
  .filter(truthy_1.truthy)
41
56
  .concat(args.map((a) => chalk_1.chalk.yellow(a))));
@@ -44,6 +59,10 @@ exports.Log = {
44
59
  error: (options, ...args) => {
45
60
  (0, repro_1.writeInRepro)('error', ...args);
46
61
  if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'error')) {
62
+ if (args.length === 0) {
63
+ // Lambda will print "undefined" otherwise
64
+ return process.stdout.write('\n');
65
+ }
47
66
  return console.error(...[
48
67
  options.indent ? exports.INDENT_TOKEN : null,
49
68
  options.tag ? (0, exports.verboseTag)(options.tag) : null,
@@ -60,7 +60,11 @@ const internalOpenBrowser = async ({ browser, browserExecutable, chromiumOptions
60
60
  indent,
61
61
  onBrowserDownload,
62
62
  });
63
- const executablePath = (0, get_local_browser_executable_1.getLocalBrowserExecutable)(browserExecutable);
63
+ const executablePath = (0, get_local_browser_executable_1.getLocalBrowserExecutable)({
64
+ preferredBrowserExecutable: browserExecutable,
65
+ logLevel,
66
+ indent,
67
+ });
64
68
  const customGlRenderer = getOpenGlRenderer((_a = chromiumOptions.gl) !== null && _a !== void 0 ? _a : null);
65
69
  const enableMultiProcessOnLinux = (_b = chromiumOptions.enableMultiProcessOnLinux) !== null && _b !== void 0 ? _b : true;
66
70
  logger_1.Log.verbose({ indent, logLevel, tag: 'openBrowser()' }, `Opening browser: gl = ${chromiumOptions.gl}, executable = ${executablePath}, enableMultiProcessOnLinux = ${enableMultiProcessOnLinux}`);
@@ -20,7 +20,7 @@ type FfmpegAudioCodecName = (typeof audioCodecNames)[number];
20
20
  export declare const mapAudioCodecToFfmpegAudioCodecName: (audioCodec: AudioCodec) => FfmpegAudioCodecName;
21
21
  export declare const defaultAudioCodecs: {
22
22
  [key in Codec]: {
23
- [k in 'compressed' | 'lossless']: (typeof supportedAudioCodecs)[key][number] | null;
23
+ [_ in 'compressed' | 'lossless']: (typeof supportedAudioCodecs)[key][number] | null;
24
24
  };
25
25
  };
26
26
  export declare const getExtensionFromAudioCodec: (audioCodec: AudioCodec) => "mp3" | "aac" | "wav" | "opus";
@@ -21,6 +21,7 @@ const _satisfies = exports.supportedAudioCodecs;
21
21
  if (_satisfies) {
22
22
  // Just for type checking
23
23
  }
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
25
  const audioCodecNames = [
25
26
  'pcm_s16le',
26
27
  'libfdk_aac',
@@ -0,0 +1,18 @@
1
+ export declare const hardwareAccelerationOptions: readonly ["disable", "if-possible", "required"];
2
+ export type HardwareAccelerationOption = (typeof hardwareAccelerationOptions)[number];
3
+ export declare const getHardwareAcceleration: () => "disable" | "if-possible" | "required" | null;
4
+ export declare const hardwareAccelerationOption: {
5
+ name: string;
6
+ cliFlag: "hardware-acceleration";
7
+ description: () => string;
8
+ ssrName: string;
9
+ docLink: string;
10
+ type: HardwareAccelerationOption;
11
+ getValue: ({ commandLine }: {
12
+ commandLine: Record<string, unknown>;
13
+ }) => {
14
+ source: string;
15
+ value: "disable" | "if-possible" | "required";
16
+ };
17
+ setConfig: (value: HardwareAccelerationOption) => void;
18
+ };
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hardwareAccelerationOption = exports.getHardwareAcceleration = exports.hardwareAccelerationOptions = void 0;
4
+ exports.hardwareAccelerationOptions = [
5
+ 'disable',
6
+ 'if-possible',
7
+ 'required',
8
+ ];
9
+ const cliFlag = 'hardware-acceleration';
10
+ let currentValue = null;
11
+ const getHardwareAcceleration = () => {
12
+ return currentValue;
13
+ };
14
+ exports.getHardwareAcceleration = getHardwareAcceleration;
15
+ exports.hardwareAccelerationOption = {
16
+ name: 'Hardware Acceleration',
17
+ cliFlag,
18
+ description: () => `
19
+ One of
20
+ ${new Intl.ListFormat('en', { type: 'disjunction' }).format(exports.hardwareAccelerationOptions.map((a) => JSON.stringify(a)))}
21
+ . Default "disable". Encode using a hardware-accelerated encoder if
22
+ available. If set to "required" and no hardware-accelerated encoder is
23
+ available, then the render will fail.
24
+ `,
25
+ ssrName: 'hardwareAcceleration',
26
+ docLink: 'https://www.remotion.dev/docs/encoding',
27
+ type: 'disable',
28
+ getValue: ({ commandLine }) => {
29
+ if (commandLine[cliFlag] !== undefined) {
30
+ const value = commandLine[cliFlag];
31
+ if (!exports.hardwareAccelerationOptions.includes(value)) {
32
+ throw new Error(`Invalid value for --${cliFlag}: ${value}`);
33
+ }
34
+ return {
35
+ source: 'cli',
36
+ value,
37
+ };
38
+ }
39
+ if (currentValue !== null) {
40
+ return {
41
+ source: 'config',
42
+ value: currentValue,
43
+ };
44
+ }
45
+ return {
46
+ source: 'default',
47
+ value: 'disable',
48
+ };
49
+ },
50
+ setConfig: (value) => {
51
+ if (!exports.hardwareAccelerationOptions.includes(value)) {
52
+ throw new Error(`Invalid value for --${cliFlag}: ${value}`);
53
+ }
54
+ currentValue = value;
55
+ },
56
+ };
@@ -598,6 +598,21 @@ export declare const allOptions: {
598
598
  setConfig: (newMetadata: import("./metadata").Metadata) => void;
599
599
  ssrName: string;
600
600
  };
601
+ hardwareAccelerationOption: {
602
+ name: string;
603
+ cliFlag: "hardware-acceleration";
604
+ description: () => string;
605
+ ssrName: string;
606
+ docLink: string;
607
+ type: import("./hardware-acceleration").HardwareAccelerationOption;
608
+ getValue: ({ commandLine }: {
609
+ commandLine: Record<string, unknown>;
610
+ }) => {
611
+ source: string;
612
+ value: "disable" | "if-possible" | "required";
613
+ };
614
+ setConfig: (value: import("./hardware-acceleration").HardwareAccelerationOption) => void;
615
+ };
601
616
  };
602
617
  export type AvailableOptions = keyof typeof allOptions;
603
618
  export type TypeOfOption<Type> = Type extends AnyRemotionOption<infer X> ? X : never;
@@ -17,6 +17,7 @@ const enforce_audio_1 = require("./enforce-audio");
17
17
  const folder_expiry_1 = require("./folder-expiry");
18
18
  const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenation");
19
19
  const gl_1 = require("./gl");
20
+ const hardware_acceleration_1 = require("./hardware-acceleration");
20
21
  const headless_1 = require("./headless");
21
22
  const jpeg_quality_1 = require("./jpeg-quality");
22
23
  const log_level_1 = require("./log-level");
@@ -76,4 +77,5 @@ exports.allOptions = {
76
77
  throwIfSiteExistsOption: throw_if_site_exists_1.throwIfSiteExistsOption,
77
78
  disableGitSourceOption: disable_git_source_1.disableGitSourceOption,
78
79
  metadataOption: metadata_1.metadataOption,
80
+ hardwareAccelerationOption: hardware_acceleration_1.hardwareAccelerationOption,
79
81
  };
@@ -313,6 +313,21 @@ export declare const optionsMap: {
313
313
  getValue: () => never;
314
314
  setConfig: () => never;
315
315
  };
316
+ readonly hardwareAcceleration: {
317
+ name: string;
318
+ cliFlag: "hardware-acceleration";
319
+ description: () => string;
320
+ ssrName: string;
321
+ docLink: string;
322
+ type: import("./hardware-acceleration").HardwareAccelerationOption;
323
+ getValue: ({ commandLine }: {
324
+ commandLine: Record<string, unknown>;
325
+ }) => {
326
+ source: string;
327
+ value: "disable" | "if-possible" | "required";
328
+ };
329
+ setConfig: (value: import("./hardware-acceleration").HardwareAccelerationOption) => void;
330
+ };
316
331
  };
317
332
  readonly stitchFramesToVideo: {
318
333
  readonly separateAudioTo: {
@@ -333,6 +348,21 @@ export declare const optionsMap: {
333
348
  ssrName: string;
334
349
  type: string | null;
335
350
  };
351
+ readonly hardwareAcceleration: {
352
+ name: string;
353
+ cliFlag: "hardware-acceleration";
354
+ description: () => string;
355
+ ssrName: string;
356
+ docLink: string;
357
+ type: import("./hardware-acceleration").HardwareAccelerationOption;
358
+ getValue: ({ commandLine }: {
359
+ commandLine: Record<string, unknown>;
360
+ }) => {
361
+ source: string;
362
+ value: "disable" | "if-possible" | "required";
363
+ };
364
+ setConfig: (value: import("./hardware-acceleration").HardwareAccelerationOption) => void;
365
+ };
336
366
  };
337
367
  readonly renderStill: {
338
368
  readonly offthreadVideoCacheSizeInBytes: {
@@ -11,6 +11,7 @@ const encoding_buffer_size_1 = require("./encoding-buffer-size");
11
11
  const encoding_max_rate_1 = require("./encoding-max-rate");
12
12
  const enforce_audio_1 = require("./enforce-audio");
13
13
  const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenation");
14
+ const hardware_acceleration_1 = require("./hardware-acceleration");
14
15
  const jpeg_quality_1 = require("./jpeg-quality");
15
16
  const log_level_1 = require("./log-level");
16
17
  const mute_1 = require("./mute");
@@ -47,9 +48,11 @@ exports.optionsMap = {
47
48
  separateAudioTo: separate_audio_1.separateAudioOption,
48
49
  audioCodec: audio_codec_1.audioCodecOption,
49
50
  onBrowserDownload: on_browser_download_1.onBrowserDownloadOption,
51
+ hardwareAcceleration: hardware_acceleration_1.hardwareAccelerationOption,
50
52
  },
51
53
  stitchFramesToVideo: {
52
54
  separateAudioTo: separate_audio_1.separateAudioOption,
55
+ hardwareAcceleration: hardware_acceleration_1.hardwareAccelerationOption,
53
56
  },
54
57
  renderStill: {
55
58
  offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
@@ -11,7 +11,7 @@ The above copyright notice and this permission notice shall be included in all c
11
11
 
12
12
  THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
13
  */
14
- /* eslint-disable max-depth, max-statements, complexity, max-lines-per-function */
14
+ /* eslint-disable max-depth */
15
15
  const SLASH = 47;
16
16
  const DOT = 46;
17
17
  const assertPath = (path) => {
@@ -1,3 +1,4 @@
1
+ import type { HardwareAccelerationOption } from './client';
1
2
  import type { Codec } from './codec';
2
3
  import type { FfmpegOverrideFn } from './ffmpeg-override';
3
4
  import type { VideoImageFormat } from './image-format';
@@ -38,6 +39,7 @@ type PreStitcherOptions = {
38
39
  indent: boolean;
39
40
  colorSpace: ColorSpace | null;
40
41
  binariesDirectory: string | null;
42
+ hardwareAcceleration: HardwareAccelerationOption;
41
43
  };
42
44
  export declare const prespawnFfmpeg: (options: PreStitcherOptions) => {
43
45
  task: import("execa").ExecaChildProcess<string>;
@@ -47,6 +47,9 @@ const prespawnFfmpeg = (options) => {
47
47
  encodingMaxRate: options.encodingMaxRate,
48
48
  encodingBufferSize: options.encodingBufferSize,
49
49
  colorSpace: options.colorSpace,
50
+ hardwareAcceleration: options.hardwareAcceleration,
51
+ indent: options.indent,
52
+ logLevel: options.logLevel,
50
53
  }),
51
54
  '-y',
52
55
  options.outputLocation,
@@ -1,7 +1,6 @@
1
- import type { ClipRegion } from 'remotion/no-react';
2
1
  import type { Page } from './browser/BrowserPage';
3
2
  import type { StillImageFormat } from './image-format';
4
- export declare const provideScreenshot: ({ page, imageFormat, options, jpegQuality, height, width, clipRegion, timeoutInMilliseconds, scale, }: {
3
+ export declare const provideScreenshot: ({ page, imageFormat, options, jpegQuality, height, width, timeoutInMilliseconds, scale, }: {
5
4
  page: Page;
6
5
  imageFormat: StillImageFormat;
7
6
  jpegQuality: number | undefined;
@@ -11,7 +10,6 @@ export declare const provideScreenshot: ({ page, imageFormat, options, jpegQuali
11
10
  };
12
11
  height: number;
13
12
  width: number;
14
- clipRegion: ClipRegion | null;
15
13
  timeoutInMilliseconds: number;
16
14
  scale: number;
17
15
  }) => Promise<Buffer>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.provideScreenshot = void 0;
4
4
  const screenshot_dom_element_1 = require("./screenshot-dom-element");
5
- const provideScreenshot = ({ page, imageFormat, options, jpegQuality, height, width, clipRegion, timeoutInMilliseconds, scale, }) => {
5
+ const provideScreenshot = ({ page, imageFormat, options, jpegQuality, height, width, timeoutInMilliseconds, scale, }) => {
6
6
  return (0, screenshot_dom_element_1.screenshotDOMElement)({
7
7
  page,
8
8
  opts: {
@@ -12,7 +12,6 @@ const provideScreenshot = ({ page, imageFormat, options, jpegQuality, height, wi
12
12
  jpegQuality,
13
13
  height,
14
14
  width,
15
- clipRegion,
16
15
  timeoutInMilliseconds,
17
16
  scale,
18
17
  });
@@ -63,7 +63,7 @@ async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, })
63
63
  // eslint-disable-next-line no-new-func
64
64
  new Function('(' + functionText + ')');
65
65
  }
66
- catch (error) {
66
+ catch (_g) {
67
67
  // This means we might have a function shorthand. Try another
68
68
  // time prefixing 'function '.
69
69
  if (functionText.startsWith('async '))
@@ -75,7 +75,7 @@ async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, })
75
75
  // eslint-disable-next-line no-new-func
76
76
  new Function('(' + functionText + ')');
77
77
  }
78
- catch (err) {
78
+ catch (_h) {
79
79
  // We tried hard to serialize, but there's a weird beast here.
80
80
  throw new Error('Passed function is not well-serializable!');
81
81
  }
@@ -137,7 +137,6 @@ function convertArgument(arg) {
137
137
  return { value: arg };
138
138
  }
139
139
  if (typeof arg === 'bigint')
140
- // eslint-disable-line valid-typeof
141
140
  return { unserializableValue: `${arg.toString()}n` };
142
141
  if (Object.is(arg, -0))
143
142
  return { unserializableValue: '-0' };
@@ -1,4 +1,3 @@
1
- import type { ClipRegion } from 'remotion/no-react';
2
1
  import type { Page } from './browser/BrowserPage';
3
2
  import type { StillImageFormat } from './image-format';
4
3
  export declare const screenshot: (options: {
@@ -9,6 +8,5 @@ export declare const screenshot: (options: {
9
8
  omitBackground: boolean;
10
9
  width: number;
11
10
  height: number;
12
- clipRegion: ClipRegion | null;
13
11
  scale: number;
14
12
  }) => Promise<Buffer | string>;
@@ -42,7 +42,6 @@ const screenshot = (options) => {
42
42
  omitBackground: options.omitBackground,
43
43
  path: options.path,
44
44
  jpegQuality: options.type === 'jpeg' ? options.jpegQuality : undefined,
45
- clipRegion: options.clipRegion,
46
45
  scale: options.scale,
47
46
  }));
48
47
  };
@@ -35,13 +35,13 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
35
35
  const replace_browser_1 = require("./replace-browser");
36
36
  const seek_to_frame_1 = require("./seek-to-frame");
37
37
  const set_props_and_env_1 = require("./set-props-and-env");
38
- const take_frame_and_compose_1 = require("./take-frame-and-compose");
38
+ const take_frame_1 = require("./take-frame");
39
39
  const truthy_1 = require("./truthy");
40
40
  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, resolvedConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourceMapGetter, logLevel, indent, parallelEncodingEnabled, compositionStart, forSeamlessAacConcatenation, onArtifact, binariesDirectory, }) => {
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, 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, {
@@ -191,7 +191,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
191
191
  throw new Error('Pass either `outputDir` or `onFrameBuffer` to renderFrames(), not both.');
192
192
  }
193
193
  const id = (0, perf_1.startPerfMeasure)('save');
194
- const { buffer, collectedAssets } = await (0, take_frame_and_compose_1.takeFrameAndCompose)({
194
+ const { buffer, collectedAssets } = await (0, take_frame_1.takeFrame)({
195
195
  frame,
196
196
  freePage,
197
197
  height,
@@ -209,9 +209,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
209
209
  jpegQuality,
210
210
  width,
211
211
  scale,
212
- downloadMap,
213
212
  wantsBuffer: Boolean(onFrameBuffer),
214
- compositor,
215
213
  timeoutInMilliseconds,
216
214
  });
217
215
  if (onFrameBuffer && !assetsOnly) {
@@ -465,7 +463,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
465
463
  }),
466
464
  browserInstance,
467
465
  ]).then(([{ server: openedServer, cleanupServer }, pInstance]) => {
468
- const { serveUrl, offthreadPort, compositor, sourceMap, downloadMap } = openedServer;
466
+ const { serveUrl, offthreadPort, sourceMap, downloadMap } = openedServer;
469
467
  const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(pInstance, logLevel, indent);
470
468
  const cycle = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, resolvedConcurrency, logLevel, indent);
471
469
  cleanup.push(() => {
@@ -483,7 +481,6 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
483
481
  proxyPort: offthreadPort,
484
482
  makeBrowser,
485
483
  browserReplacer,
486
- compositor,
487
484
  sourceMapGetter: sourceMap,
488
485
  downloadMap,
489
486
  cancelSignal,
@@ -135,5 +135,5 @@ export declare const internalRenderMedia: (args_0: InternalRenderMediaOptions) =
135
135
  * @returns {Promise<RenderMediaResult>} A promise that resolves to the rendering result, including a buffer and information about the slowest frames.
136
136
  *
137
137
  */
138
- export declare 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, }: RenderMediaOptions) => Promise<RenderMediaResult>;
138
+ export declare 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, }: RenderMediaOptions) => Promise<RenderMediaResult>;
139
139
  export {};
@@ -50,7 +50,7 @@ const validate_scale_1 = require("./validate-scale");
50
50
  const validate_videobitrate_1 = require("./validate-videobitrate");
51
51
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
52
52
  const SLOWEST_FRAME_COUNT = 10;
53
- const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, serializedInputPropsWithCustomSchema, 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, 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, }) => {
53
+ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, serializedInputPropsWithCustomSchema, 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, 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, }) => {
54
54
  if (repro) {
55
55
  (0, repro_1.enableRepro)({
56
56
  serveUrl,
@@ -69,6 +69,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
69
69
  videoBitrate,
70
70
  encodingMaxRate,
71
71
  encodingBufferSize,
72
+ hardwareAcceleration,
72
73
  });
73
74
  (0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
74
75
  (0, validate_videobitrate_1.validateBitrate)(videoBitrate, 'videoBitrate');
@@ -228,6 +229,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
228
229
  x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
229
230
  colorSpace,
230
231
  binariesDirectory,
232
+ hardwareAcceleration,
231
233
  });
232
234
  stitcherFfmpeg = preStitcher.task;
233
235
  }
@@ -240,7 +242,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
240
242
  try {
241
243
  await stitcherFfmpeg;
242
244
  }
243
- catch (err) {
245
+ catch (_b) {
244
246
  throw new Error(preStitcher === null || preStitcher === void 0 ? void 0 : preStitcher.getLogs());
245
247
  }
246
248
  }
@@ -422,6 +424,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
422
424
  binariesDirectory,
423
425
  separateAudioTo,
424
426
  metadata,
427
+ hardwareAcceleration,
425
428
  });
426
429
  })
427
430
  .then((buffer) => {
@@ -466,7 +469,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
466
469
  try {
467
470
  stitcherFfmpeg.kill();
468
471
  }
469
- catch (e) {
472
+ catch (_a) {
470
473
  // Ignore
471
474
  }
472
475
  return promise.then(() => {
@@ -487,7 +490,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
487
490
  cleanupServerFn === null || cleanupServerFn === void 0 ? void 0 : cleanupServerFn(false).catch((err) => {
488
491
  // Must prevent unhandled exception in cleanup function.
489
492
  // Might crash whole runtime.
490
- console.log('Could not cleanup: ', err);
493
+ logger_1.Log.error({ indent, logLevel }, 'Could not cleanup: ', err);
491
494
  });
492
495
  });
493
496
  });
@@ -505,13 +508,13 @@ exports.internalRenderMedia = (0, wrap_with_error_handling_1.wrapWithErrorHandli
505
508
  * @returns {Promise<RenderMediaResult>} A promise that resolves to the rendering result, including a buffer and information about the slowest frames.
506
509
  *
507
510
  */
508
- 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, }) => {
511
+ 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, }) => {
509
512
  var _a, _b;
510
- if (quality !== undefined) {
511
- console.warn(`The "quality" option has been renamed. Please use "jpegQuality" instead.`);
512
- }
513
513
  const indent = false;
514
514
  const logLevel = verbose || dumpBrowserLogs ? 'verbose' : (passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : 'info');
515
+ if (quality !== undefined) {
516
+ logger_1.Log.warn({ indent, logLevel }, `The "quality" option has been renamed. Please use "jpegQuality" instead.`);
517
+ }
515
518
  return (0, exports.internalRenderMedia)({
516
519
  proResProfile: proResProfile !== null && proResProfile !== void 0 ? proResProfile : undefined,
517
520
  x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
@@ -575,6 +578,7 @@ const renderMedia = ({ proResProfile, x264Preset, crf, composition, inputProps,
575
578
  metadata: metadata !== null && metadata !== void 0 ? metadata : null,
576
579
  // TODO: In the future, introduce this as a public API when launching the distributed rendering API
577
580
  compositionStart: 0,
581
+ hardwareAcceleration: hardwareAcceleration !== null && hardwareAcceleration !== void 0 ? hardwareAcceleration : 'disable',
578
582
  });
579
583
  };
580
584
  exports.renderMedia = renderMedia;
@@ -40,6 +40,7 @@ const filter_asset_types_1 = require("./filter-asset-types");
40
40
  const find_closest_package_json_1 = require("./find-closest-package-json");
41
41
  const image_format_1 = require("./image-format");
42
42
  const jpeg_quality_1 = require("./jpeg-quality");
43
+ const logger_1 = require("./logger");
43
44
  const make_cancel_signal_1 = require("./make-cancel-signal");
44
45
  const open_browser_1 = require("./open-browser");
45
46
  const overwrite_1 = require("./overwrite");
@@ -47,12 +48,12 @@ const prepare_server_1 = require("./prepare-server");
47
48
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
48
49
  const seek_to_frame_1 = require("./seek-to-frame");
49
50
  const set_props_and_env_1 = require("./set-props-and-env");
50
- const take_frame_and_compose_1 = require("./take-frame-and-compose");
51
+ const take_frame_1 = require("./take-frame");
51
52
  const validate_1 = require("./validate");
52
53
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
53
54
  const validate_scale_1 = require("./validate-scale");
54
55
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
55
- 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, compositor, sourceMapGetter, downloadMap, logLevel, indent, serializedResolvedPropsWithCustomSchema, onBrowserDownload, onArtifact, }) => {
56
+ 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, }) => {
56
57
  (0, validate_1.validateDimension)(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
57
58
  (0, validate_1.validateDimension)(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
58
59
  (0, validate_1.validateFps)(composition.fps, 'in the `config` object of `renderStill()`', false);
@@ -127,7 +128,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
127
128
  }
128
129
  else {
129
130
  browserInstance.close(true, logLevel, indent).catch((err) => {
130
- console.log('Unable to close browser', err);
131
+ logger_1.Log.error({ indent, logLevel }, 'Unable to close browser', err);
131
132
  });
132
133
  }
133
134
  };
@@ -188,7 +189,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
188
189
  logLevel,
189
190
  attempt: 0,
190
191
  });
191
- const { buffer, collectedAssets } = await (0, take_frame_and_compose_1.takeFrameAndCompose)({
192
+ const { buffer, collectedAssets } = await (0, take_frame_1.takeFrame)({
192
193
  frame: stillFrame,
193
194
  freePage: page,
194
195
  height: composition.height,
@@ -198,8 +199,6 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
198
199
  output,
199
200
  jpegQuality,
200
201
  wantsBuffer: !output,
201
- compositor,
202
- downloadMap,
203
202
  timeoutInMilliseconds,
204
203
  });
205
204
  const artifactAssets = (0, filter_asset_types_1.onlyArtifact)(collectedAssets);
@@ -235,15 +234,13 @@ const internalRenderStillRaw = (options) => {
235
234
  })
236
235
  .then(({ server, cleanupServer }) => {
237
236
  cleanup.push(() => cleanupServer(false));
238
- const { serveUrl, offthreadPort, compositor, sourceMap: sourceMapGetter, downloadMap, } = server;
237
+ const { serveUrl, offthreadPort, sourceMap: sourceMapGetter } = server;
239
238
  return innerRenderStill({
240
239
  ...options,
241
240
  serveUrl,
242
241
  onError,
243
242
  proxyPort: offthreadPort,
244
- compositor,
245
243
  sourceMapGetter,
246
- downloadMap,
247
244
  });
248
245
  })
249
246
  .then((res) => resolve(res))
@@ -251,7 +248,7 @@ const internalRenderStillRaw = (options) => {
251
248
  .finally(() => {
252
249
  cleanup.forEach((c) => {
253
250
  c().catch((err) => {
254
- console.log('Cleanup error:', err);
251
+ logger_1.Log.error(options, 'Cleanup error:', err);
255
252
  });
256
253
  });
257
254
  });
@@ -279,11 +276,11 @@ const renderStill = (options) => {
279
276
  if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
280
277
  throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
281
278
  }
279
+ const indent = false;
280
+ const logLevel = passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : (verbose || dumpBrowserLogs ? 'verbose' : 'info');
282
281
  if (quality) {
283
- console.warn('Passing `quality()` to `renderStill` is deprecated. Use `jpegQuality` instead.');
282
+ logger_1.Log.warn({ indent, logLevel }, 'Passing `quality()` to `renderStill` is deprecated. Use `jpegQuality` instead.');
284
283
  }
285
- const logLevel = passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : (verbose || dumpBrowserLogs ? 'verbose' : 'info');
286
- const indent = false;
287
284
  return (0, exports.internalRenderStill)({
288
285
  composition,
289
286
  browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
@@ -1,7 +1,6 @@
1
- import type { ClipRegion } from 'remotion/no-react';
2
1
  import type { Page } from './browser/BrowserPage';
3
2
  import type { StillImageFormat } from './image-format';
4
- export declare const screenshotDOMElement: ({ page, imageFormat, jpegQuality, opts, height, width, clipRegion, timeoutInMilliseconds, scale, }: {
3
+ export declare const screenshotDOMElement: ({ page, imageFormat, jpegQuality, opts, height, width, timeoutInMilliseconds, scale, }: {
5
4
  page: Page;
6
5
  imageFormat: StillImageFormat;
7
6
  jpegQuality: number | undefined;
@@ -10,7 +9,6 @@ export declare const screenshotDOMElement: ({ page, imageFormat, jpegQuality, op
10
9
  };
11
10
  height: number;
12
11
  width: number;
13
- clipRegion: ClipRegion | null;
14
12
  timeoutInMilliseconds: number;
15
13
  scale: number;
16
14
  }) => Promise<Buffer>;