@remotion/renderer 4.0.22 → 4.0.24

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 (109) hide show
  1. package/.prettierignore +2 -0
  2. package/dist/assets/get-video-stream-duration.d.ts +9 -0
  3. package/dist/assets/get-video-stream-duration.js +71 -0
  4. package/dist/audio-codec.d.ts +3 -3
  5. package/dist/calculate-sar-dar-pixels.d.ts +9 -0
  6. package/dist/calculate-sar-dar-pixels.js +19 -0
  7. package/dist/client.d.ts +154 -8
  8. package/dist/client.js +4 -0
  9. package/dist/codec.d.ts +1 -1
  10. package/dist/compositor/compositor.d.ts +2 -2
  11. package/dist/compositor/compositor.js +22 -19
  12. package/dist/compositor/payloads.d.ts +2 -2
  13. package/dist/copy-to-clipboard.js +1 -1
  14. package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
  15. package/dist/determine-resize-params.d.ts +4 -0
  16. package/dist/determine-resize-params.js +10 -0
  17. package/dist/determine-vcodec-ffmpeg-flags.d.ts +2 -0
  18. package/dist/determine-vcodec-ffmpeg-flags.js +13 -0
  19. package/dist/ensure-ffmpeg.d.ts +18 -0
  20. package/dist/ensure-ffmpeg.js +58 -0
  21. package/dist/ensure-presentation-timestamp.d.ts +15 -0
  22. package/dist/ensure-presentation-timestamp.js +88 -0
  23. package/dist/extract-frame-from-video.d.ts +16 -0
  24. package/dist/extract-frame-from-video.js +191 -0
  25. package/dist/ffmpeg-executable.d.ts +1 -0
  26. package/dist/ffmpeg-executable.js +2 -0
  27. package/dist/ffmpeg-flags.d.ts +31 -0
  28. package/dist/ffmpeg-flags.js +245 -0
  29. package/dist/file-extensions.d.ts +1 -1
  30. package/dist/format-logs.js +3 -1
  31. package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
  32. package/dist/frame-to-ffmpeg-timestamp.js +8 -0
  33. package/dist/get-can-extract-frames-fast.d.ts +14 -0
  34. package/dist/get-can-extract-frames-fast.js +71 -0
  35. package/dist/get-compositions.d.ts +5 -2
  36. package/dist/get-compositions.js +4 -1
  37. package/dist/get-extension-from-codec.js +1 -2
  38. package/dist/get-frame-of-video-slow.d.ts +17 -0
  39. package/dist/get-frame-of-video-slow.js +72 -0
  40. package/dist/get-silent-parts.js +1 -1
  41. package/dist/get-video-info.d.ts +8 -0
  42. package/dist/get-video-info.js +59 -0
  43. package/dist/get-video-metadata.js +1 -1
  44. package/dist/image-format.d.ts +2 -2
  45. package/dist/index.d.ts +38 -14
  46. package/dist/is-beyond-last-frame.d.ts +3 -0
  47. package/dist/is-beyond-last-frame.js +12 -0
  48. package/dist/last-frame-from-video-cache.d.ts +17 -0
  49. package/dist/last-frame-from-video-cache.js +55 -0
  50. package/dist/legacy-webpack-config.d.ts +9 -0
  51. package/dist/legacy-webpack-config.js +13 -0
  52. package/dist/log-level.d.ts +1 -1
  53. package/dist/offthread-video-server.d.ts +2 -1
  54. package/dist/offthread-video-server.js +4 -2
  55. package/dist/open-browser.d.ts +1 -1
  56. package/dist/options/audio-bitrate.d.ts +8 -2
  57. package/dist/options/audio-bitrate.js +1 -0
  58. package/dist/options/crf.d.ts +8 -2
  59. package/dist/options/crf.js +1 -0
  60. package/dist/options/enforce-audio.d.ts +8 -2
  61. package/dist/options/enforce-audio.js +1 -0
  62. package/dist/options/jpeg-quality.d.ts +8 -2
  63. package/dist/options/jpeg-quality.js +1 -0
  64. package/dist/options/mute.d.ts +8 -2
  65. package/dist/options/mute.js +1 -0
  66. package/dist/options/offthreadvideo-cache-size.d.ts +9 -0
  67. package/dist/options/offthreadvideo-cache-size.js +33 -0
  68. package/dist/options/option.d.ts +7 -2
  69. package/dist/options/options-map.d.ts +82 -0
  70. package/dist/options/options-map.js +16 -0
  71. package/dist/options/scale.d.ts +8 -2
  72. package/dist/options/scale.js +1 -0
  73. package/dist/options/video-bitrate.d.ts +8 -2
  74. package/dist/options/video-bitrate.js +1 -0
  75. package/dist/options/video-codec.d.ts +8 -2
  76. package/dist/options/video-codec.js +1 -0
  77. package/dist/pixel-format.d.ts +1 -1
  78. package/dist/prepare-server.d.ts +2 -1
  79. package/dist/prepare-server.js +3 -1
  80. package/dist/prores-profile.d.ts +1 -1
  81. package/dist/provide-screenshot.d.ts +0 -1
  82. package/dist/puppeteer-screenshot.d.ts +0 -1
  83. package/dist/quality.d.ts +1 -0
  84. package/dist/quality.js +21 -0
  85. package/dist/render-frames.d.ts +5 -2
  86. package/dist/render-frames.js +4 -2
  87. package/dist/render-media.d.ts +6 -3
  88. package/dist/render-media.js +5 -2
  89. package/dist/render-still.d.ts +5 -1
  90. package/dist/render-still.js +3 -1
  91. package/dist/screenshot-dom-element.d.ts +0 -1
  92. package/dist/screenshot-task.d.ts +0 -1
  93. package/dist/select-composition.d.ts +4 -1
  94. package/dist/select-composition.js +5 -1
  95. package/dist/serve-static.d.ts +1 -0
  96. package/dist/serve-static.js +1 -0
  97. package/dist/stitch-frames-to-video.d.ts +0 -1
  98. package/dist/take-frame-and-compose.d.ts +0 -1
  99. package/dist/try-to-extract-frame-of-video-fast.d.ts +12 -0
  100. package/dist/try-to-extract-frame-of-video-fast.js +55 -0
  101. package/dist/validate-ffmpeg.d.ts +7 -0
  102. package/dist/validate-ffmpeg.js +77 -0
  103. package/dist/validate-opengl-renderer.d.ts +1 -1
  104. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  105. package/dist/warn-about-ffmpeg-version.js +37 -0
  106. package/dist/x264-preset.d.ts +1 -1
  107. package/package.json +11 -12
  108. package/dist/presets-profile.d.ts +0 -7
  109. package/dist/presets-profile.js +0 -27
