@remotion/renderer 4.0.113 → 4.0.115

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 (79) hide show
  1. package/dist/check-apple-silicon.d.ts +3 -1
  2. package/dist/check-apple-silicon.js +32 -2
  3. package/dist/client.d.ts +779 -14
  4. package/dist/client.js +3 -1
  5. package/dist/combine-videos.js +1 -1
  6. package/dist/ffmpeg-args.d.ts +1 -1
  7. package/dist/get-extension-of-filename.js +2 -5
  8. package/dist/index.d.ts +50 -3
  9. package/dist/jpeg-quality.d.ts +1 -1
  10. package/dist/options/audio-bitrate.d.ts +10 -0
  11. package/dist/options/audio-bitrate.js +25 -2
  12. package/dist/options/beep-on-finish.d.ts +7 -0
  13. package/dist/options/beep-on-finish.js +24 -1
  14. package/dist/options/color-space.d.ts +7 -0
  15. package/dist/options/color-space.js +23 -0
  16. package/dist/options/crf.d.ts +9 -0
  17. package/dist/options/crf.js +33 -2
  18. package/dist/options/delete-after.d.ts +12 -1
  19. package/dist/options/delete-after.js +25 -2
  20. package/dist/options/enable-lambda-insights.d.ts +7 -0
  21. package/dist/options/enable-lambda-insights.js +24 -1
  22. package/dist/options/enable-multiprocess-on-linux.d.ts +7 -0
  23. package/dist/options/enable-multiprocess-on-linux.js +24 -1
  24. package/dist/options/encoding-buffer-size.d.ts +10 -0
  25. package/dist/options/encoding-buffer-size.js +28 -1
  26. package/dist/options/encoding-max-rate.d.ts +10 -0
  27. package/dist/options/encoding-max-rate.js +24 -1
  28. package/dist/options/enforce-audio.d.ts +7 -0
  29. package/dist/options/enforce-audio.js +25 -1
  30. package/dist/options/folder-expiry.d.ts +7 -0
  31. package/dist/options/folder-expiry.js +24 -1
  32. package/dist/options/gl.d.ts +16 -4
  33. package/dist/options/gl.js +35 -3
  34. package/dist/options/headless.d.ts +15 -0
  35. package/dist/options/headless.js +36 -0
  36. package/dist/options/index.d.ts +202 -10
  37. package/dist/options/index.js +5 -3
  38. package/dist/options/jpeg-quality.d.ts +9 -0
  39. package/dist/options/jpeg-quality.js +37 -2
  40. package/dist/options/log-level.d.ts +16 -0
  41. package/dist/options/log-level.js +32 -0
  42. package/dist/options/mute.d.ts +9 -2
  43. package/dist/options/mute.js +27 -3
  44. package/dist/options/number-of-gif-loops.d.ts +11 -0
  45. package/dist/options/number-of-gif-loops.js +31 -1
  46. package/dist/options/offthreadvideo-cache-size.d.ts +12 -1
  47. package/dist/options/offthreadvideo-cache-size.js +30 -3
  48. package/dist/options/option.d.ts +11 -3
  49. package/dist/options/options-map.d.ts +577 -3
  50. package/dist/options/options-map.js +46 -12
  51. package/dist/options/overwrite.d.ts +15 -0
  52. package/dist/options/overwrite.js +42 -0
  53. package/dist/options/repro.d.ts +11 -1
  54. package/dist/options/repro.js +25 -1
  55. package/dist/options/scale.d.ts +7 -0
  56. package/dist/options/scale.js +30 -1
  57. package/dist/options/timeout.d.ts +15 -0
  58. package/dist/options/timeout.js +44 -0
  59. package/dist/options/video-bitrate.d.ts +9 -2
  60. package/dist/options/video-bitrate.js +27 -4
  61. package/dist/options/video-codec.d.ts +16 -1
  62. package/dist/options/video-codec.js +81 -2
  63. package/dist/options/webhook-custom-data.d.ts +3 -1
  64. package/dist/options/webhook-custom-data.js +8 -1
  65. package/dist/options/x264-preset.d.ts +20 -3
  66. package/dist/options/x264-preset.js +47 -7
  67. package/dist/path-normalize.d.ts +1 -0
  68. package/dist/path-normalize.js +133 -0
  69. package/dist/prespawn-ffmpeg.d.ts +1 -1
  70. package/dist/render-frames.d.ts +1 -3
  71. package/dist/render-media.d.ts +0 -12
  72. package/dist/render-media.js +2 -2
  73. package/dist/render-still.d.ts +1 -3
  74. package/dist/select-composition.d.ts +2 -3
  75. package/dist/stitch-frames-to-video.d.ts +1 -1
  76. package/dist/stitch-frames-to-video.js +1 -1
  77. package/package.json +9 -9
  78. package/dist/does-have-m2-bug.d.ts +0 -3
  79. package/dist/does-have-m2-bug.js +0 -12
