@remotion/renderer 4.0.128 → 4.0.130

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.
@@ -96,6 +96,7 @@ const downloadFile = async (options, retries = 2, attempt = 1) => {
96
96
  catch (err) {
97
97
  const { message } = err;
98
98
  if (message === 'aborted' ||
99
+ message === 'ECONNRESET' ||
99
100
  message.includes(incorrectContentLengthToken) ||
100
101
  // Try again if hitting internal errors
101
102
  message.includes('503') ||
@@ -4,19 +4,10 @@ exports.calculateFfmpegFilter = void 0;
4
4
  const flatten_volume_array_1 = require("./assets/flatten-volume-array");
5
5
  const stringify_ffmpeg_filter_1 = require("./stringify-ffmpeg-filter");
6
6
  const calculateFfmpegFilter = ({ asset, fps, channels, assetDuration, trimLeftOffset, trimRightOffset, chunkLengthInSeconds, forSeamlessAacConcatenation, }) => {
7
- if (channels === 0) {
8
- return null;
9
- }
10
- const trimLeft = (asset.trimLeft * asset.playbackRate) / fps +
11
- trimLeftOffset * asset.playbackRate;
12
- const trimRight = trimLeft +
13
- (asset.duration * asset.playbackRate) / fps +
14
- trimRightOffset * asset.playbackRate;
7
+ // TODO: Don't need this wrapper function anymore
15
8
  return (0, stringify_ffmpeg_filter_1.stringifyFfmpegFilter)({
16
9
  channels,
17
10
  startInVideo: asset.startInVideo,
18
- trimLeft,
19
- trimRight,
20
11
  volume: (0, flatten_volume_array_1.flattenVolumeArray)(asset.volume),
21
12
  fps,
22
13
  playbackRate: asset.playbackRate,
@@ -25,6 +16,9 @@ const calculateFfmpegFilter = ({ asset, fps, channels, assetDuration, trimLeftOf
25
16
  toneFrequency: asset.toneFrequency,
26
17
  chunkLengthInSeconds,
27
18
  forSeamlessAacConcatenation,
19
+ trimLeftOffset,
20
+ trimRightOffset,
21
+ asset,
28
22
  });
29
23
  };
30
24
  exports.calculateFfmpegFilter = calculateFfmpegFilter;
package/dist/index.d.ts CHANGED
@@ -354,7 +354,7 @@ export declare const RenderInternals: {
354
354
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
355
355
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
356
356
  DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
357
- DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
357
+ DEFAULT_VIDEO_IMAGE_FORMAT: "none" | "png" | "jpeg";
358
358
  DEFAULT_JPEG_QUALITY: number;
359
359
  chalk: {
360
360
  enabled: () => boolean;
@@ -155,7 +155,6 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
155
155
  if (err.message !== REQUEST_CLOSED_TOKEN &&
156
156
  !err.message.includes('EPIPE')) {
157
157
  downloadMap.emitter.dispatchError(err);
158
- console.log('Error occurred', err);
159
158
  }
160
159
  });
161
160
  },
@@ -43,7 +43,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
43
43
  ['-ar', String(sample_rate_1.DEFAULT_SAMPLE_RATE)],
44
44
  ['-y', outName],
45
45
  ].flat(2);
46
- logger_1.Log.verbose({ indent, logLevel }, 'Preprocessing audio track', args, 'Filter:', filter.filter);
46
+ logger_1.Log.verbose({ indent, logLevel }, 'Preprocessing audio track:', JSON.stringify(args.join(' ')), 'Filter:', filter.filter);
47
47
  const startTime = Date.now();
48
48
  const task = (0, call_ffmpeg_1.callFf)({
49
49
  bin: 'ffmpeg',
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
2
3
  import type { RenderAssetInfo } from './assets/download-map';
3
4
  import type { Codec } from './codec';
@@ -1,4 +1,4 @@
1
- import type { AssetVolume } from './assets/types';
1
+ import type { AssetVolume, MediaAsset } from './assets/types';
2
2
  export type FilterWithoutPaddingApplied = ProcessedTrack & {
3
3
  filter: string;
4
4
  };
@@ -6,9 +6,7 @@ export type ProcessedTrack = {
6
6
  pad_start: string | null;
7
7
  pad_end: string | null;
8
8
  };
9
- export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, assetDuration, allowAmplificationDuringRender, toneFrequency, chunkLengthInSeconds, forSeamlessAacConcatenation, }: {
10
- trimLeft: number;
11
- trimRight: number;
9
+ export declare const stringifyFfmpegFilter: ({ channels, startInVideo, volume, fps, playbackRate, assetDuration, allowAmplificationDuringRender, toneFrequency, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }: {
12
10
  channels: number;
13
11
  startInVideo: number;
14
12
  volume: AssetVolume;
@@ -19,4 +17,7 @@ export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, st
19
17
  toneFrequency: number | null;
20
18
  chunkLengthInSeconds: number;
21
19
  forSeamlessAacConcatenation: boolean;
20
+ trimLeftOffset: number;
21
+ trimRightOffset: number;
22
+ asset: MediaAsset;
22
23
  }) => FilterWithoutPaddingApplied | null;
@@ -14,15 +14,20 @@ const stringifyTrim = (trim) => {
14
14
  }
15
15
  return asString;
16
16
  };
17
- const trimAndSetTempo = ({ playbackRate, trimLeft, trimRight, forSeamlessAacConcatenation, assetDuration, }) => {
18
- const trimRightOrAssetDuration = assetDuration
19
- ? Math.min(trimRight, assetDuration)
20
- : trimRight;
17
+ const trimAndSetTempo = ({ playbackRate, forSeamlessAacConcatenation, assetDuration, asset, trimLeftOffset, trimRightOffset, fps, }) => {
21
18
  // If we need seamless AAC stitching, we need to apply the tempo filter first
22
19
  // because the atempo filter is not frame-perfect. It creates a small offset
23
20
  // and the offset needs to be the same for all audio tracks, before processing it further.
24
21
  // This also affects the trimLeft and trimRight values, as they need to be adjusted.
25
22
  if (forSeamlessAacConcatenation) {
23
+ const trimLeft = (asset.trimLeft * asset.playbackRate) / fps +
24
+ trimLeftOffset * asset.playbackRate;
25
+ const trimRight = trimLeft +
26
+ (asset.duration * asset.playbackRate) / fps +
27
+ trimRightOffset * asset.playbackRate;
28
+ const trimRightOrAssetDuration = assetDuration
29
+ ? Math.min(trimRight, assetDuration * asset.playbackRate)
30
+ : trimRight;
26
31
  const actualTrimLeft = trimLeft / playbackRate;
27
32
  const actualTrimRight = trimRightOrAssetDuration / playbackRate;
28
33
  return {
@@ -37,6 +42,11 @@ const trimAndSetTempo = ({ playbackRate, trimLeft, trimRight, forSeamlessAacConc
37
42
  // Otherwise, we first trim and then apply playback rate, as then the atempo
38
43
  // filter needs to do less work.
39
44
  if (!forSeamlessAacConcatenation) {
45
+ const trimLeft = asset.trimLeft / fps + trimLeftOffset * asset.playbackRate;
46
+ const trimRight = trimLeft + asset.duration / fps + trimRightOffset * asset.playbackRate;
47
+ const trimRightOrAssetDuration = assetDuration
48
+ ? Math.min(trimRight, assetDuration)
49
+ : trimRight;
40
50
  return {
41
51
  filter: [
42
52
  `atrim=${stringifyTrim(trimLeft)}:${stringifyTrim(trimRightOrAssetDuration)}`,
@@ -48,9 +58,12 @@ const trimAndSetTempo = ({ playbackRate, trimLeft, trimRight, forSeamlessAacConc
48
58
  }
49
59
  throw new Error('This should never happen');
50
60
  };
51
- const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, assetDuration, allowAmplificationDuringRender, toneFrequency, chunkLengthInSeconds, forSeamlessAacConcatenation, }) => {
61
+ const stringifyFfmpegFilter = ({ channels, startInVideo, volume, fps, playbackRate, assetDuration, allowAmplificationDuringRender, toneFrequency, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }) => {
62
+ if (channels === 0) {
63
+ return null;
64
+ }
52
65
  const startInVideoSeconds = startInVideo / fps;
53
- if (assetDuration && trimLeft >= assetDuration) {
66
+ if (assetDuration && asset.trimLeft / fps >= assetDuration) {
54
67
  return null;
55
68
  }
56
69
  if (toneFrequency !== null && (toneFrequency <= 0 || toneFrequency > 2)) {
@@ -60,8 +73,10 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
60
73
  playbackRate,
61
74
  forSeamlessAacConcatenation,
62
75
  assetDuration,
63
- trimLeft,
64
- trimRight,
76
+ trimLeftOffset,
77
+ trimRightOffset,
78
+ asset,
79
+ fps,
65
80
  });
66
81
  const volumeFilter = (0, ffmpeg_volume_expression_1.ffmpegVolumeExpression)({
67
82
  volume,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.128",
3
+ "version": "4.0.130",
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.128"
21
+ "remotion": "4.0.130"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -40,13 +40,13 @@
40
40
  "vitest": "0.31.1"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@remotion/compositor-darwin-x64": "4.0.128",
44
- "@remotion/compositor-darwin-arm64": "4.0.128",
45
- "@remotion/compositor-linux-arm64-gnu": "4.0.128",
46
- "@remotion/compositor-linux-x64-gnu": "4.0.128",
47
- "@remotion/compositor-linux-arm64-musl": "4.0.128",
48
- "@remotion/compositor-linux-x64-musl": "4.0.128",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.128"
43
+ "@remotion/compositor-linux-arm64-gnu": "4.0.130",
44
+ "@remotion/compositor-darwin-arm64": "4.0.130",
45
+ "@remotion/compositor-linux-x64-gnu": "4.0.130",
46
+ "@remotion/compositor-linux-arm64-musl": "4.0.130",
47
+ "@remotion/compositor-linux-x64-musl": "4.0.130",
48
+ "@remotion/compositor-win32-x64-msvc": "4.0.130",
49
+ "@remotion/compositor-darwin-x64": "4.0.130"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",
@@ -1,28 +0,0 @@
1
- import type { Codec } from './codec';
2
- export declare const validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
3
- export type AudioCodec = (typeof validAudioCodecs)[number];
4
- export declare const supportedAudioCodecs: {
5
- readonly h264: readonly ["aac", "pcm-16", "mp3"];
6
- readonly 'h264-mkv': readonly ["pcm-16", "mp3"];
7
- readonly aac: readonly ["aac", "pcm-16"];
8
- readonly gif: readonly [];
9
- readonly h265: readonly ["aac", "pcm-16"];
10
- readonly mp3: readonly ["mp3", "pcm-16"];
11
- readonly prores: readonly ["aac", "pcm-16"];
12
- readonly vp8: readonly ["opus", "pcm-16"];
13
- readonly vp9: readonly ["opus", "pcm-16"];
14
- readonly wav: readonly ["pcm-16"];
15
- };
16
- declare const audioCodecNames: readonly ["pcm_s16le", "libfdk_aac", "libmp3lame", "libopus"];
17
- type FfmpegAudioCodecName = (typeof audioCodecNames)[number];
18
- export declare const mapAudioCodecToFfmpegAudioCodecName: (audioCodec: AudioCodec) => FfmpegAudioCodecName;
19
- export declare const defaultAudioCodecs: {
20
- [key in Codec]: {
21
- [k in 'compressed' | 'lossless']: (typeof supportedAudioCodecs)[key][number] | null;
22
- };
23
- };
24
- export declare const getDefaultAudioCodec: ({ codec, preferLossless, }: {
25
- codec: Codec;
26
- preferLossless: boolean;
27
- }) => AudioCodec | null;
28
- export {};
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultAudioCodec = exports.defaultAudioCodecs = exports.mapAudioCodecToFfmpegAudioCodecName = exports.supportedAudioCodecs = exports.validAudioCodecs = void 0;
4
- exports.validAudioCodecs = ['pcm-16', 'aac', 'mp3', 'opus'];
5
- exports.supportedAudioCodecs = {
6
- h264: ['aac', 'pcm-16', 'mp3'],
7
- 'h264-mkv': ['pcm-16', 'mp3'],
8
- aac: ['aac', 'pcm-16'],
9
- gif: [],
10
- h265: ['aac', 'pcm-16'],
11
- mp3: ['mp3', 'pcm-16'],
12
- prores: ['aac', 'pcm-16'],
13
- vp8: ['opus', 'pcm-16'],
14
- vp9: ['opus', 'pcm-16'],
15
- wav: ['pcm-16'],
16
- };
17
- const _satisfies = exports.supportedAudioCodecs;
18
- if (_satisfies) {
19
- // Just for type checking
20
- }
21
- const audioCodecNames = [
22
- 'pcm_s16le',
23
- 'libfdk_aac',
24
- 'libmp3lame',
25
- 'libopus',
26
- ];
27
- const mapAudioCodecToFfmpegAudioCodecName = (audioCodec) => {
28
- if (audioCodec === 'aac') {
29
- return 'libfdk_aac';
30
- }
31
- if (audioCodec === 'mp3') {
32
- return 'libmp3lame';
33
- }
34
- if (audioCodec === 'opus') {
35
- return 'libopus';
36
- }
37
- if (audioCodec === 'pcm-16') {
38
- return 'pcm_s16le';
39
- }
40
- throw new Error('unknown audio codec: ' + audioCodec);
41
- };
42
- exports.mapAudioCodecToFfmpegAudioCodecName = mapAudioCodecToFfmpegAudioCodecName;
43
- exports.defaultAudioCodecs = {
44
- 'h264-mkv': {
45
- lossless: 'pcm-16',
46
- compressed: 'pcm-16',
47
- },
48
- aac: {
49
- lossless: 'pcm-16',
50
- compressed: 'aac',
51
- },
52
- gif: {
53
- lossless: null,
54
- compressed: null,
55
- },
56
- h264: {
57
- lossless: 'pcm-16',
58
- compressed: 'aac',
59
- },
60
- h265: {
61
- lossless: 'pcm-16',
62
- compressed: 'aac',
63
- },
64
- mp3: {
65
- lossless: 'pcm-16',
66
- compressed: 'mp3',
67
- },
68
- prores: {
69
- lossless: 'pcm-16',
70
- compressed: 'pcm-16',
71
- },
72
- vp8: {
73
- lossless: 'pcm-16',
74
- compressed: 'opus',
75
- },
76
- vp9: {
77
- lossless: 'pcm-16',
78
- compressed: 'opus',
79
- },
80
- wav: {
81
- lossless: 'pcm-16',
82
- compressed: 'pcm-16',
83
- },
84
- };
85
- const getDefaultAudioCodec = ({ codec, preferLossless, }) => {
86
- return exports.defaultAudioCodecs[codec][preferLossless ? 'lossless' : 'compressed'];
87
- };
88
- exports.getDefaultAudioCodec = getDefaultAudioCodec;
@@ -1 +0,0 @@
1
- export declare const checkNodeVersionAndWarnAboutRosetta: () => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkNodeVersionAndWarnAboutRosetta = void 0;
4
- const checkNodeVersionAndWarnAboutRosetta = () => {
5
- const version = process.version.replace('v', '').split('.');
6
- const majorVersion = Number(version[0]);
7
- const requiredNodeVersion = 16;
8
- if (majorVersion < 16) {
9
- throw new Error(`Remotion requires at least Node ${requiredNodeVersion}. You currently have ${process.version}. Update your node version to ${requiredNodeVersion} to use Remotion.`);
10
- }
11
- };
12
- exports.checkNodeVersionAndWarnAboutRosetta = checkNodeVersionAndWarnAboutRosetta;
@@ -1,18 +0,0 @@
1
- import type { Codec } from './codec';
2
- import type { LogLevel } from './log-level';
3
- import type { CancelSignal } from './make-cancel-signal';
4
- export declare const createCombinedVideo: ({ addRemotionMetadata, binariesDirectory, cancelSignal, codec, filelistDir, files, fps, indent, logLevel, numberOfGifLoops, onProgress, output, seamless, }: {
5
- fps: number;
6
- codec: Codec;
7
- filelistDir: string;
8
- numberOfGifLoops: number | null;
9
- output: string;
10
- indent: boolean;
11
- logLevel: LogLevel;
12
- onProgress: (p: number) => void;
13
- files: string[];
14
- addRemotionMetadata: boolean;
15
- binariesDirectory: string | null;
16
- cancelSignal: CancelSignal | undefined;
17
- seamless: boolean;
18
- }) => Promise<string | undefined>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCombinedVideo = void 0;
4
- const combine_video_streams_1 = require("./combine-video-streams");
5
- const combine_video_streams_seamlessly_1 = require("./combine-video-streams-seamlessly");
6
- const createCombinedVideo = async ({ addRemotionMetadata, binariesDirectory, cancelSignal, codec, filelistDir, files, fps, indent, logLevel, numberOfGifLoops, onProgress, output, seamless, }) => {
7
- if (seamless) {
8
- return (0, combine_video_streams_seamlessly_1.combineVideoStreamsSeamlessly)({
9
- files,
10
- });
11
- }
12
- await (0, combine_video_streams_1.combineVideoStreams)({
13
- addRemotionMetadata,
14
- binariesDirectory,
15
- cancelSignal,
16
- codec,
17
- filelistDir,
18
- files,
19
- fps,
20
- indent,
21
- logLevel,
22
- numberOfGifLoops,
23
- onProgress,
24
- output,
25
- });
26
- };
27
- exports.createCombinedVideo = createCombinedVideo;
@@ -1,3 +0,0 @@
1
- import type { Codec } from './codec';
2
- import type { PixelFormat } from './pixel-format';
3
- export declare const warnAboutM2Bug: (codec: Codec | null, pixelFormat: PixelFormat | null) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warnAboutM2Bug = void 0;
4
- const node_os_1 = require("node:os");
5
- const warnAboutM2Bug = (codec, pixelFormat) => {
6
- const isM2 = (0, node_os_1.cpus)().find((c) => c.model.includes('Apple M2'));
7
- if (codec === 'prores' && pixelFormat === 'yuv422p10le' && isM2) {
8
- console.warn();
9
- console.warn('⚠️ Known issue: Apple M2 CPUs currently suffer from a bug where transparent ProRes videos have flickering. https://github.com/remotion-dev/remotion/issues/1929');
10
- }
11
- };
12
- exports.warnAboutM2Bug = warnAboutM2Bug;
@@ -1,2 +0,0 @@
1
- import type { AudioCodec } from './audio-codec';
2
- export declare const getExtensionFromAudioCodec: (audioCodec: AudioCodec) => "mp3" | "aac" | "wav" | "opus";
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExtensionFromAudioCodec = void 0;
4
- const getExtensionFromAudioCodec = (audioCodec) => {
5
- if (audioCodec === 'aac') {
6
- return 'aac';
7
- }
8
- if (audioCodec === 'opus') {
9
- return 'opus';
10
- }
11
- if (audioCodec === 'mp3') {
12
- return 'mp3';
13
- }
14
- if (audioCodec === 'pcm-16') {
15
- return 'wav';
16
- }
17
- throw new Error(`Unsupported audio codec: ${audioCodec}`);
18
- };
19
- exports.getExtensionFromAudioCodec = getExtensionFromAudioCodec;
@@ -1,2 +0,0 @@
1
- import type { Codec } from './codec';
2
- export declare const isAudioCodec: (codec: Codec | undefined | null) => boolean;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAudioCodec = void 0;
4
- const isAudioCodec = (codec) => {
5
- return codec === 'mp3' || codec === 'aac' || codec === 'wav';
6
- };
7
- exports.isAudioCodec = isAudioCodec;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,22 +0,0 @@
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;
8
- export declare const x264Option: {
9
- name: string;
10
- cliFlag: "x264-preset";
11
- description: () => import("react/jsx-runtime").JSX.Element;
12
- ssrName: "x264Preset";
13
- docLink: string;
14
- type: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo";
15
- getValue: ({ commandLine }: {
16
- commandLine: Record<string, unknown>;
17
- }) => {
18
- value: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo";
19
- source: string;
20
- };
21
- setConfig: (profile: X264Preset | undefined) => void;
22
- };
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.x264Option = exports.validateSelectedCodecAndPresetCombination = exports.x264PresetOptions = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- exports.x264PresetOptions = [
6
- 'ultrafast',
7
- 'superfast',
8
- 'veryfast',
9
- 'faster',
10
- 'fast',
11
- 'medium',
12
- 'slow',
13
- 'slower',
14
- 'veryslow',
15
- 'placebo',
16
- ];
17
- let preset;
18
- const validateSelectedCodecAndPresetCombination = ({ codec, x264Preset, }) => {
19
- if (typeof x264Preset !== 'undefined' &&
20
- codec !== 'h264' &&
21
- codec !== 'h264-mkv') {
22
- throw new TypeError(`You have set a x264 preset but the codec is "${codec}". Set the codec to "h264" or remove the Preset profile.`);
23
- }
24
- if (x264Preset !== undefined &&
25
- !exports.x264PresetOptions.includes(x264Preset)) {
26
- throw new TypeError(`The Preset profile "${x264Preset}" is not valid. Valid options are ${exports.x264PresetOptions
27
- .map((p) => `"${p}"`)
28
- .join(', ')}`);
29
- }
30
- };
31
- exports.validateSelectedCodecAndPresetCombination = validateSelectedCodecAndPresetCombination;
32
- const cliFlag = 'x264-preset';
33
- const DEFAULT_PRESET = 'medium';
34
- exports.x264Option = {
35
- name: 'x264 Preset',
36
- cliFlag,
37
- description: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Sets a x264 preset profile. Only applies to videos rendered with", ' ', (0, jsx_runtime_1.jsx)("code", { children: "h264" }), " codec.", (0, jsx_runtime_1.jsx)("br", {}), "Possible values: ", (0, jsx_runtime_1.jsx)("code", { children: "superfast" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "veryfast" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "faster" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "fast" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "medium" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "slow" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "slower" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "veryslow" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "placebo" }), ".", (0, jsx_runtime_1.jsx)("br", {}), "Default: ", (0, jsx_runtime_1.jsx)("code", { children: DEFAULT_PRESET })] })),
38
- ssrName: 'x264Preset',
39
- docLink: 'https://www.remotion.dev/docs/renderer/render-media',
40
- type: 'fast',
41
- getValue: ({ commandLine }) => {
42
- const value = commandLine[cliFlag];
43
- if (typeof value !== 'undefined') {
44
- return { value: value, source: 'cli' };
45
- }
46
- if (typeof preset !== 'undefined') {
47
- return { value: preset, source: 'config' };
48
- }
49
- return { value: DEFAULT_PRESET, source: 'default' };
50
- },
51
- setConfig: (profile) => {
52
- preset = profile;
53
- },
54
- };