@remotion/renderer 4.0.21 → 4.0.22

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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2020 Google Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export type Product = 'chrome' | 'firefox';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2020 Google Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2020 Google Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Product } from './Product';
17
+ export declare function downloadBrowser(product: Product): Promise<void>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2020 Google Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.downloadBrowser = void 0;
19
+ const BrowserFetcher_1 = require("./BrowserFetcher");
20
+ const revisions_1 = require("./revisions");
21
+ const supportedProducts = {
22
+ chrome: 'Chromium',
23
+ firefox: 'Firefox Nightly',
24
+ };
25
+ function getRevision(product) {
26
+ if (product === 'chrome') {
27
+ return revisions_1.PUPPETEER_REVISIONS.chromium;
28
+ }
29
+ throw new Error(`Unsupported product ${product}`);
30
+ }
31
+ async function downloadBrowser(product) {
32
+ const revision = getRevision(product);
33
+ const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(revision, product);
34
+ await (0, BrowserFetcher_1.download)({
35
+ revision: revisionInfo.revision,
36
+ progressCallback: (downloadedBytes, totalBytes) => {
37
+ console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
38
+ },
39
+ product,
40
+ platform: (0, BrowserFetcher_1.getPlatform)(product),
41
+ downloadHost: (0, BrowserFetcher_1.getDownloadHost)(product),
42
+ downloadsFolder: (0, BrowserFetcher_1.getDownloadsFolder)(product),
43
+ });
44
+ const _localRevisions = await (0, BrowserFetcher_1.localRevisions)((0, BrowserFetcher_1.getDownloadsFolder)(product), product, (0, BrowserFetcher_1.getPlatform)(product));
45
+ console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
46
+ await Promise.all(_localRevisions
47
+ .filter((__revision) => {
48
+ return __revision !== revisionInfo.revision;
49
+ })
50
+ .map((__revision) => {
51
+ return (0, BrowserFetcher_1.removeBrowser)(__revision, (0, BrowserFetcher_1.getFolderPath)(revision, (0, BrowserFetcher_1.getDownloadsFolder)(product), (0, BrowserFetcher_1.getPlatform)(product)));
52
+ }));
53
+ }
54
+ exports.downloadBrowser = downloadBrowser;
55
+ function toMegabytes(bytes) {
56
+ const mb = bytes / 1024 / 1024;
57
+ return `${Math.round(mb * 10) / 10} Mb`;
58
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2020 Google Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ type Revisions = Readonly<{
17
+ readonly chromium: string;
18
+ }>;
19
+ export declare const PUPPETEER_REVISIONS: Revisions;
20
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2020 Google Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PUPPETEER_REVISIONS = void 0;
19
+ exports.PUPPETEER_REVISIONS = {
20
+ chromium: '1002410',
21
+ };
package/dist/client.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const BrowserSafeApis: {
6
6
  getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
7
7
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
8
8
  proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
9
+ x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
9
10
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
10
11
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
11
12
  supportedAudioCodecs: {
package/dist/client.js CHANGED
@@ -19,6 +19,7 @@ const video_codec_1 = require("./options/video-codec");
19
19
  const pixel_format_1 = require("./pixel-format");
20
20
  const prores_profile_1 = require("./prores-profile");
21
21
  const validate_output_filename_1 = require("./validate-output-filename");
22
+ const x264_preset_1 = require("./x264-preset");
22
23
  exports.BrowserSafeApis = {
23
24
  getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
24
25
  validCodecs: codec_1.validCodecs,
@@ -27,6 +28,7 @@ exports.BrowserSafeApis = {
27
28
  getValidCrfRanges: crf_1.getValidCrfRanges,
28
29
  isAudioCodec: is_audio_codec_1.isAudioCodec,
29
30
  proResProfileOptions: prores_profile_1.proResProfileOptions,
31
+ x264PresetOptions: x264_preset_1.x264PresetOptions,
30
32
  validPixelFormats: pixel_format_1.validPixelFormats,
31
33
  DEFAULT_PIXEL_FORMAT: pixel_format_1.DEFAULT_PIXEL_FORMAT,
32
34
  supportedAudioCodecs: audio_codec_1.supportedAudioCodecs,
@@ -3,6 +3,6 @@ import type { LogLevel } from './log-level';
3
3
  export declare const getSilentParts: ({ src, noiseThresholdInDecibels: passedNoiseThresholdInDecibels, minDurationInSeconds: passedMinDuration, logLevel, }: {
4
4
  src: string;
5
5
  minDurationInSeconds?: number | undefined;
6
- logLevel?: "error" | "verbose" | "info" | "warn" | undefined;
6
+ logLevel?: "verbose" | "info" | "warn" | "error" | undefined;
7
7
  noiseThresholdInDecibels?: number | undefined;
8
8
  }) => Promise<GetSilentPartsResponse>;
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { SymbolicatedStackFrame } from './symbolicate-stacktrace';
37
37
  export { OnStartData, RenderFramesOutput } from './types';
38
38
  export { OpenGlRenderer } from './validate-opengl-renderer';
39
39
  export { validateOutputFilename } from './validate-output-filename';
40
+ export { X264Preset } from './x264-preset';
40
41
  export declare const RenderInternals: {
41
42
  ensureLocalBrowser: (preferredBrowserExecutable: import("./browser-executable").BrowserExecutable) => Promise<void>;
42
43
  getActualConcurrency: (userPreference: string | number | null) => number;
@@ -45,7 +46,7 @@ export declare const RenderInternals: {
45
46
  downloadMap: import("./assets/download-map").DownloadMap;
46
47
  remotionRoot: string;
47
48
  concurrency: number;
48
- logLevel: "error" | "verbose" | "info" | "warn";
49
+ logLevel: "verbose" | "info" | "warn" | "error";
49
50
  indent: boolean;
50
51
  }) => Promise<{
51
52
  port: number;
@@ -124,7 +125,7 @@ export declare const RenderInternals: {
124
125
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
125
126
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
126
127
  logLevels: readonly ["verbose", "info", "warn", "error"];
127
- isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
128
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
128
129
  isValidLogLevel: (level: string) => boolean;
129
130
  perf: typeof perf;
130
131
  convertToPositiveFrameIndex: ({ frame, durationInFrames, }: {
@@ -361,30 +362,30 @@ export declare const RenderInternals: {
361
362
  verbose: (message?: any, ...optionalParams: any[]) => void;
362
363
  verboseAdvanced: (options: {
363
364
  indent: boolean;
364
- logLevel: "error" | "verbose" | "info" | "warn";
365
+ logLevel: "verbose" | "info" | "warn" | "error";
365
366
  } & {
366
367
  tag?: string | undefined;
367
368
  }, message?: any, ...optionalParams: any[]) => void;
368
369
  info: (message?: any, ...optionalParams: any[]) => void;
369
370
  infoAdvanced: (options: {
370
371
  indent: boolean;
371
- logLevel: "error" | "verbose" | "info" | "warn";
372
+ logLevel: "verbose" | "info" | "warn" | "error";
372
373
  }, message?: any, ...optionalParams: any[]) => void;
373
374
  warn: (message?: any, ...optionalParams: any[]) => void;
374
375
  warnAdvanced: (options: {
375
376
  indent: boolean;
376
- logLevel: "error" | "verbose" | "info" | "warn";
377
+ logLevel: "verbose" | "info" | "warn" | "error";
377
378
  }, message?: any, ...optionalParams: any[]) => void;
378
379
  error: (message?: any, ...optionalParams: any[]) => void;
379
380
  errorAdvanced: (options: {
380
381
  indent: boolean;
381
- logLevel: "error" | "verbose" | "info" | "warn";
382
+ logLevel: "verbose" | "info" | "warn" | "error";
382
383
  } & {
383
384
  tag?: string | undefined;
384
385
  }, message?: any, ...optionalParams: any[]) => void;
385
386
  };
386
- getLogLevel: () => "error" | "verbose" | "info" | "warn";
387
- setLogLevel: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
387
+ getLogLevel: () => "verbose" | "info" | "warn" | "error";
388
+ setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
388
389
  INDENT_TOKEN: string;
389
390
  isColorSupported: () => boolean;
390
391
  HeadlessBrowser: typeof HeadlessBrowser;
@@ -393,7 +394,7 @@ export declare const RenderInternals: {
393
394
  port: number | null;
394
395
  remotionRoot: string;
395
396
  concurrency: number;
396
- logLevel: "error" | "verbose" | "info" | "warn";
397
+ logLevel: "verbose" | "info" | "warn" | "error";
397
398
  indent: boolean;
398
399
  }) => Promise<import("./prepare-server").RemotionServer>;
399
400
  makeOrReuseServer: (server: import("./prepare-server").RemotionServer | undefined, config: {
@@ -401,7 +402,7 @@ export declare const RenderInternals: {
401
402
  port: number | null;
402
403
  remotionRoot: string;
403
404
  concurrency: number;
404
- logLevel: "error" | "verbose" | "info" | "warn";
405
+ logLevel: "verbose" | "info" | "warn" | "error";
405
406
  indent: boolean;
406
407
  }, { onDownload, onError, }: {
407
408
  onError: (err: Error) => void;
@@ -430,7 +431,7 @@ export declare const RenderInternals: {
430
431
  cancelSignal: import("./make-cancel-signal").CancelSignal | null;
431
432
  indent: boolean;
432
433
  server: import("./prepare-server").RemotionServer | undefined;
433
- logLevel: "error" | "verbose" | "info" | "warn";
434
+ logLevel: "verbose" | "info" | "warn" | "error";
434
435
  serveUrl: string;
435
436
  port: number | null;
436
437
  }) => Promise<{
@@ -443,7 +444,7 @@ export declare const RenderInternals: {
443
444
  viewport: import("./browser/PuppeteerViewport").Viewport | null;
444
445
  indent: boolean;
445
446
  browser: "chrome";
446
- logLevel: "error" | "verbose" | "info" | "warn";
447
+ logLevel: "verbose" | "info" | "warn" | "error";
447
448
  }) => Promise<HeadlessBrowser>;
448
449
  internalSelectComposition: (options: {
449
450
  serializedInputPropsWithCustomSchema: string;
@@ -456,7 +457,7 @@ export declare const RenderInternals: {
456
457
  port: number | null;
457
458
  indent: boolean;
458
459
  server: import("./prepare-server").RemotionServer | undefined;
459
- logLevel: "error" | "verbose" | "info" | "warn";
460
+ logLevel: "verbose" | "info" | "warn" | "error";
460
461
  serveUrl: string;
461
462
  id: string;
462
463
  }) => Promise<{
@@ -474,14 +475,14 @@ export declare const RenderInternals: {
474
475
  port: number | null;
475
476
  server: import("./prepare-server").RemotionServer | undefined;
476
477
  indent: boolean;
477
- logLevel: "error" | "verbose" | "info" | "warn";
478
+ logLevel: "verbose" | "info" | "warn" | "error";
478
479
  serveUrlOrWebpackUrl: string;
479
480
  }) => Promise<import("remotion").VideoConfig[]>;
480
481
  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, }: import("./render-frames").InternalRenderFramesOptions) => Promise<import("./types").RenderFramesOutput>;
481
- internalRenderMedia: ({ proResProfile, 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, }: import("./render-media").InternalRenderMediaOptions) => Promise<{
482
+ 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, }: import("./render-media").InternalRenderMediaOptions) => Promise<{
482
483
  buffer: Buffer | null;
483
484
  slowestFrames: import("./render-media").SlowFrame[];
484
485
  }>;
485
486
  validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader"];
486
- copyImageToClipboard: (src: string, logLevel: "error" | "verbose" | "info" | "warn") => Promise<void>;
487
+ copyImageToClipboard: (src: string, logLevel: "verbose" | "info" | "warn" | "error") => Promise<void>;
487
488
  };
package/dist/logger.d.ts CHANGED
@@ -19,6 +19,6 @@ export declare const Log: {
19
19
  error: (message?: any, ...optionalParams: any[]) => void;
20
20
  errorAdvanced: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
21
21
  };
22
- export declare const getLogLevel: () => "error" | "verbose" | "info" | "warn";
22
+ export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
23
23
  export declare const setLogLevel: (newLogLevel: LogLevel) => void;
24
24
  export {};
@@ -67,6 +67,9 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
67
67
  else {
68
68
  response.setHeader('content-type', `image/bmp`);
69
69
  }
70
+ // Prevent caching of the response and excessive disk writes
71
+ // https://github.com/remotion-dev/remotion/issues/2760
72
+ response.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
70
73
  // Handling this case on Lambda:
71
74
  // https://support.google.com/chrome/a/answer/7679408?hl=en
72
75
  // Chrome sends Private Network Access preflights for subresources
@@ -0,0 +1,7 @@
1
+ import type { Codec } from './codec';
2
+ export declare const presetsProfileOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
3
+ export type PresetsProfile = typeof presetsProfileOptions[number];
4
+ export declare const validateSelectedCodecAndPresetCombination: ({ codec, presetsProfile, }: {
5
+ codec: Codec;
6
+ presetsProfile: PresetsProfile | undefined;
7
+ }) => void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSelectedCodecAndPresetCombination = exports.presetsProfileOptions = void 0;
4
+ exports.presetsProfileOptions = [
5
+ 'ultrafast',
6
+ 'superfast',
7
+ 'veryfast',
8
+ 'faster',
9
+ 'fast',
10
+ 'medium',
11
+ 'slow',
12
+ 'slower',
13
+ 'veryslow',
14
+ 'placebo',
15
+ ];
16
+ const validateSelectedCodecAndPresetCombination = ({ codec, presetsProfile, }) => {
17
+ if (typeof presetsProfile !== 'undefined' && codec !== 'h264') {
18
+ throw new TypeError(`You have set a Preset profile but the codec is "${codec}". Set the codec to "h264" or remove the Preset profile.`);
19
+ }
20
+ if (presetsProfile !== undefined &&
21
+ !exports.presetsProfileOptions.includes(presetsProfile)) {
22
+ throw new TypeError(`The Preset profile "${presetsProfile}" is not valid. Valid options are ${exports.presetsProfileOptions
23
+ .map((p) => `"${p}"`)
24
+ .join(', ')}`);
25
+ }
26
+ };
27
+ exports.validateSelectedCodecAndPresetCombination = validateSelectedCodecAndPresetCombination;
@@ -16,6 +16,7 @@ import type { PixelFormat } from './pixel-format';
16
16
  import type { RemotionServer } from './prepare-server';
17
17
  import type { ProResProfile } from './prores-profile';
18
18
  import type { OnStartData } from './types';
19
+ import type { X264Preset } from './x264-preset';
19
20
  export type StitchingState = 'encoding' | 'muxing';
20
21
  export type SlowFrame = {
21
22
  frame: number;
@@ -48,6 +49,7 @@ export type InternalRenderMediaOptions = {
48
49
  onProgress: RenderMediaOnProgress;
49
50
  onDownload: RenderMediaOnDownload;
50
51
  proResProfile: ProResProfile | undefined;
52
+ x264Preset: X264Preset | undefined;
51
53
  onBrowserLog: ((log: BrowserLog) => void) | null;
52
54
  onStart: (data: OnStartData) => void;
53
55
  timeoutInMilliseconds: number;
@@ -93,6 +95,7 @@ export type RenderMediaOptions = {
93
95
  onProgress?: RenderMediaOnProgress;
94
96
  onDownload?: RenderMediaOnDownload;
95
97
  proResProfile?: ProResProfile;
98
+ x264Preset?: X264Preset;
96
99
  /**
97
100
  * @deprecated Use "logLevel": "verbose" instead
98
101
  */
@@ -125,11 +128,11 @@ type RenderMediaResult = {
125
128
  buffer: Buffer | null;
126
129
  slowestFrames: SlowFrame[];
127
130
  };
128
- export declare const internalRenderMedia: ({ proResProfile, 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>;
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>;
129
132
  /**
130
133
  *
131
134
  * @description Render a video from a composition
132
135
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
133
136
  */
134
- export declare const renderMedia: ({ proResProfile, 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>;
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>;
135
138
  export {};
@@ -42,8 +42,9 @@ const validate_number_of_gif_loops_1 = require("./validate-number-of-gif-loops")
42
42
  const validate_output_filename_1 = require("./validate-output-filename");
43
43
  const validate_scale_1 = require("./validate-scale");
44
44
  const validate_videobitrate_1 = require("./validate-videobitrate");
45
+ const x264_preset_1 = require("./x264-preset");
45
46
  const SLOWEST_FRAME_COUNT = 10;
46
- const internalRenderMedia = ({ proResProfile, 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, }) => {
47
48
  (0, jpeg_quality_1.validateJpegQuality)(jpegQuality);
48
49
  (0, crf_1.validateQualitySettings)({ crf, codec, videoBitrate });
49
50
  (0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
@@ -52,6 +53,10 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
52
53
  codec,
53
54
  proResProfile,
54
55
  });
56
+ (0, x264_preset_1.validateSelectedCodecAndPresetCombination)({
57
+ codec,
58
+ x264Preset,
59
+ });
55
60
  (0, pixel_format_1.validateSelectedPixelFormatAndCodecCombination)(pixelFormat, codec);
56
61
  if (outputLocation) {
57
62
  (0, validate_output_filename_1.validateOutputFilename)({
@@ -346,6 +351,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
346
351
  audioBitrate,
347
352
  videoBitrate,
348
353
  audioCodec,
354
+ x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
349
355
  }),
350
356
  stitchStart,
351
357
  ]);
@@ -411,13 +417,14 @@ exports.internalRenderMedia = internalRenderMedia;
411
417
  * @description Render a video from a composition
412
418
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
413
419
  */
414
- const renderMedia = ({ proResProfile, 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, }) => {
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, }) => {
415
421
  var _a, _b;
416
422
  if (quality !== undefined) {
417
423
  console.warn(`The "quality" option has been renamed. Please use "jpegQuality" instead.`);
418
424
  }
419
425
  return (0, exports.internalRenderMedia)({
420
426
  proResProfile: proResProfile !== null && proResProfile !== void 0 ? proResProfile : undefined,
427
+ x264Preset,
421
428
  codec,
422
429
  composition,
423
430
  serveUrl,
@@ -8,6 +8,7 @@ import type { LogLevel } from './log-level';
8
8
  import type { CancelSignal } from './make-cancel-signal';
9
9
  import type { PixelFormat } from './pixel-format';
10
10
  import type { ProResProfile } from './prores-profile';
11
+ import type { X264Preset } from './x264-preset';
11
12
  type InternalStitchFramesToVideoOptions = {
12
13
  audioBitrate: string | null;
13
14
  videoBitrate: string | null;
@@ -32,6 +33,7 @@ type InternalStitchFramesToVideoOptions = {
32
33
  preferLossless: boolean;
33
34
  indent: boolean;
34
35
  muted: boolean;
36
+ x264Preset: X264Preset | null;
35
37
  enforceAudioTrack: boolean;
36
38
  ffmpegOverride: null | FfmpegOverrideFn;
37
39
  };
@@ -58,11 +60,12 @@ export type StitchFramesToVideoOptions = {
58
60
  muted?: boolean;
59
61
  enforceAudioTrack?: boolean;
60
62
  ffmpegOverride?: FfmpegOverrideFn;
63
+ x264Preset?: X264Preset | null;
61
64
  };
62
65
  export declare const internalStitchFramesToVideo: (options: InternalStitchFramesToVideoOptions) => Promise<Buffer | null>;
63
66
  /**
64
67
  * @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
65
68
  * @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
66
69
  */
67
- export declare const stitchFramesToVideo: ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, }: StitchFramesToVideoOptions) => Promise<Buffer | null>;
70
+ export declare const stitchFramesToVideo: ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, x264Preset, }: StitchFramesToVideoOptions) => Promise<Buffer | null>;
68
71
  export {};
@@ -100,7 +100,7 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, logLevel
100
100
  });
101
101
  return outName;
102
102
  };
103
- const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, force, fps, height, indent, muted, onDownload, outputLocation, pixelFormat, preEncodedFileLocation, preferLossless, proResProfile, logLevel, videoBitrate, width, numberOfGifLoops, onProgress, }, remotionRoot) => {
103
+ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, force, fps, height, indent, muted, onDownload, outputLocation, pixelFormat, preEncodedFileLocation, preferLossless, proResProfile, logLevel, videoBitrate, width, numberOfGifLoops, onProgress, x264Preset, }, remotionRoot) => {
104
104
  var _a;
105
105
  remotion_1.Internals.validateDimension(height, 'height', 'passed to `stitchFramesToVideo()`');
106
106
  remotion_1.Internals.validateDimension(width, 'width', 'passed to `stitchFramesToVideo()`');
@@ -256,6 +256,7 @@ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec,
256
256
  codec,
257
257
  }),
258
258
  ]),
259
+ x264Preset ? ['-preset', x264Preset] : null,
259
260
  codec === 'h264' ? ['-movflags', 'faststart'] : null,
260
261
  resolvedAudioCodec
261
262
  ? ['-c:a', (0, audio_codec_1.mapAudioCodecToFfmpegAudioCodecName)(resolvedAudioCodec)]
@@ -359,7 +360,7 @@ exports.internalStitchFramesToVideo = internalStitchFramesToVideo;
359
360
  * @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
360
361
  * @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
361
362
  */
362
- const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, }) => {
363
+ const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, dir, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, x264Preset, }) => {
363
364
  return (0, exports.internalStitchFramesToVideo)({
364
365
  assetsInfo,
365
366
  audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
@@ -386,6 +387,7 @@ const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitra
386
387
  width,
387
388
  preEncodedFileLocation: null,
388
389
  preferLossless: false,
390
+ x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
389
391
  });
390
392
  };
