@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.
- package/dist/assets/inline-audio-mixing.js +19 -3
- package/dist/client.d.ts +15 -0
- package/dist/esm/client.mjs +305 -274
- package/dist/esm/error-handling.mjs +1 -1
- package/dist/esm/index.mjs +40 -11
- package/dist/get-port.d.ts +7 -1
- package/dist/get-port.js +27 -7
- package/dist/index.d.ts +7 -1
- package/dist/options/force-new-studio.d.ts +15 -0
- package/dist/options/force-new-studio.js +29 -0
- package/dist/options/index.d.ts +15 -0
- package/dist/options/index.js +2 -0
- package/dist/print-useful-error-message.js +1 -1
- package/package.json +13 -13
|
@@ -54,6 +54,19 @@ const numberTo32BiIntLittleEndian = (num) => {
|
|
|
54
54
|
const numberTo16BitLittleEndian = (num) => {
|
|
55
55
|
return new Uint8Array([num & 0xff, (num >> 8) & 0xff]);
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* When multiplying seconds by sample rate, floating point errors can cause
|
|
59
|
+
* results like 244799.99999999997 instead of 244800 (5.1 * 48000).
|
|
60
|
+
* This snaps to the nearest integer when within tolerance,
|
|
61
|
+
* preventing Math.floor/Math.ceil from rounding incorrectly.
|
|
62
|
+
*/
|
|
63
|
+
const correctFloatingPointError = (value) => {
|
|
64
|
+
const rounded = Math.round(value);
|
|
65
|
+
if (Math.abs(value - rounded) < 0.00001) {
|
|
66
|
+
return rounded;
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
};
|
|
57
70
|
const BIT_DEPTH = 16;
|
|
58
71
|
const BYTES_PER_SAMPLE = BIT_DEPTH / 8;
|
|
59
72
|
const NUMBER_OF_CHANNELS = 2;
|
|
@@ -149,17 +162,20 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
149
162
|
// Rendering https://github.com/remotion-dev/remotion/pull/5920 in native frame rate
|
|
150
163
|
// could hit this case
|
|
151
164
|
if (isFirst) {
|
|
152
|
-
arr = arr.slice(Math.floor(samplesToShaveFromStart) *
|
|
165
|
+
arr = arr.slice(Math.floor(correctFloatingPointError(samplesToShaveFromStart)) *
|
|
166
|
+
NUMBER_OF_CHANNELS);
|
|
153
167
|
}
|
|
154
168
|
if (isLast) {
|
|
155
|
-
arr = arr.slice(0, arr.length +
|
|
169
|
+
arr = arr.slice(0, arr.length +
|
|
170
|
+
Math.ceil(correctFloatingPointError(samplesToShaveFromEnd)) *
|
|
171
|
+
NUMBER_OF_CHANNELS);
|
|
156
172
|
}
|
|
157
173
|
const positionInSeconds = (asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);
|
|
158
174
|
// Always rounding down to ensure there are no gaps when the samples don't align
|
|
159
175
|
// In @remotion/media, we also round down the sample start timestamp and round up the end timestamp
|
|
160
176
|
// This might lead to overlapping, hopefully aligning perfectly!
|
|
161
177
|
// Test case: https://github.com/remotion-dev/remotion/issues/5758
|
|
162
|
-
const position = Math.floor(positionInSeconds * sample_rate_1.DEFAULT_SAMPLE_RATE) *
|
|
178
|
+
const position = Math.floor(correctFloatingPointError(positionInSeconds * sample_rate_1.DEFAULT_SAMPLE_RATE)) *
|
|
163
179
|
NUMBER_OF_CHANNELS *
|
|
164
180
|
BYTES_PER_SAMPLE;
|
|
165
181
|
(0, node_fs_1.writeSync)(
|
package/dist/client.d.ts
CHANGED
|
@@ -1070,6 +1070,21 @@ export declare const BrowserSafeApis: {
|
|
|
1070
1070
|
};
|
|
1071
1071
|
setConfig(value: boolean): void;
|
|
1072
1072
|
};
|
|
1073
|
+
forceNewStudioOption: {
|
|
1074
|
+
name: string;
|
|
1075
|
+
cliFlag: "force-new";
|
|
1076
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
1077
|
+
ssrName: null;
|
|
1078
|
+
docLink: string;
|
|
1079
|
+
type: boolean;
|
|
1080
|
+
getValue: ({ commandLine }: {
|
|
1081
|
+
commandLine: Record<string, unknown>;
|
|
1082
|
+
}) => {
|
|
1083
|
+
value: boolean;
|
|
1084
|
+
source: string;
|
|
1085
|
+
};
|
|
1086
|
+
setConfig(value: boolean): void;
|
|
1087
|
+
};
|
|
1073
1088
|
};
|
|
1074
1089
|
validColorSpaces: readonly ["default", "bt709", "bt2020-ncl"];
|
|
1075
1090
|
optionsMap: {
|