@@ -1,45 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.optionsMap = void 0;
4
+ const audio_bitrate_1 = require("./audio-bitrate");
5
+ const color_space_1 = require("./color-space");
6
+ const delete_after_1 = require("./delete-after");
7
+ const encoding_buffer_size_1 = require("./encoding-buffer-size");
8
+ const encoding_max_rate_1 = require("./encoding-max-rate");
9
+ const jpeg_quality_1 = require("./jpeg-quality");
10
+ const mute_1 = require("./mute");
4
11
  const number_of_gif_loops_1 = require("./number-of-gif-loops");
5
12
  const offthreadvideo_cache_size_1 = require("./offthreadvideo-cache-size");
6
13
  const repro_1 = require("./repro");
7
14
  const video_bitrate_1 = require("./video-bitrate");
15
+ const video_codec_1 = require("./video-codec");
16
+ const x264_preset_1 = require("./x264-preset");
8
17
  exports.optionsMap = {
9
18
  renderMedia: {
10
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
11
- videoBitrate: video_bitrate_1.videoBitrate,
19
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
20
+ videoBitrate: video_bitrate_1.videoBitrateOption,
12
21
  numberOfGifLoops: number_of_gif_loops_1.numberOfGifLoopsOption,
13
22
  repro: repro_1.reproOption,
23
+ x264Preset: x264_preset_1.x264Option,
24
+ audioBitrate: audio_bitrate_1.audioBitrateOption,
25
+ colorSpace: color_space_1.colorSpaceOption,
26
+ codec: video_codec_1.videoCodecOption,
27
+ jpegQuality: jpeg_quality_1.jpegQualityOption,
28
+ encodingMaxRate: encoding_max_rate_1.encodingMaxRateOption,
29
+ encodingBufferSize: encoding_buffer_size_1.encodingBufferSizeOption,
30
+ muted: mute_1.mutedOption,
14
31
  },
15
32
  renderStill: {
16
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
33
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
34
+ jpegQuality: jpeg_quality_1.jpegQualityOption,
17
35
  },
18
36
  getCompositions: {
19
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
37
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
20
38
  },
21
39
  selectComposition: {
22
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
40
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
23
41
  },
24
42
  renderFrames: {
25
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
43
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
44
+ jpegQuality: jpeg_quality_1.jpegQualityOption,
26
45
  },
27
46
  renderMediaOnLambda: {
28
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
29
- videoBitrate: video_bitrate_1.videoBitrate,
47
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
48
+ videoBitrate: video_bitrate_1.videoBitrateOption,
30
49
  numberOfGifLoops: number_of_gif_loops_1.numberOfGifLoopsOption,
50
+ audioBitrate: audio_bitrate_1.audioBitrateOption,
51
+ deleteAfter: delete_after_1.deleteAfterOption,
52
+ x264Preset: x264_preset_1.x264Option,
53
+ encodingMaxRate: encoding_max_rate_1.encodingMaxRateOption,
54
+ encodingBufferSize: encoding_buffer_size_1.encodingBufferSizeOption,
55
+ colorSpace: color_space_1.colorSpaceOption,
56
+ muted: mute_1.mutedOption,
31
57
  },
32
58
  renderStillOnLambda: {
33
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
59
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
60
+ jpegQuality: jpeg_quality_1.jpegQualityOption,
34
61
  },
35
62
  getCompositionsOnLambda: {
36
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
63
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
37
64
  },
38
65
  renderMediaOnCloudRun: {
39
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
66
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
40
67
  numberOfGifLoops: number_of_gif_loops_1.numberOfGifLoopsOption,
68
+ colorSpace: color_space_1.colorSpaceOption,
69
+ audioBitrate: audio_bitrate_1.audioBitrateOption,
70
+ videoBitrate: video_bitrate_1.videoBitrateOption,
71
+ x264Preset: x264_preset_1.x264Option,
72
+ encodingMaxRate: encoding_max_rate_1.encodingMaxRateOption,
73
+ encodingBufferSize: encoding_buffer_size_1.encodingBufferSizeOption,
74
+ muted: mute_1.mutedOption,
41
75
  },
42
76
  renderStillOnCloudRun: {
43
- offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytes,
77
+ offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
44
78
  },
45
79
  };