391
393
  exports.stitchFramesToVideo = stitchFramesToVideo;
@@ -0,0 +1,7 @@
1
+ import type { Codec } from './codec';
2
+ export declare const x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
3
+ export type X264Preset = typeof x264PresetOptions[number];
4
+ export declare const validateSelectedCodecAndPresetCombination: ({ codec, x264Preset, }: {
5
+ codec: Codec;
6
+ x264Preset: X264Preset | undefined;
7
+ }) => void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSelectedCodecAndPresetCombination = exports.x264PresetOptions = void 0;
4
+ exports.x264PresetOptions = [
5
+ 'ultrafast',
6
+ 'superfast',
7
+ 'veryfast',
8
+ 'faster',
9
+ 'fast',
10
+ 'medium',
11
+ 'slow',
12
+ 'slower',
13
+ 'veryslow',
14
+ 'placebo',
15
+ ];
16
+ const validateSelectedCodecAndPresetCombination = ({ codec, x264Preset, }) => {
17
+ if (typeof x264Preset !== 'undefined' &&
18
+ codec !== 'h264' &&
19
+ codec !== 'h264-mkv') {
20
+ throw new TypeError(`You have set a x264 preset but the codec is "${codec}". Set the codec to "h264" or remove the Preset profile.`);
21
+ }
22
+ if (x264Preset !== undefined &&
23
+ !exports.x264PresetOptions.includes(x264Preset)) {
24
+ throw new TypeError(`The Preset profile "${x264Preset}" is not valid. Valid options are ${exports.x264PresetOptions
25
+ .map((p) => `"${p}"`)
26
+ .join(', ')}`);
27
+ }
28
+ };
29
+ exports.validateSelectedCodecAndPresetCombination = validateSelectedCodecAndPresetCombination;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.21",
3
+ "version": "4.0.22",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "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.7.0",
21
- "remotion": "4.0.21"
21
+ "remotion": "4.0.22"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -41,13 +41,13 @@
41
41
  "zod": "^3.21.4"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@remotion/compositor-darwin-arm64": "4.0.21",
45
- "@remotion/compositor-darwin-x64": "4.0.21",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.21",
47
- "@remotion/compositor-linux-arm64-musl": "4.0.21",
48
- "@remotion/compositor-win32-x64-msvc": "4.0.21",
49
- "@remotion/compositor-linux-x64-gnu": "4.0.21",
50
- "@remotion/compositor-linux-x64-musl": "4.0.21"
44
+ "@remotion/compositor-darwin-x64": "4.0.22",
45
+ "@remotion/compositor-linux-arm64-gnu": "4.0.22",
46
+ "@remotion/compositor-darwin-arm64": "4.0.22",
47
+ "@remotion/compositor-linux-arm64-musl": "4.0.22",
48
+ "@remotion/compositor-linux-x64-gnu": "4.0.22",
49
+ "@remotion/compositor-linux-x64-musl": "4.0.22",
50
+ "@remotion/compositor-win32-x64-msvc": "4.0.22"
51
51
  },
52
52
  "keywords": [
53
53
  "remotion",