@@ -3,7 +3,7 @@ import type { HeadlessBrowser } from './browser/Browser';
3
3
  import type { Viewport } from './browser/PuppeteerViewport';
4
4
  import { type LogLevel } from './log-level';
5
5
  declare const validRenderers: readonly ["swangle", "angle", "egl", "swiftshader"];
6
- type OpenGlRenderer = typeof validRenderers[number];
6
+ type OpenGlRenderer = (typeof validRenderers)[number];
7
7
  export type ChromiumOptions = {
8
8
  ignoreCertificateErrors?: boolean;
9
9
  disableWebSecurity?: boolean;
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const audioBitrateOption: RemotionOption;
1
+ export declare const audioBitrateOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: string;
8
+ };
@@ -8,4 +8,5 @@ exports.audioBitrateOption = {
8
8
  description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Specify the target bitrate for the generated video. The syntax for FFMPEGs", (0, jsx_runtime_1.jsx)("code", { children: "-b:a" }), " parameter should be used. FFMPEG may encode the video in a way that will not result in the exact audio bitrate specified. Example values: ", (0, jsx_runtime_1.jsx)("code", { children: "512K" }), " for 512 kbps, ", (0, jsx_runtime_1.jsx)("code", { children: "1M" }), " for 1 Mbps. Default: ", (0, jsx_runtime_1.jsx)("code", { children: "320k" })] })),
9
9
  ssrName: 'audioBitrate',
10
10
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#audiobitrate-',
11
+ type: '0',
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const crfOption: RemotionOption;
1
+ export declare const crfOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: number;
8
+ };
@@ -8,4 +8,5 @@ exports.crfOption = {
8
8
  description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "No matter which codec you end up using, there's always a tradeoff between file size and video quality. You can control it by setting the CRF (Constant Rate Factor). The lower the number, the better the quality, the higher the number, the smaller the file is \u2013 of course at the cost of quality." })),