@@ -0,0 +1,15 @@
1
+ export declare const overwriteOption: {
2
+ name: string;
3
+ cliFlag: "overwrite";
4
+ description: () => import("react/jsx-runtime").JSX.Element;
5
+ ssrName: string;
6
+ docLink: string;
7
+ type: boolean;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }, defaultValue: boolean) => {
11
+ source: string;
12
+ value: boolean;
13
+ };
14
+ setConfig: (value: boolean) => void;
15
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.overwriteOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ let shouldOverwrite = null;
6
+ const cliFlag = 'overwrite';
7
+ const validate = (value) => {
8
+ if (typeof value !== 'boolean') {
9
+ throw new Error(`overwriteExisting must be a boolean but got ${typeof value} (${value})`);
10
+ }
11
+ };
12
+ exports.overwriteOption = {
13
+ name: 'Overwrite output',
14
+ cliFlag,
15
+ description: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["If set to ", (0, jsx_runtime_1.jsx)("code", { children: "false" }), ", will prevent rendering to a path that already exists. Default is ", (0, jsx_runtime_1.jsx)("code", { children: "true" }), "."] })),
16
+ ssrName: 'overwrite',
17
+ docLink: 'https://www.remotion.dev/docs/config#setoverwriteoutput',
18
+ type: false,
19
+ getValue: ({ commandLine }, defaultValue) => {
20
+ if (commandLine[cliFlag] !== undefined) {
21
+ validate(commandLine[cliFlag]);
22
+ return {
23
+ source: 'cli',
24
+ value: commandLine[cliFlag],
25
+ };
26
+ }
27
+ if (shouldOverwrite !== null) {
28
+ return {
29
+ source: 'config',
30
+ value: shouldOverwrite,
31
+ };
32
+ }
33
+ return {
34
+ source: 'default',
35
+ value: defaultValue,
36
+ };
37
+ },
38
+ setConfig: (value) => {
39
+ validate(value);
40
+ shouldOverwrite = value;
41
+ },
42
+ };
@@ -1,8 +1,18 @@
1
1
  export declare const reproOption: {
2
2
  name: string;
3
- cliFlag: string;
3
+ cliFlag: "repro";
4
4
  description: () => import("react/jsx-runtime").JSX.Element;
5
5
  ssrName: string;
6
6
  docLink: string;
7
7
  type: boolean;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ value: true;
12
+ source: string;
13
+ } | {
14
+ value: false;
15
+ source: string;
16
+ };
17
+ setConfig: (should: boolean) => void;
8
18
  };
