@remotion/renderer 4.0.420 → 4.0.421

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.
@@ -297,7 +297,7 @@ var printUsefulErrorMessage = (err, logLevel, indent) => {
297
297
  Log.warn({
298
298
  indent,
299
299
  logLevel
300
- }, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
300
+ }, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle". Learn why at https://www.remotion.dev/docs/three');
301
301
  Log.warn({
302
302
  indent,
303
303
  logLevel
@@ -15338,6 +15338,13 @@ var numberTo32BiIntLittleEndian = (num) => {
15338
15338
  var numberTo16BitLittleEndian = (num) => {
15339
15339
  return new Uint8Array([num & 255, num >> 8 & 255]);
15340
15340
  };
15341
+ var correctFloatingPointError = (value) => {
15342
+ const rounded = Math.round(value);
15343
+ if (Math.abs(value - rounded) < 0.00001) {
15344
+ return rounded;
15345
+ }
15346
+ return value;
15347
+ };
15341
15348
  var BIT_DEPTH = 16;
15342
15349
  var BYTES_PER_SAMPLE = BIT_DEPTH / 8;
15343
15350
  var NUMBER_OF_CHANNELS = 2;
@@ -15442,13 +15449,13 @@ var makeInlineAudioMixing = (dir) => {
15442
15449
  const samplesToShaveFromStart = trimLeftOffset * DEFAULT_SAMPLE_RATE;
15443
15450
  const samplesToShaveFromEnd = trimRightOffset * DEFAULT_SAMPLE_RATE;
15444
15451
  if (isFirst) {
15445
- arr = arr.slice(Math.floor(samplesToShaveFromStart) * NUMBER_OF_CHANNELS);
15452
+ arr = arr.slice(Math.floor(correctFloatingPointError(samplesToShaveFromStart)) * NUMBER_OF_CHANNELS);
15446
15453
  }
15447
15454
  if (isLast) {
15448
- arr = arr.slice(0, arr.length + Math.ceil(samplesToShaveFromEnd) * NUMBER_OF_CHANNELS);
15455
+ arr = arr.slice(0, arr.length + Math.ceil(correctFloatingPointError(samplesToShaveFromEnd)) * NUMBER_OF_CHANNELS);
15449
15456
  }
15450
15457
  const positionInSeconds = (asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);
15451
- const position = Math.floor(positionInSeconds * DEFAULT_SAMPLE_RATE) * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE;
15458
+ const position = Math.floor(correctFloatingPointError(positionInSeconds * DEFAULT_SAMPLE_RATE)) * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE;
15452
15459
  writeSync(fileDescriptor, arr, 0, arr.byteLength, 44 + position);
15453
15460
  };
15454
15461
  return {
@@ -15633,7 +15640,8 @@ var testPortAvailableOnMultipleHosts = async ({
15633
15640
  var getPort = async ({
15634
15641
  from,
15635
15642
  to,
15636
- hostsToTest
15643
+ hostsToTest,
15644
+ onPortUnavailable
15637
15645
  }) => {
15638
15646
  const ports = makeRange(from, to);
15639
15647
  for (const port of ports) {
@@ -15641,7 +15649,13 @@ var getPort = async ({
15641
15649
  port,
15642
15650
  hosts: hostsToTest
15643
15651
  }) === "available") {
15644
- return port;
15652
+ return { port, didUsePort: false };
15653
+ }
15654
+ if (onPortUnavailable) {
15655
+ const action = await onPortUnavailable(port);
15656
+ if (action === "stop") {
15657
+ return { port, didUsePort: true };
15658
+ }
15645
15659
  }
15646
15660
  }
15647
15661
  throw new Error("No available ports found");
@@ -15651,7 +15665,8 @@ var getDesiredPort = async ({
15651
15665
  desiredPort,
15652
15666
  from,
15653
15667
  hostsToTry,
15654
- to
15668
+ to,
15669
+ onPortUnavailable
15655
15670
  }) => {
15656
15671
  await portLocks.waitForAllToBeDone();
15657
15672
  const lockPortSelection = portLocks.lock();
@@ -15660,14 +15675,28 @@ var getDesiredPort = async ({
15660
15675
  port: desiredPort,
15661
15676
  hosts: hostsToTry
15662
15677
  }) === "available") {
15663
- return { port: desiredPort, unlockPort };
15678
+ return { port: desiredPort, unlockPort, didUsePort: false };
15679
+ }
15680
+ if (typeof desiredPort !== "undefined" && onPortUnavailable) {
15681
+ const action = await onPortUnavailable(desiredPort);
15682
+ if (action === "stop") {
15683
+ return { port: desiredPort, unlockPort, didUsePort: true };
15684
+ }
15685
+ }
15686
+ const result = await getPort({
15687
+ from,
15688
+ to,
15689
+ hostsToTest: hostsToTry,
15690
+ onPortUnavailable
15691
+ });
15692
+ if (result.didUsePort) {
15693
+ return { port: result.port, unlockPort, didUsePort: true };
15664
15694
  }
15665
- const actualPort = await getPort({ from, to, hostsToTest: hostsToTry });
15666
- if (desiredPort && desiredPort !== actualPort) {
15695
+ if (desiredPort && desiredPort !== result.port) {
15667
15696
  unlockPort();
15668
15697
  throw new Error(`You specified port ${desiredPort} to be used for the HTTP server, but it is not available. Choose a different port or remove the setting to let Remotion automatically select a free port.`);
15669
15698
  }
15670
- return { port: actualPort, unlockPort };
15699
+ return { port: result.port, unlockPort, didUsePort: false };
15671
15700
  };
15672
15701
  var makeRange = (from, to) => {
15673
15702
  if (!Number.isInteger(from) || !Number.isInteger(to)) {
@@ -16832,7 +16861,7 @@ var printUsefulErrorMessage = (err, logLevel, indent) => {
16832
16861
  Log.warn({
16833
16862
  indent,
16834
16863
  logLevel
16835
- }, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
16864
+ }, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle". Learn why at https://www.remotion.dev/docs/three');
16836
16865
  Log.warn({
16837
16866
  indent,
16838
16867
  logLevel
@@ -3,13 +3,19 @@ export declare const testPortAvailableOnMultipleHosts: ({ hosts, port, }: {
3
3
  port: number;
4
4
  hosts: string[];
5
5
  }) => Promise<PortStatus>;
6
- export declare const getDesiredPort: ({ desiredPort, from, hostsToTry, to, }: {
6
+ export declare const getDesiredPort: ({ desiredPort, from, hostsToTry, to, onPortUnavailable, }: {
7
7
  desiredPort: number | undefined;
8
8
  from: number;
9
9
  to: number;
10
10
  hostsToTry: string[];
11
+ onPortUnavailable?: ((port: number) => Promise<"continue" | "stop">) | undefined;
11
12
  }) => Promise<{
12
13
  port: number;
13
14
  unlockPort: () => void;
15
+ didUsePort: false;
16
+ } | {
17
+ port: number;
18
+ unlockPort: () => void;
19
+ didUsePort: true;
14
20
  }>;
15
21
  export {};
package/dist/get-port.js CHANGED
@@ -34,20 +34,26 @@ const testPortAvailableOnMultipleHosts = async ({ hosts, port, }) => {
34
34
  return results.every((r) => r === 'available') ? 'available' : 'unavailable';
35
35
  };
36
36
  exports.testPortAvailableOnMultipleHosts = testPortAvailableOnMultipleHosts;
37
- const getPort = async ({ from, to, hostsToTest, }) => {
37
+ const getPort = async ({ from, to, hostsToTest, onPortUnavailable, }) => {
38
38
  const ports = makeRange(from, to);
39
39
  for (const port of ports) {
40
40
  if ((await (0, exports.testPortAvailableOnMultipleHosts)({
41
41
  port,
42
42
  hosts: hostsToTest,
43
43
  })) === 'available') {
44
- return port;
44
+ return { port, didUsePort: false };
45
+ }
46
+ if (onPortUnavailable) {
47
+ const action = await onPortUnavailable(port);
48
+ if (action === 'stop') {
49
+ return { port, didUsePort: true };
50
+ }
45
51
  }
46
52
  }
47
53
  throw new Error('No available ports found');
48
54
  };
49
55
  const portLocks = (0, locks_1.createLock)({ timeout: 10000 });
50
- const getDesiredPort = async ({ desiredPort, from, hostsToTry, to, }) => {
56
+ const getDesiredPort = async ({ desiredPort, from, hostsToTry, to, onPortUnavailable, }) => {
51
57
  await portLocks.waitForAllToBeDone();
52
58
  const lockPortSelection = portLocks.lock();
53
59
  const unlockPort = () => portLocks.unlock(lockPortSelection);
@@ -56,15 +62,29 @@ const getDesiredPort = async ({ desiredPort, from, hostsToTry, to, }) => {
56
62
  port: desiredPort,
57
63
  hosts: hostsToTry,
58
64
  })) === 'available') {
59
- return { port: desiredPort, unlockPort };
65
+ return { port: desiredPort, unlockPort, didUsePort: false };
66
+ }
67
+ if (typeof desiredPort !== 'undefined' && onPortUnavailable) {
68
+ const action = await onPortUnavailable(desiredPort);
69
+ if (action === 'stop') {
70
+ return { port: desiredPort, unlockPort, didUsePort: true };
71
+ }
72
+ }
73
+ const result = await getPort({
74
+ from,
75
+ to,
76
+ hostsToTest: hostsToTry,
77
+ onPortUnavailable,
78
+ });
79
+ if (result.didUsePort) {
80
+ return { port: result.port, unlockPort, didUsePort: true };
60
81
  }
61
- const actualPort = await getPort({ from, to, hostsToTest: hostsToTry });
62
82
  // If did specify a port but did not get that one, fail hard.
63
- if (desiredPort && desiredPort !== actualPort) {
83
+ if (desiredPort && desiredPort !== result.port) {
64
84
  unlockPort();
65
85
  throw new Error(`You specified port ${desiredPort} to be used for the HTTP server, but it is not available. Choose a different port or remove the setting to let Remotion automatically select a free port.`);
66
86
  }
67
- return { port: actualPort, unlockPort };
87
+ return { port: result.port, unlockPort, didUsePort: false };
68
88
  };
69
89
  exports.getDesiredPort = getDesiredPort;
70
90
  const makeRange = (from, to) => {
package/dist/index.d.ts CHANGED
@@ -106,14 +106,20 @@ export declare const RenderInternals: {
106
106
  SymbolicateableError: typeof SymbolicateableError;
107
107
  getFramesToRender: (frameRange: [number, number], everyNthFrame: number) => number[];
108
108
  getExtensionOfFilename: (filename: string | null) => string | null;
109
- getDesiredPort: ({ desiredPort, from, hostsToTry, to, }: {
109
+ getDesiredPort: ({ desiredPort, from, hostsToTry, to, onPortUnavailable, }: {
110
110
  desiredPort: number | undefined;
111
111
  from: number;
112
112
  to: number;
113
113
  hostsToTry: string[];
114
+ onPortUnavailable?: ((port: number) => Promise<"continue" | "stop">) | undefined;
114
115
  }) => Promise<{
115
116
  port: number;
116
117
  unlockPort: () => void;
118
+ didUsePort: false;
119
+ } | {
120
+ port: number;
121
+ unlockPort: () => void;
122
+ didUsePort: true;
117
123
  }>;
118
124
  isPathInside: (thePath: string, potentialParent: string) => boolean;
119
125
  execa: {
@@ -0,0 +1,15 @@
1
+ export declare const forceNewStudioOption: {
2
+ name: string;
3
+ cliFlag: "force-new";
4
+ description: () => import("react/jsx-runtime").JSX.Element;
5
+ ssrName: null;
6
+ docLink: string;
7
+ type: boolean;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ value: boolean;
12
+ source: string;
13
+ };
14
+ setConfig(value: boolean): void;
15
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.forceNewStudioOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ let forceNewEnabled = false;
6
+ const cliFlag = 'force-new';
7
+ exports.forceNewStudioOption = {
8
+ name: 'Force New Studio',
9
+ cliFlag,
10
+ description: () => (jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: "Forces starting a new Studio instance even if one is already running on the same port for the same project." })),
11
+ ssrName: null,
12
+ docLink: 'https://www.remotion.dev/docs/config#setforcenewstudioenabled',
13
+ type: false,
14
+ getValue: ({ commandLine }) => {
15
+ if (commandLine[cliFlag] !== undefined) {
16
+ return {
17
+ value: commandLine[cliFlag],
18
+ source: 'cli',
19
+ };
20
+ }
21
+ return {
22
+ value: forceNewEnabled,
23
+ source: 'config',
24
+ };
25
+ },
26
+ setConfig(value) {
27
+ forceNewEnabled = value;
28
+ },
29
+ };
@@ -847,6 +847,21 @@ export declare const allOptions: {
847
847
  };
848
848
  setConfig(value: boolean): void;
849
849
  };
850
+ forceNewStudioOption: {
851
+ name: string;
852
+ cliFlag: "force-new";
853
+ description: () => import("react/jsx-runtime").JSX.Element;
854
+ ssrName: null;
855
+ docLink: string;
856
+ type: boolean;
857
+ getValue: ({ commandLine }: {
858
+ commandLine: Record<string, unknown>;
859
+ }) => {
860
+ value: boolean;
861
+ source: string;
862
+ };
863
+ setConfig(value: boolean): void;
864
+ };
850
865
  };
851
866
  export type AvailableOptions = keyof typeof allOptions;
852
867
  export type TypeOfOption<Type> = Type extends AnyRemotionOption<infer X> ? X : never;
@@ -23,6 +23,7 @@ const enforce_audio_1 = require("./enforce-audio");
23
23
  const experimental_client_side_rendering_1 = require("./experimental-client-side-rendering");
24
24
  const folder_expiry_1 = require("./folder-expiry");
25
25
  const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenation");
26
+ const force_new_studio_1 = require("./force-new-studio");
26
27
  const gl_1 = require("./gl");
27
28
  const hardware_acceleration_1 = require("./hardware-acceleration");
28
29
  const headless_1 = require("./headless");
@@ -108,4 +109,5 @@ exports.allOptions = {
108
109
  askAIOption: ask_ai_1.askAIOption,
109
110
  experimentalClientSideRenderingOption: experimental_client_side_rendering_1.experimentalClientSideRenderingOption,
110
111
  keyboardShortcutsOption: keyboard_shortcuts_1.keyboardShortcutsOption,
112
+ forceNewStudioOption: force_new_studio_1.forceNewStudioOption,
111
113
  };
@@ -58,7 +58,7 @@ const printUsefulErrorMessage = (err, logLevel, indent) => {
58
58
  logger_1.Log.warn({
59
59
  indent,
60
60
  logLevel,
61
- }, '💡 You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
61
+ }, '💡 You might need to set the OpenGL renderer to "angle". Learn why at https://www.remotion.dev/docs/three');
62
62
  logger_1.Log.warn({
63
63
  indent,
64
64
  logLevel,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.420",
6
+ "version": "4.0.421",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "execa": "5.1.1",
25
25
  "extract-zip": "2.0.1",
26
- "remotion": "4.0.420",
27
- "@remotion/streaming": "4.0.420",
26
+ "remotion": "4.0.421",
27
+ "@remotion/streaming": "4.0.421",
28
28
  "source-map": "^0.8.0-beta.0",
29
29
  "ws": "8.17.1",
30
- "@remotion/licensing": "4.0.420"
30
+ "@remotion/licensing": "4.0.421"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=16.8.0",
@@ -41,19 +41,19 @@
41
41
  "react-dom": "19.2.3",
42
42
  "@typescript/native-preview": "7.0.0-dev.20260105.1",
43
43
  "@types/ws": "8.5.10",
44
- "@remotion/example-videos": "4.0.420",
45
- "@remotion/eslint-config-internal": "4.0.420",
44
+ "@remotion/example-videos": "4.0.421",
45
+ "@remotion/eslint-config-internal": "4.0.421",
46
46
  "eslint": "9.19.0",
47
47
  "@types/node": "20.12.14"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@remotion/compositor-darwin-arm64": "4.0.420",
51
- "@remotion/compositor-darwin-x64": "4.0.420",
52
- "@remotion/compositor-linux-arm64-gnu": "4.0.420",
53
- "@remotion/compositor-linux-arm64-musl": "4.0.420",
54
- "@remotion/compositor-linux-x64-gnu": "4.0.420",
55
- "@remotion/compositor-linux-x64-musl": "4.0.420",
56
- "@remotion/compositor-win32-x64-msvc": "4.0.420"
50
+ "@remotion/compositor-darwin-arm64": "4.0.421",
51
+ "@remotion/compositor-darwin-x64": "4.0.421",
52
+ "@remotion/compositor-linux-arm64-gnu": "4.0.421",
53
+ "@remotion/compositor-linux-arm64-musl": "4.0.421",
54
+ "@remotion/compositor-linux-x64-gnu": "4.0.421",
55
+ "@remotion/compositor-linux-x64-musl": "4.0.421",
56
+ "@remotion/compositor-win32-x64-msvc": "4.0.421"
57
57
  },
58
58
  "keywords": [
59
59
  "remotion",