9
9
  ssrName: 'crf',
10
10
  docLink: 'https://www.remotion.dev/docs/encoding/#controlling-quality-using-the-crf-setting',
11
+ type: 0,
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const enforceAudioOption: RemotionOption;
1
+ export declare const enforceAudioOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: boolean;
8
+ };
@@ -8,4 +8,5 @@ exports.enforceAudioOption = {
8
8
  description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Render a silent audio track if there would be none otherwise." })),
9
9
  ssrName: 'enforceAudioTrack',
10
10
  docLink: 'https://www.remotion.dev/docs/config#setenforceaudiotrack-',
11
+ type: false,
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const jpegQualityOption: RemotionOption;
1
+ export declare const jpegQualityOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: number;
8
+ };
@@ -8,4 +8,5 @@ exports.jpegQualityOption = {
8
8
  description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default: 80." })),
9
9
  ssrName: 'jpegQuality',
10
10
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#jpeg-quality',
11
+ type: 0,
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const muteOption: RemotionOption;
1
+ export declare const muteOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: boolean;
8
+ };
@@ -8,4 +8,5 @@ exports.muteOption = {
8
8
  description: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "The Audio of the video will be omitted." }),
9
9
  ssrName: 'muted',
10
10
  docLink: 'https://www.remotion.dev/docs/using-audio/#muted-property',
11
+ type: false,
11
12
  };