@@ -2,11 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reproOption = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ let enableRepro = false;
6
+ const setRepro = (should) => {
7
+ enableRepro = should;
8
+ };
9
+ const cliFlag = 'repro';
5
10
  exports.reproOption = {
6
11
  name: 'Create reproduction',
7
- cliFlag: 'repro',
12
+ cliFlag,
8
13
  description: () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Create a ZIP that you can submit to Remotion if asked for a reproduction." })),
9
14
  ssrName: 'repro',
10
15
  docLink: 'https://www.remotion.dev/docs/render-media#repro',
11
16
  type: false,
17
+ getValue: ({ commandLine }) => {
18
+ if (commandLine[cliFlag] !== undefined) {
19
+ return {
20
+ value: true,
21
+ source: 'cli',
22
+ };
23
+ }
24
+ if (enableRepro) {
25
+ return {
26
+ value: enableRepro,
27
+ source: 'config',
28
+ };
29
+ }
30
+ return {
31
+ value: false,
32
+ source: 'default',
33
+ };
34
+ },
35
+ setConfig: setRepro,
12
36
  };
@@ -5,4 +5,11 @@ export declare const scaleOption: {
5
5
  ssrName: string;
6
6
  docLink: string;
7
7
  type: number;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ source: string;
12
+ value: number;
13
+ };
14
+ setConfig: (scale: number) => void;
8
15
  };
@@ -2,11 +2,40 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scaleOption = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ let currentScale = 1;
6
+ const cliFlag = 'scale';
7
+ const validateScale = (value) => {
8
+ if (typeof value !== 'number') {
9
+ throw new Error('scale must be a number.');
10
+ }
11
+ };
5
12
  exports.scaleOption = {
6
13
  name: 'Scale',
7
- cliFlag: 'scale',
14
+ cliFlag,
8
15
  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
16
  ssrName: 'scale',
10
17
  docLink: 'https://www.remotion.dev/docs/scaling',
11
18
  type: 0,
19
+ getValue: ({ commandLine }) => {
20
+ if (commandLine[cliFlag] !== undefined) {
21
+ validateScale(commandLine[cliFlag]);
22
+ return {
23
+ source: 'cli',
24
+ value: commandLine[cliFlag],
25
+ };
26
+ }
27
+ if (currentScale !== null) {
28
+ return {
29
+ source: 'config',
30
+ value: currentScale,
31
+ };
32
+ }
33
+ return {
34
+ source: 'default',
35
+ value: 1,
36
+ };
37
+ },
38
+ setConfig: (scale) => {
39
+ currentScale = scale;
40
+ },
12
41
  };
@@ -0,0 +1,15 @@
1
+ export declare const delayRenderTimeoutInMillisecondsOption: {
2
+ name: string;
3
+ cliFlag: "timeout";
4
+ description: () => import("react/jsx-runtime").JSX.Element;
5
+ ssrName: "timeoutInMilliseconds";
6
+ docLink: string;
7
+ type: number;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ source: string;
12
+ value: number;
13
+ };
14
+ setConfig: (value: number) => void;
15
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delayRenderTimeoutInMillisecondsOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const TimeoutSettings_1 = require("../browser/TimeoutSettings");
6
+ let currentTimeout = TimeoutSettings_1.DEFAULT_TIMEOUT;
7
+ const validate = (value) => {
8
+ if (typeof value !== 'number') {
9
+ throw new Error('--timeout flag / setDelayRenderTimeoutInMilliseconds() must be a number, but got ' +
10
+ JSON.stringify(value));
11
+ }
12
+ };
13
+ const cliFlag = 'timeout';
14
+ exports.delayRenderTimeoutInMillisecondsOption = {
15
+ name: 'delayRender() timeout',
16
+ cliFlag,
17
+ description: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["A number describing how long the render may take to resolve all", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs/delay-render", children: (0, jsx_runtime_1.jsx)("code", { children: "delayRender()" }) }), ' ', "calls ", (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs/timeout", children: "before it times out" }), ". Default: ", (0, jsx_runtime_1.jsx)("code", { children: "30000" })] })),
18
+ ssrName: 'timeoutInMilliseconds',
19
+ docLink: 'https://www.remotion.dev/docs/timeout',
20
+ type: 0,
21
+ getValue: ({ commandLine }) => {
22
+ if (commandLine[cliFlag] !== undefined) {
23
+ return {
24
+ source: 'cli',
25
+ value: commandLine[cliFlag],
26
+ };
27
+ }
28
+ if (currentTimeout !== null) {
29
+ validate(currentTimeout);
30
+ return {
31
+ source: 'config',
32
+ value: currentTimeout,
33
+ };
34
+ }
35
+ return {
36
+ source: 'default',
37
+ value: TimeoutSettings_1.DEFAULT_TIMEOUT,
38
+ };
39
+ },
40
+ setConfig: (value) => {
41
+ validate(value);
42
+ currentTimeout = value;
43
+ },
44
+ };
@@ -1,8 +1,15 @@
1
- export declare const videoBitrate: {
1
+ export declare const videoBitrateOption: {
2
2
  name: string;
3
- cliFlag: string;
3
+ cliFlag: "video-bitrate";
4
4
  description: () => import("react/jsx-runtime").JSX.Element;
5
5
  ssrName: string;
6
6
  docLink: string;
7
7
  type: string | null;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ source: string;
12
+ value: string | null;
13
+ };
14
+ setConfig: (bitrate: string | null) => void;
8
15
  };