@@ -0,0 +1,9 @@
1
+ export declare const offthreadVideoCacheSizeInBytesOption: {
2
+ name: string;
3
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
4
+ description: JSX.Element;
5
+ ssrName: "offthreadVideoCacheSizeInBytes";
6
+ docLink: string;
7
+ type: number | null;
8
+ };
9
+ export declare const validateOffthreadVideoCacheSizeInBytes: (option: unknown) => void;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateOffthreadVideoCacheSizeInBytes = exports.offthreadVideoCacheSizeInBytesOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ exports.offthreadVideoCacheSizeInBytesOption = {
6
+ name: 'OffthreadVideo cache size',
7
+ cliFlag: 'offthreadvideo-cache-size-in-bytes',
8
+ description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["From v4.0, Remotion has a cache for", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs/offthreadvideo", children: (0, jsx_runtime_1.jsx)("code", { children: "<OffthreadVideo>" }) }), ' ', "frames. The default is ", (0, jsx_runtime_1.jsx)("code", { children: "null" }), ", corresponding to half of the system memory available when the render starts.", (0, jsx_runtime_1.jsx)("br", {}), " This option allows to override the size of the cache. The higher it is, the faster the render will be, but the more memory will be used.", (0, jsx_runtime_1.jsx)("br", {}), "The used value will be printed when running in verbose mode.", (0, jsx_runtime_1.jsx)("br", {}), "Default: ", (0, jsx_runtime_1.jsx)("code", { children: "null" })] })),
9
+ ssrName: 'offthreadVideoCacheSizeInBytes',
10
+ docLink: 'https://www.remotion.dev/docs/offthreadvideo',
11
+ type: 0,
12
+ };
13
+ const validateOffthreadVideoCacheSizeInBytes = (option) => {
14
+ if (option === undefined || option === null) {
15
+ return;
16
+ }
17
+ if (typeof option !== 'number') {
18
+ throw new Error('Expected a number');
19
+ }
20
+ if (option < 0) {
21
+ throw new Error('Expected a positive number');
22
+ }
23
+ if (Number.isNaN(option)) {
24
+ throw new Error('Expected a number');
25
+ }
26
+ if (!Number.isFinite(option)) {
27
+ throw new Error('Expected a finite number');
28
+ }
29
+ if (option % 1 !== 0) {
30
+ throw new Error('Expected a whole number');
31
+ }
32
+ };
33
+ exports.validateOffthreadVideoCacheSizeInBytes = validateOffthreadVideoCacheSizeInBytes;
@@ -1,8 +1,13 @@
1
1
  import type React from 'react';
2
- export type RemotionOption = {
2
+ export type RemotionOption<SsrName extends string, Type> = {
3
3
  name: string;
4
4
  cliFlag: string;
5
- ssrName: string;
5
+ ssrName: SsrName;
6
6
  description: React.ReactNode;
7
7
  docLink: string;
8
+ type: Type;
9
+ };
10
+ export type AnyRemotionOption = RemotionOption<string, unknown>;
11
+ export type ToOptions<T extends readonly AnyRemotionOption[]> = {
12
+ [K in T[number]['ssrName']]: T[number]['type'];
8
13
  };
@@ -0,0 +1,82 @@
1
+ export declare const optionsMap: {
2
+ readonly renderMedia: readonly [{
3
+ name: string;
4
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
5
+ description: JSX.Element;
6
+ ssrName: "offthreadVideoCacheSizeInBytes";
7
+ docLink: string;
8
+ type: number | null;
9
+ }];
10
+ readonly renderStill: readonly [{
11
+ name: string;
12
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
13
+ description: JSX.Element;
14
+ ssrName: "offthreadVideoCacheSizeInBytes";
15
+ docLink: string;
16
+ type: number | null;
17
+ }];
18
+ readonly getCompositions: readonly [{
19
+ name: string;
20
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
21
+ description: JSX.Element;
22
+ ssrName: "offthreadVideoCacheSizeInBytes";
23
+ docLink: string;
24
+ type: number | null;
25
+ }];
26
+ readonly selectComposition: readonly [{
27
+ name: string;
28
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
29
+ description: JSX.Element;
30
+ ssrName: "offthreadVideoCacheSizeInBytes";
31
+ docLink: string;
32
+ type: number | null;
33
+ }];
34
+ readonly renderFrames: readonly [{
35
+ name: string;
36
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
37
+ description: JSX.Element;
38
+ ssrName: "offthreadVideoCacheSizeInBytes";
39
+ docLink: string;
40
+ type: number | null;
41
+ }];
42
+ readonly renderMediaOnLambda: readonly [{
43
+ name: string;
44
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
45
+ description: JSX.Element;
46
+ ssrName: "offthreadVideoCacheSizeInBytes";
47
+ docLink: string;
48
+ type: number | null;
49
+ }];
50
+ readonly renderStillOnLambda: readonly [{
51
+ name: string;
52
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
53
+ description: JSX.Element;
54
+ ssrName: "offthreadVideoCacheSizeInBytes";
55
+ docLink: string;
56
+ type: number | null;
57
+ }];
58
+ readonly getCompositionsOnLambda: readonly [{
59
+ name: string;
60
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
61
+ description: JSX.Element;
62
+ ssrName: "offthreadVideoCacheSizeInBytes";
63
+ docLink: string;
64
+ type: number | null;
65
+ }];
66
+ readonly renderMediaOnCloudRun: readonly [{
67
+ name: string;
68
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
69
+ description: JSX.Element;
70
+ ssrName: "offthreadVideoCacheSizeInBytes";
71
+ docLink: string;
72
+ type: number | null;
73
+ }];
74
+ readonly renderStillOnCloudRun: readonly [{
75
+ name: string;
76
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
77
+ description: JSX.Element;
78
+ ssrName: "offthreadVideoCacheSizeInBytes";
79
+ docLink: string;
80
+ type: number | null;
81
+ }];
82
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optionsMap = void 0;
4
+ const offthreadvideo_cache_size_1 = require("./offthreadvideo-cache-size");
5
+ exports.optionsMap = {
6
+ renderMedia: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
7
+ renderStill: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
8
+ getCompositions: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
9
+ selectComposition: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
10
+ renderFrames: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
11
+ renderMediaOnLambda: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
12
+ renderStillOnLambda: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
13
+ getCompositionsOnLambda: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
14
+ renderMediaOnCloudRun: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
15
+ renderStillOnCloudRun: [offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption],
16
+ };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const scaleOption: RemotionOption;
1
+ export declare const scaleOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: number;
8
+ };
@@ -8,4 +8,5 @@ exports.scaleOption = {
8
8
  description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Scales the output by a factor. For example, a 1280x720px frame will become a 1920x1080px frame with a scale factor of ", (0, jsx_runtime_1.jsx)("code", { children: "1.5" }), ". Vector elements like fonts and HTML markups will be rendered with extra details."] })),
9
9
  ssrName: 'scale',
10
10
  docLink: 'https://www.remotion.dev/docs/scaling',
11
+ type: 0,
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const videoBitrate: RemotionOption;
1
+ export declare const videoBitrate: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: string;
8
+ };
@@ -8,4 +8,5 @@ exports.videoBitrate = {
8
8
  description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Specify the target bitrate for the generated video. The syntax for FFMPEGs", (0, jsx_runtime_1.jsx)("code", { children: "-b:v" }), " parameter should be used. FFMPEG may encode the video in a way that will not result in the exact video bitrate specified. Example values: ", (0, jsx_runtime_1.jsx)("code", { children: "512K" }), " for 512 kbps, ", (0, jsx_runtime_1.jsx)("code", { children: "1M" }), " for 1 Mbps."] })),
9
9
  ssrName: 'videoBitrate',
10
10
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#videobitrate-',
11
+ type: '',
11
12
  };
@@ -1,2 +1,8 @@
1
- import type { RemotionOption } from './option';
2
- export declare const videoCodecOption: RemotionOption;
1
+ export declare const videoCodecOption: {
2
+ name: string;
3
+ cliFlag: string;
4
+ description: JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: string;
8
+ };
@@ -8,4 +8,5 @@ exports.videoCodecOption = {
8
8
  description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "H264 works well in most cases, but sometimes it's worth going for a different codec. WebM achieves higher compression but is slower to render. WebM and ProRes support transparency." })),