@@ -1,12 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.videoBitrate = void 0;
3
+ exports.videoBitrateOption = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- exports.videoBitrate = {
5
+ let videoBitrate = null;
6
+ const cliFlag = 'video-bitrate';
7
+ exports.videoBitrateOption = {
6
8
  name: 'Video Bitrate',
7
- cliFlag: 'video-bitrate',
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
+ cliFlag,
10
+ description: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Specify the target bitrate for the generated video. The syntax for FFmpeg", "'", "s", (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
11
  ssrName: 'videoBitrate',
10
12
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#videobitrate-',
11
13
  type: '',
14
+ getValue: ({ commandLine }) => {
15
+ if (commandLine[cliFlag] !== undefined) {
16
+ return {
17
+ source: 'cli',
18
+ value: commandLine[cliFlag],
19
+ };
20
+ }
21
+ if (videoBitrate !== null) {
22
+ return {
23
+ source: 'config',
24
+ value: videoBitrate,
25
+ };
26
+ }
27
+ return {
28
+ source: 'default',
29
+ value: null,
30
+ };
31
+ },
32
+ setConfig: (bitrate) => {
33
+ videoBitrate = bitrate;
34
+ },
12
35
  };
@@ -1,8 +1,23 @@
1
+ import type { Codec, CodecOrUndefined } from '../codec';
2
+ export declare const getOutputCodecOrUndefined: () => CodecOrUndefined;
1
3
  export declare const videoCodecOption: {
2
4
  name: string;
3
5
  cliFlag: "codec";
4
6
  description: () => import("react/jsx-runtime").JSX.Element;
5
7
  ssrName: string;
6
8
  docLink: string;
7
- type: string;
9
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
10
+ getValue: ({ commandLine }: {
11
+ commandLine: Record<string, unknown>;
12
+ }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
13
+ outName: string | null;
14
+ downloadName: string | null;
15
+ configFile: Codec | null;
16
+ uiCodec: Codec | null;
17
+ compositionCodec: Codec | null;
18
+ }) => {
19
+ value: Codec;
20
+ source: string;
21
+ };
22
+ setConfig: (newCodec: CodecOrUndefined) => void;
8
23
  };
@@ -1,12 +1,91 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.videoCodecOption = void 0;
3
+ exports.videoCodecOption = exports.getOutputCodecOrUndefined = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const codec_1 = require("../codec");
6
+ const get_extension_from_codec_1 = require("../get-extension-from-codec");
7
+ const get_extension_of_filename_1 = require("../get-extension-of-filename");
8
+ let codec;
9
+ const setCodec = (newCodec) => {
10
+ if (newCodec === undefined) {
11
+ codec = undefined;
12
+ return;
13
+ }
14
+ if (!codec_1.validCodecs.includes(newCodec)) {
15
+ throw new Error(`Codec must be one of the following: ${codec_1.validCodecs.join(', ')}, but got ${newCodec}`);
16
+ }
17
+ codec = newCodec;
18
+ };
19
+ const getOutputCodecOrUndefined = () => {
20
+ return codec;
21
+ };
22
+ exports.getOutputCodecOrUndefined = getOutputCodecOrUndefined;
23
+ const deriveCodecsFromFilename = (extension) => {
24
+ var _a, _b;
25
+ if (extension === null) {
26
+ return { possible: [], default: null };
27
+ }
28
+ return {
29
+ default: (_a = get_extension_from_codec_1.defaultCodecsForFileExtension[extension]) !== null && _a !== void 0 ? _a : null,
30
+ possible: (_b = (0, get_extension_from_codec_1.makeFileExtensionMap)()[extension]) !== null && _b !== void 0 ? _b : [],
31
+ };
32
+ };
33
+ const cliFlag = 'codec';
5
34
  exports.videoCodecOption = {
6
35
  name: 'Codec',
7
- cliFlag: 'codec',
36
+ cliFlag,
8
37
  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, GIF and ProRes support transparency." })),
9
38
  ssrName: 'codec',
10
39
  docLink: 'https://www.remotion.dev/docs/encoding/#choosing-a-codec',
11
40
  type: '',
41
+ getValue: ({ commandLine }, { compositionCodec, configFile, downloadName, outName, uiCodec, }) => {
42
+ if (uiCodec) {
43
+ return { value: uiCodec, source: 'via UI' };
44
+ }
45
+ const downloadNameExtension = (0, get_extension_of_filename_1.getExtensionOfFilename)(downloadName);
46
+ const outNameExtension = (0, get_extension_of_filename_1.getExtensionOfFilename)(outName);
47
+ const derivedDownloadCodecs = deriveCodecsFromFilename(downloadNameExtension);
48
+ const derivedOutNameCodecs = deriveCodecsFromFilename(outNameExtension);
49
+ if (derivedDownloadCodecs.possible.length > 0 &&
50
+ derivedOutNameCodecs.possible.length > 0 &&
51
+ derivedDownloadCodecs.possible.join('') !==
52
+ derivedOutNameCodecs.possible.join('')) {
53
+ throw new TypeError(`The download name is ${downloadName} but the output name is ${outName}. The file extensions must match`);
54
+ }
55
+ const cliArgument = commandLine[cliFlag];
56
+ if (cliArgument) {
57
+ if (derivedDownloadCodecs.possible.length > 0 &&
58
+ derivedDownloadCodecs.possible.indexOf(cliArgument) === -1) {
59
+ throw new TypeError(`The download name is ${downloadName} but --codec=${cliArgument} was passed. The download name implies a codec of ${derivedDownloadCodecs.possible.join(' or ')} which does not align with the --codec flag.`);
60
+ }
61
+ if (derivedOutNameCodecs.possible.length > 0 &&
62
+ derivedOutNameCodecs.possible.indexOf(cliArgument) === -1) {
63
+ throw new TypeError(`The out name is ${outName} but --codec=${cliArgument} was passed. The out name implies a codec of ${derivedOutNameCodecs.possible.join(' or ')} which does not align with the --codec flag.`);
64
+ }
65
+ return { value: cliArgument, source: 'from --codec flag' };
66
+ }
67
+ if (derivedDownloadCodecs.possible.length > 0) {
68
+ return {
69
+ value: derivedDownloadCodecs.default,
70
+ source: 'derived from download name',
71
+ };
72
+ }
73
+ if (derivedOutNameCodecs.possible.length > 0) {
74
+ return {
75
+ value: derivedOutNameCodecs.default,
76
+ source: 'derived from out name',
77
+ };
78
+ }
79
+ if (compositionCodec) {
80
+ return { value: compositionCodec, source: 'via calculateMetadata' };
81
+ }
82
+ if (configFile) {
83
+ return {
84
+ value: configFile,
85
+ source: 'Config file',
86
+ };
87
+ }
88
+ return { value: codec_1.DEFAULT_CODEC, source: 'default' };
89
+ },
90
+ setConfig: setCodec,
12
91
  };