9
9
  ssrName: 'codec',
10
10
  docLink: 'https://www.remotion.dev/docs/encoding/#choosing-a-codec',
11
+ type: '',
11
12
  };
@@ -1,5 +1,5 @@
1
1
  import type { Codec } from './codec';
2
2
  export declare const validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
3
- export type PixelFormat = typeof validPixelFormats[number];
3
+ export type PixelFormat = (typeof validPixelFormats)[number];
4
4
  export declare const DEFAULT_PIXEL_FORMAT: PixelFormat;
5
5
  export declare const validateSelectedPixelFormatAndCodecCombination: (pixelFormat: PixelFormat | undefined, codec: Codec) => undefined;
@@ -18,8 +18,9 @@ type PrepareServerOptions = {
18
18
  concurrency: number;
19
19
  logLevel: LogLevel;
20
20
  indent: boolean;
21
+ offthreadVideoCacheSizeInBytes: number | null;
21
22
  };
22
- export declare const prepareServer: ({ webpackConfigOrServeUrl, port, remotionRoot, concurrency, logLevel, indent, }: PrepareServerOptions) => Promise<RemotionServer>;
23
+ export declare const prepareServer: ({ webpackConfigOrServeUrl, port, remotionRoot, concurrency, logLevel, indent, offthreadVideoCacheSizeInBytes, }: PrepareServerOptions) => Promise<RemotionServer>;
23
24
  export declare const makeOrReuseServer: (server: RemotionServer | undefined, config: PrepareServerOptions, { onDownload, onError, }: {
24
25
  onError: (err: Error) => void;
25
26
  onDownload: RenderMediaOnDownload | null;
@@ -15,7 +15,7 @@ const logger_1 = require("./logger");
15
15
  const serve_static_1 = require("./serve-static");
16
16
  const symbolicate_stacktrace_1 = require("./symbolicate-stacktrace");
17
17
  const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
18
- const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, concurrency, logLevel, indent, }) => {
18
+ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, concurrency, logLevel, indent, offthreadVideoCacheSizeInBytes, }) => {
19
19
  const downloadMap = (0, download_map_1.makeDownloadMap)();
20
20
  logger_1.Log.verboseAdvanced({ indent, logLevel }, 'Created directory for temporary files', downloadMap.assetDir);
21
21
  if ((0, is_serve_url_1.isServeUrl)(webpackConfigOrServeUrl)) {
@@ -26,6 +26,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
26
26
  concurrency,
27
27
  logLevel,
28
28
  indent,
29
+ offthreadVideoCacheSizeInBytes,
29
30
  });