@@ -1,8 +1,10 @@
1
1
  export declare const webhookCustomDataOption: {
2
2
  name: string;
3
3
  cliFlag: "webhook-custom-data";
4
- description: (type: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
4
+ description: (type: "cli" | "ssr") => import("react/jsx-runtime").JSX.Element;
5
5
  ssrName: "customData";
6
6
  docLink: string;
7
7
  type: Record<string, unknown> | null;
8
+ getValue: () => never;
9
+ setConfig: () => never;
8
10
  };
@@ -2,13 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webhookCustomDataOption = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const cliFlag = 'webhook-custom-data';
5
6
  exports.webhookCustomDataOption = {
6
7
  name: 'Webhook custom data',
7
- cliFlag: 'webhook-custom-data',
8
+ cliFlag,
8
9
  description: (type) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Pass up to 1,024 bytes of a JSON-serializable object to the webhook. This data will be included in the webhook payload.", ' ', type === 'cli'
9
10
  ? 'Alternatively, pass a file path pointing to a JSON file'
10
11
  : null] })),
11
12
  ssrName: 'customData',
12
13
  docLink: 'https://www.remotion.dev/docs/lambda/webhooks',
13
14
  type: {},
15
+ getValue: () => {
16
+ throw new Error('Option resolution not implemented');
17
+ },
18
+ setConfig: () => {
19
+ throw new Error('Not implemented');
20
+ },
14
21
  };
@@ -1,8 +1,25 @@
1
- export declare const offthreadVideoCacheSizeInBytes: {
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 | null;
7
+ }) => void;
8
+ export declare const x264Option: {
2
9
  name: string;
3
10
  cliFlag: "x264-preset";
4
11
  description: () => import("react/jsx-runtime").JSX.Element;
5
- ssrName: "offthreadVideoCacheSizeInBytes";
12
+ ssrName: "x264Preset";
6
13
  docLink: string;
7
- type: number | null;
14
+ type: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo" | null;
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
+ value: null;
22
+ source: string;
23
+ };
24
+ setConfig: (profile: X264Preset | null) => void;
8
25
  };
@@ -1,12 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.offthreadVideoCacheSizeInBytes = void 0;
3
+ exports.x264Option = exports.validateSelectedCodecAndPresetCombination = exports.x264PresetOptions = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- exports.offthreadVideoCacheSizeInBytes = {
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 = null;
18
+ const validateSelectedCodecAndPresetCombination = ({ codec, x264Preset, }) => {
19
+ if (x264Preset !== null && codec !== 'h264' && 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 !== null &&
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;
30
+ const cliFlag = 'x264-preset';
31
+ const DEFAULT_PRESET = 'medium';
32
+ exports.x264Option = {
6
33
  name: 'x264 Preset',
7
- cliFlag: 'x264-preset',
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,
34
+ cliFlag,
35
+ 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 })] })),
36
+ ssrName: 'x264Preset',
37
+ docLink: 'https://www.remotion.dev/docs/renderer/render-media',
38
+ type: 'fast',
39
+ getValue: ({ commandLine }) => {
40
+ const value = commandLine[cliFlag];
41
+ if (typeof value !== 'undefined') {
42
+ return { value: value, source: 'cli' };
43
+ }
44
+ if (preset !== null) {
45
+ return { value: preset, source: 'config' };
46
+ }
47
+ return { value: null, source: 'default' };
48
+ },
49
+ setConfig: (profile) => {
50
+ preset = profile;
51
+ },
12
52
  };
@@ -0,0 +1 @@
1
+ export declare const pathNormalize: (p: string) => string;