30
31
  return Promise.resolve({
31
32
  serveUrl: webpackConfigOrServeUrl,
@@ -56,6 +57,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
56
57
  concurrency,
57
58
  logLevel,
58
59
  indent,
60
+ offthreadVideoCacheSizeInBytes,
59
61
  });
60
62
  return Promise.resolve({
61
63
  closeServer: async (force) => {
@@ -1,6 +1,6 @@
1
1
  import type { Codec } from './codec';
2
2
  export declare const proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
3
- export type ProResProfile = typeof proResProfileOptions[number];
3
+ export type ProResProfile = (typeof proResProfileOptions)[number];
4
4
  export declare const validateSelectedCodecAndProResCombination: ({ codec, proResProfile, }: {
5
5
  codec: Codec;
6
6
  proResProfile: ProResProfile | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -0,0 +1 @@
1
+ export declare const validateQuality: (q: number | undefined) => void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateQuality = void 0;
4
+ const validateQuality = (q) => {
5
+ if (typeof q !== 'undefined' && typeof q !== 'number') {
6
+ throw new Error(`Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`);
7
+ }
8
+ if (typeof q === 'undefined') {
9
+ return;
10
+ }
11
+ if (!Number.isFinite(q)) {
12
+ throw new RangeError(`Quality must be a finite number, but is ${q}`);
13
+ }
14
+ if (Number.isNaN(q)) {
15
+ throw new RangeError(`Quality is NaN, but must be a real number`);
16
+ }
17
+ if (q > 100 || q < 0) {
18
+ throw new RangeError('Quality option must be between 0 and 100.');
19
+ }
20
+ };
21
+ exports.validateQuality = validateQuality;
@@ -9,6 +9,8 @@ import type { VideoImageFormat } from './image-format';
9
9
  import { type LogLevel } from './log-level';
10
10
  import type { CancelSignal } from './make-cancel-signal';
11
11
  import type { ChromiumOptions } from './open-browser';
12
+ import type { ToOptions } from './options/option';
13
+ import type { optionsMap } from './options/options-map';
12
14
  import type { RemotionServer } from './prepare-server';
13
15
  import type { OnStartData, RenderFramesOutput } from './types';
14
16
  export type InternalRenderFramesOptions = {
@@ -39,7 +41,7 @@ export type InternalRenderFramesOptions = {
39
41
  logLevel: LogLevel;
40
42
  serializedInputPropsWithCustomSchema: string;
41
43
  serializedResolvedPropsWithCustomSchema: string;
42
- };
44
+ } & ToOptions<typeof optionsMap.renderFrames>;
43
45
  export type RenderFramesOptions = {
44
46
  onStart: (data: OnStartData) => void;
45
47
  onFrameUpdate: (framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void;
@@ -77,8 +79,9 @@ export type RenderFramesOptions = {
77
79
  muted?: boolean;
78
80
  concurrency?: number | string | null;
79
81
  serveUrl: string;
82
+ offthreadVideoCacheSizeInBytes?: number | null;
80
83
  };
81
- export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: InternalRenderFramesOptions) => Promise<RenderFramesOutput>;
84
+ export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, }: InternalRenderFramesOptions) => Promise<RenderFramesOutput>;
82
85
  /**
83
86
  * @description Renders a series of images using Puppeteer and computes information for mixing audio.
84
87
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
@@ -299,7 +299,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
299
299
  await Promise.all(downloadPromises);
300
300
  return result;
301
301
  };
302
- const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }) => {
302
+ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, }) => {
303
303
  remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
304
304
  remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderFrames()`');
305
305
  remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderFrames()`', false);
@@ -340,6 +340,7 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
340
340
  concurrency: actualConcurrency,
341
341
  logLevel,
342
342
  indent,
343
+ offthreadVideoCacheSizeInBytes,
343
344
  }, {
344
345
  onDownload,
345
346
  onError,
@@ -425,7 +426,7 @@ exports.internalRenderFrames = internalRenderFrames;
425
426
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
426
427
  */
427
428
  const renderFrames = (options) => {
428
- const { composition, inputProps, onFrameUpdate, onStart, outputDir, serveUrl, browserExecutable, cancelSignal, chromiumOptions, concurrency, dumpBrowserLogs, envVariables, everyNthFrame, frameRange, imageFormat, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, logLevel, } = options;
429
+ const { composition, inputProps, onFrameUpdate, onStart, outputDir, serveUrl, browserExecutable, cancelSignal, chromiumOptions, concurrency, dumpBrowserLogs, envVariables, everyNthFrame, frameRange, imageFormat, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, logLevel, offthreadVideoCacheSizeInBytes, } = options;
429
430
  if (!composition) {
430
431
  throw new Error('No `composition` option has been specified for renderFrames()');
431
432
  }
@@ -471,6 +472,7 @@ const renderFrames = (options) => {
471
472
  timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT,
472
473
  webpackBundleOrServeUrl: serveUrl,
473
474
  server: undefined,
475
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
474
476
  });
475
477
  };
476
478
  exports.renderFrames = renderFrames;
@@ -12,6 +12,8 @@ import type { VideoImageFormat } from './image-format';
12
12
  import { type LogLevel } from './log-level';
13
13
  import type { CancelSignal } from './make-cancel-signal';
14
14
  import type { ChromiumOptions } from './open-browser';
15
+ import type { ToOptions } from './options/option';
16
+ import type { optionsMap } from './options/options-map';
15
17
  import type { PixelFormat } from './pixel-format';
16
18
  import type { RemotionServer } from './prepare-server';
17
19
  import type { ProResProfile } from './prores-profile';
@@ -72,7 +74,7 @@ export type InternalRenderMediaOptions = {
72
74
  audioCodec: AudioCodec | null;
73
75
  serveUrl: string;
74
76
  concurrency: number | string | null;
75
- };
77
+ } & ToOptions<typeof optionsMap.renderMedia>;
76
78
  export type RenderMediaOptions = {
77
79
  outputLocation?: string | null;
78
80
  codec: Codec;
@@ -123,16 +125,17 @@ export type RenderMediaOptions = {
123
125
  serveUrl: string;
124
126
  concurrency?: number | string | null;
125
127
  logLevel?: LogLevel;
128
+ offthreadVideoCacheSizeInBytes?: number | null;
126
129
  };
127
130
  type RenderMediaResult = {
128
131
  buffer: Buffer | null;
129
132
  slowestFrames: SlowFrame[];
130
133
  };
131
- export declare const internalRenderMedia: ({ 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, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }: InternalRenderMediaOptions) => Promise<RenderMediaResult>;
134
+ export declare const internalRenderMedia: ({ 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, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, }: InternalRenderMediaOptions) => Promise<RenderMediaResult>;
132
135
  /**
133
136
  *
134
137
  * @description Render a video from a composition
135
138
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
136
139
  */
137
- 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, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel, }: RenderMediaOptions) => Promise<RenderMediaResult>;
140
+ 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, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel, offthreadVideoCacheSizeInBytes, }: RenderMediaOptions) => Promise<RenderMediaResult>;
138
141
  export {};
@@ -44,7 +44,7 @@ const validate_scale_1 = require("./validate-scale");
44
44
  const validate_videobitrate_1 = require("./validate-videobitrate");
45
45
  const x264_preset_1 = require("./x264-preset");
46
46
  const SLOWEST_FRAME_COUNT = 10;
47
- const internalRenderMedia = ({ 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, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }) => {
47
+ const internalRenderMedia = ({ 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, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, }) => {
48
48
  (0, jpeg_quality_1.validateJpegQuality)(jpegQuality);
49
49
  (0, crf_1.validateQualitySettings)({ crf, codec, videoBitrate });
50
50
  (0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
@@ -235,6 +235,7 @@ const internalRenderMedia = ({ proResProfile, x264Preset, crf, composition, seri
235
235
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
236
236
  logLevel,
237
237
  webpackConfigOrServeUrl: serveUrl,
238
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
238
239
  }, {
239
240
  onDownload,
240
241
  onError: (err) => reject(err),
@@ -298,6 +299,7 @@ const internalRenderMedia = ({ proResProfile, x264Preset, crf, composition, seri
298
299
  indent,
299
300
  server,
300
301
  serializedResolvedPropsWithCustomSchema,
302
+ offthreadVideoCacheSizeInBytes,
301
303
  });
302
304
  return renderFramesProc;
303
305
  })
@@ -417,7 +419,7 @@ exports.internalRenderMedia = internalRenderMedia;
417
419
  * @description Render a video from a composition
418
420
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
419
421
  */
420
- 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, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel, }) => {
422
+ 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, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel, offthreadVideoCacheSizeInBytes, }) => {
421
423
  var _a, _b;
422
424
  if (quality !== undefined) {
423
425
  console.warn(`The "quality" option has been renamed. Please use "jpegQuality" instead.`);
@@ -472,6 +474,7 @@ const renderMedia = ({ proResProfile, x264Preset, crf, composition, inputProps,
472
474
  staticBase: null,
473
475
  data: (_b = composition.props) !== null && _b !== void 0 ? _b : {},
474
476
  }).serializedString,
477
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
475
478
  });
476
479
  };
477
480
  exports.renderMedia = renderMedia;
@@ -8,6 +8,8 @@ import type { StillImageFormat } from './image-format';
8
8
  import type { LogLevel } from './log-level';
9
9
  import type { CancelSignal } from './make-cancel-signal';
10
10
  import type { ChromiumOptions } from './open-browser';
11
+ import type { ToOptions } from './options/option';
12
+ import type { optionsMap } from './options/options-map';
11
13
  import type { RemotionServer } from './prepare-server';
12
14
  type InternalRenderStillOptions = {
13
15
  composition: VideoConfig;
@@ -32,7 +34,8 @@ type InternalRenderStillOptions = {
32
34
  logLevel: LogLevel;
33
35
  serveUrl: string;
34
36
  port: number | null;
35
- };
37
+ offthreadVideoCacheSizeInBytes: number | null;
38
+ } & ToOptions<typeof optionsMap.renderStill>;
36
39
  export type RenderStillOptions = {
37
40
  port?: number | null;
38
41
  composition: VideoConfig;
@@ -64,6 +67,7 @@ export type RenderStillOptions = {
64
67
  * @deprecated Renamed to `jpegQuality`
65
68
  */
66
69
  quality?: never;
70
+ offthreadVideoCacheSizeInBytes?: number | null;
67
71
  };
68
72
  type RenderStillReturnValue = {
69
73
  buffer: Buffer | null;
@@ -204,6 +204,7 @@ const internalRenderStill = (options) => {
204
204
  concurrency: 1,
205
205
  logLevel: options.logLevel,
206
206
  indent: options.indent,
207
+ offthreadVideoCacheSizeInBytes: options.offthreadVideoCacheSizeInBytes,
207
208
  }, {
208
209
  onDownload: options.onDownload,
209
210
  onError,
@@ -247,7 +248,7 @@ exports.internalRenderStill = internalRenderStill;
247
248
  */
248
249
  const renderStill = (options) => {
249
250
  var _a, _b;
250
- const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, } = options;
251
+ const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, offthreadVideoCacheSizeInBytes, } = options;
251
252
  if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
252
253
  throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
253
254
  }
@@ -285,6 +286,7 @@ const renderStill = (options) => {
285
286
  staticBase: null,
286
287
  data: (_b = composition.props) !== null && _b !== void 0 ? _b : {},
287
288
  }).serializedString,
289
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
288
290
  });
289
291
  };
290
292
  exports.renderStill = renderStill;