@remotion/renderer 4.0.446 → 4.0.448
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/apply-tone-frequency.d.ts +2 -1
- package/dist/assets/apply-tone-frequency.js +3 -4
- package/dist/assets/download-map.d.ts +1 -1
- package/dist/assets/download-map.js +2 -2
- package/dist/assets/inline-audio-mixing.d.ts +3 -2
- package/dist/assets/inline-audio-mixing.js +9 -9
- package/dist/check-version-requirements.js +21 -0
- package/dist/client.d.ts +96 -0
- package/dist/combine-audio.d.ts +4 -3
- package/dist/combine-audio.js +14 -12
- package/dist/combine-chunks.d.ts +2 -1
- package/dist/combine-chunks.js +4 -2
- package/dist/create-audio.d.ts +2 -1
- package/dist/create-audio.js +4 -1
- package/dist/create-silent-audio.d.ts +2 -1
- package/dist/create-silent-audio.js +3 -4
- package/dist/esm/client.mjs +885 -799
- package/dist/esm/error-handling.mjs +4 -0
- package/dist/esm/index.mjs +191 -112
- package/dist/get-compositions.js +4 -1
- package/dist/get-extra-frames-to-capture.d.ts +2 -1
- package/dist/get-extra-frames-to-capture.js +5 -5
- package/dist/index.d.ts +22 -3
- package/dist/make-page.d.ts +2 -1
- package/dist/make-page.js +5 -2
- package/dist/merge-audio-track.d.ts +1 -0
- package/dist/merge-audio-track.js +4 -1
- package/dist/options/allow-html-in-canvas.d.ts +16 -0
- package/dist/options/allow-html-in-canvas.js +31 -0
- package/dist/options/index.d.ts +32 -0
- package/dist/options/index.js +4 -0
- package/dist/options/options-map.d.ts +64 -0
- package/dist/options/options-map.js +5 -0
- package/dist/options/public-license-key.js +1 -1
- package/dist/options/sample-rate.d.ts +16 -0
- package/dist/options/sample-rate.js +34 -0
- package/dist/prepare-server.d.ts +2 -1
- package/dist/prepare-server.js +2 -2
- package/dist/preprocess-audio-track.d.ts +1 -0
- package/dist/preprocess-audio-track.js +3 -3
- package/dist/print-useful-error-message.js +4 -0
- package/dist/render-frames.d.ts +1 -0
- package/dist/render-frames.js +9 -3
- package/dist/render-media.d.ts +1 -1
- package/dist/render-media.js +7 -3
- package/dist/render-still.js +5 -1
- package/dist/select-composition.js +4 -1
- package/dist/set-props-and-env.d.ts +1 -0
- package/dist/set-props-and-env.js +7 -3
- package/dist/stitch-frames-to-video.d.ts +3 -1
- package/dist/stitch-frames-to-video.js +4 -2
- package/dist/stringify-ffmpeg-filter.d.ts +2 -1
- package/dist/stringify-ffmpeg-filter.js +4 -5
- package/package.json +13 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CancelSignal } from '../make-cancel-signal';
|
|
2
|
-
export declare const applyToneFrequencyUsingFfmpeg: ({ input, output, toneFrequency, indent, logLevel, binariesDirectory, cancelSignal, }: {
|
|
2
|
+
export declare const applyToneFrequencyUsingFfmpeg: ({ input, output, toneFrequency, indent, logLevel, binariesDirectory, cancelSignal, sampleRate, }: {
|
|
3
3
|
input: string;
|
|
4
4
|
output: string;
|
|
5
5
|
toneFrequency: number;
|
|
@@ -7,4 +7,5 @@ export declare const applyToneFrequencyUsingFfmpeg: ({ input, output, toneFreque
|
|
|
7
7
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
8
8
|
binariesDirectory: string | null;
|
|
9
9
|
cancelSignal: CancelSignal | undefined;
|
|
10
|
+
sampleRate: number;
|
|
10
11
|
}) => Promise<void>;
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applyToneFrequencyUsingFfmpeg = void 0;
|
|
4
4
|
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
5
5
|
const logger_1 = require("../logger");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const filter = `asetrate=${sample_rate_1.DEFAULT_SAMPLE_RATE}*${toneFrequency},aresample=${sample_rate_1.DEFAULT_SAMPLE_RATE},atempo=1/${toneFrequency}`;
|
|
6
|
+
const applyToneFrequencyUsingFfmpeg = async ({ input, output, toneFrequency, indent, logLevel, binariesDirectory, cancelSignal, sampleRate, }) => {
|
|
7
|
+
const filter = `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}`;
|
|
9
8
|
const args = [
|
|
10
9
|
'-hide_banner',
|
|
11
10
|
'-i',
|
|
@@ -14,7 +13,7 @@ const applyToneFrequencyUsingFfmpeg = async ({ input, output, toneFrequency, ind
|
|
|
14
13
|
'-filter:a',
|
|
15
14
|
filter,
|
|
16
15
|
['-c:a', 'pcm_s16le'],
|
|
17
|
-
['-ar', String(
|
|
16
|
+
['-ar', String(sampleRate)],
|
|
18
17
|
'-y',
|
|
19
18
|
output,
|
|
20
19
|
].flat(2);
|
|
@@ -52,5 +52,5 @@ export type RenderAssetInfo = {
|
|
|
52
52
|
forSeamlessAacConcatenation: boolean;
|
|
53
53
|
};
|
|
54
54
|
export declare const makeAndReturn: (dir: string, name: string) => string;
|
|
55
|
-
export declare const makeDownloadMap: () => DownloadMap;
|
|
55
|
+
export declare const makeDownloadMap: (sampleRate: number) => DownloadMap;
|
|
56
56
|
export declare const cleanDownloadMap: (downloadMap: DownloadMap) => void;
|
|
@@ -17,7 +17,7 @@ const makeAndReturn = (dir, name) => {
|
|
|
17
17
|
return p;
|
|
18
18
|
};
|
|
19
19
|
exports.makeAndReturn = makeAndReturn;
|
|
20
|
-
const makeDownloadMap = () => {
|
|
20
|
+
const makeDownloadMap = (sampleRate) => {
|
|
21
21
|
const dir = (0, tmp_dir_1.tmpDir)(`remotion-v${version_1.VERSION}-assets`);
|
|
22
22
|
let prevented = false;
|
|
23
23
|
return {
|
|
@@ -45,7 +45,7 @@ const makeDownloadMap = () => {
|
|
|
45
45
|
isPreventedFromCleanup: () => {
|
|
46
46
|
return prevented;
|
|
47
47
|
},
|
|
48
|
-
inlineAudioMixing: (0, inline_audio_mixing_1.makeInlineAudioMixing)(dir),
|
|
48
|
+
inlineAudioMixing: (0, inline_audio_mixing_1.makeInlineAudioMixing)(dir, sampleRate),
|
|
49
49
|
cleanupController: new AbortController(),
|
|
50
50
|
};
|
|
51
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InlineAudioAsset } from 'remotion/no-react';
|
|
2
2
|
import type { CancelSignal } from '../make-cancel-signal';
|
|
3
|
-
export declare const makeInlineAudioMixing: (dir: string) => {
|
|
3
|
+
export declare const makeInlineAudioMixing: (dir: string, sampleRate: number) => {
|
|
4
4
|
cleanup: () => void;
|
|
5
5
|
addAsset: ({ asset, fps, totalNumberOfFrames, firstFrame, trimLeftOffset, trimRightOffset, }: {
|
|
6
6
|
asset: InlineAudioAsset;
|
|
@@ -11,11 +11,12 @@ export declare const makeInlineAudioMixing: (dir: string) => {
|
|
|
11
11
|
trimRightOffset: number;
|
|
12
12
|
}) => void;
|
|
13
13
|
getListOfAssets: () => string[];
|
|
14
|
-
finish: ({ binariesDirectory, indent, logLevel, cancelSignal, }: {
|
|
14
|
+
finish: ({ binariesDirectory, indent, logLevel, cancelSignal, sampleRate: finishSampleRate, }: {
|
|
15
15
|
indent: boolean;
|
|
16
16
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
17
17
|
binariesDirectory: string | null;
|
|
18
18
|
cancelSignal: CancelSignal | undefined;
|
|
19
|
+
sampleRate: number;
|
|
19
20
|
}) => Promise<void>;
|
|
20
21
|
};
|
|
21
22
|
export type InlineAudioMixing = ReturnType<typeof makeInlineAudioMixing>;
|
|
@@ -40,7 +40,6 @@ exports.makeInlineAudioMixing = void 0;
|
|
|
40
40
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
41
41
|
const node_path_1 = __importDefault(require("node:path"));
|
|
42
42
|
const delete_directory_1 = require("../delete-directory");
|
|
43
|
-
const sample_rate_1 = require("../sample-rate");
|
|
44
43
|
const apply_tone_frequency_1 = require("./apply-tone-frequency");
|
|
45
44
|
const download_map_1 = require("./download-map");
|
|
46
45
|
const numberTo32BiIntLittleEndian = (num) => {
|
|
@@ -70,7 +69,7 @@ const correctFloatingPointError = (value) => {
|
|
|
70
69
|
const BIT_DEPTH = 16;
|
|
71
70
|
const BYTES_PER_SAMPLE = BIT_DEPTH / 8;
|
|
72
71
|
const NUMBER_OF_CHANNELS = 2;
|
|
73
|
-
const makeInlineAudioMixing = (dir) => {
|
|
72
|
+
const makeInlineAudioMixing = (dir, sampleRate) => {
|
|
74
73
|
const folderToAdd = (0, download_map_1.makeAndReturn)(dir, 'remotion-inline-audio-mixing');
|
|
75
74
|
// asset id -> file descriptor
|
|
76
75
|
const openFiles = {};
|
|
@@ -102,7 +101,7 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
102
101
|
writtenHeaders[filePath] = true;
|
|
103
102
|
const expectedDataSize = Math.round((totalNumberOfFrames / fps - trimLeftOffset + trimRightOffset) *
|
|
104
103
|
NUMBER_OF_CHANNELS *
|
|
105
|
-
|
|
104
|
+
sampleRate *
|
|
106
105
|
BYTES_PER_SAMPLE);
|
|
107
106
|
const expectedSize = 40 + expectedDataSize;
|
|
108
107
|
const fd = openFiles[filePath];
|
|
@@ -113,14 +112,14 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
113
112
|
(0, node_fs_1.writeSync)(fd, new Uint8Array([BIT_DEPTH, 0x00, 0x00, 0x00]), 0, 4, 16); // fmt chunk size = 16
|
|
114
113
|
(0, node_fs_1.writeSync)(fd, new Uint8Array([0x01, 0x00]), 0, 2, 20); // Audio format (PCM) = 1, set 3 if float32 would be true
|
|
115
114
|
(0, node_fs_1.writeSync)(fd, new Uint8Array([NUMBER_OF_CHANNELS, 0x00]), 0, 2, 22); // Number of channels
|
|
116
|
-
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo32BiIntLittleEndian(
|
|
117
|
-
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo32BiIntLittleEndian(
|
|
115
|
+
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate)), 0, 4, 24); // Sample rate
|
|
116
|
+
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 4, 28); // Byte rate
|
|
118
117
|
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo16BitLittleEndian(NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 2, 32); // Block align
|
|
119
118
|
(0, node_fs_1.writeSync)(fd, numberTo16BitLittleEndian(BIT_DEPTH), 0, 2, 34); // Bits per sample
|
|
120
119
|
(0, node_fs_1.writeSync)(fd, new Uint8Array([0x64, 0x61, 0x74, 0x61]), 0, 4, 36); // "data"
|
|
121
120
|
(0, node_fs_1.writeSync)(fd, new Uint8Array(numberTo32BiIntLittleEndian(expectedDataSize)), 0, 4, 40); // Remaining size
|
|
122
121
|
};
|
|
123
|
-
const finish = async ({ binariesDirectory, indent, logLevel, cancelSignal, }) => {
|
|
122
|
+
const finish = async ({ binariesDirectory, indent, logLevel, cancelSignal, sampleRate: finishSampleRate, }) => {
|
|
124
123
|
for (const fd of Object.keys(openFiles)) {
|
|
125
124
|
const frequency = toneFrequencies[fd];
|
|
126
125
|
if (frequency !== 1) {
|
|
@@ -133,6 +132,7 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
133
132
|
logLevel,
|
|
134
133
|
binariesDirectory,
|
|
135
134
|
cancelSignal,
|
|
135
|
+
sampleRate: finishSampleRate,
|
|
136
136
|
});
|
|
137
137
|
node_fs_1.default.renameSync(tmpFile, fd);
|
|
138
138
|
}
|
|
@@ -156,8 +156,8 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
156
156
|
let arr = new Int16Array(asset.audio);
|
|
157
157
|
const isFirst = asset.frame === firstFrame;
|
|
158
158
|
const isLast = asset.frame === totalNumberOfFrames + firstFrame - 1;
|
|
159
|
-
const samplesToShaveFromStart = trimLeftOffset *
|
|
160
|
-
const samplesToShaveFromEnd = trimRightOffset *
|
|
159
|
+
const samplesToShaveFromStart = trimLeftOffset * sampleRate;
|
|
160
|
+
const samplesToShaveFromEnd = trimRightOffset * sampleRate;
|
|
161
161
|
// Higher tolerance is needed for floating point videos
|
|
162
162
|
// Rendering https://github.com/remotion-dev/remotion/pull/5920 in native frame rate
|
|
163
163
|
// could hit this case
|
|
@@ -175,7 +175,7 @@ const makeInlineAudioMixing = (dir) => {
|
|
|
175
175
|
// In @remotion/media, we also round down the sample start timestamp and round up the end timestamp
|
|
176
176
|
// This might lead to overlapping, hopefully aligning perfectly!
|
|
177
177
|
// Test case: https://github.com/remotion-dev/remotion/issues/5758
|
|
178
|
-
const position = Math.floor(correctFloatingPointError(positionInSeconds *
|
|
178
|
+
const position = Math.floor(correctFloatingPointError(positionInSeconds * sampleRate)) *
|
|
179
179
|
NUMBER_OF_CHANNELS *
|
|
180
180
|
BYTES_PER_SAMPLE;
|
|
181
181
|
(0, node_fs_1.writeSync)(
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.checkRuntimeVersion = exports.gLibCErrorMessage = void 0;
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
4
8
|
const no_react_1 = require("remotion/no-react");
|
|
5
9
|
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
6
10
|
const logger_1 = require("./logger");
|
|
@@ -70,6 +74,22 @@ const checkBunVersion = () => {
|
|
|
70
74
|
throw new Error(`Remotion requires at least Bun ${no_react_1.NoReactInternals.MIN_BUN_VERSION}. You currently have ${Bun.version}. Update your Bun version to ${no_react_1.NoReactInternals.MIN_BUN_VERSION} to use Remotion.`);
|
|
71
75
|
}
|
|
72
76
|
};
|
|
77
|
+
// Darwin kernel major version 22 = macOS 13 (Ventura)
|
|
78
|
+
const MIN_DARWIN_VERSION = 22;
|
|
79
|
+
const MIN_MACOS_DISPLAY_VERSION = '13 (Ventura)';
|
|
80
|
+
const checkMacOSVersion = (logLevel, indent) => {
|
|
81
|
+
if (process.platform !== 'darwin') {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const darwinRelease = node_os_1.default.release();
|
|
85
|
+
const majorVersion = Number(darwinRelease.split('.')[0]);
|
|
86
|
+
if (Number.isNaN(majorVersion)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (majorVersion < MIN_DARWIN_VERSION) {
|
|
90
|
+
logger_1.Log.warn({ logLevel, indent }, `Your macOS version is older than macOS ${MIN_MACOS_DISPLAY_VERSION}. Some features such as rendering may not work.`);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
73
93
|
const checkRuntimeVersion = (logLevel, indent) => {
|
|
74
94
|
if (typeof Bun === 'undefined') {
|
|
75
95
|
checkNodeVersion();
|
|
@@ -77,6 +97,7 @@ const checkRuntimeVersion = (logLevel, indent) => {
|
|
|
77
97
|
else {
|
|
78
98
|
checkBunVersion();
|
|
79
99
|
}
|
|
100
|
+
checkMacOSVersion(logLevel, indent);
|
|
80
101
|
checkLibCRequirement(logLevel, indent);
|
|
81
102
|
};
|
|
82
103
|
exports.checkRuntimeVersion = checkRuntimeVersion;
|
package/dist/client.d.ts
CHANGED
|
@@ -246,6 +246,22 @@ export declare const BrowserSafeApis: {
|
|
|
246
246
|
separateAudioTo: string | null;
|
|
247
247
|
}) => void;
|
|
248
248
|
options: {
|
|
249
|
+
allowHtmlInCanvasOption: {
|
|
250
|
+
name: string;
|
|
251
|
+
cliFlag: "allow-html-in-canvas";
|
|
252
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
253
|
+
ssrName: null;
|
|
254
|
+
docLink: string;
|
|
255
|
+
type: boolean;
|
|
256
|
+
getValue: ({ commandLine }: {
|
|
257
|
+
commandLine: Record<string, unknown>;
|
|
258
|
+
}) => {
|
|
259
|
+
value: boolean;
|
|
260
|
+
source: string;
|
|
261
|
+
};
|
|
262
|
+
setConfig(value: boolean): void;
|
|
263
|
+
id: "allow-html-in-canvas";
|
|
264
|
+
};
|
|
249
265
|
audioCodecOption: {
|
|
250
266
|
cliFlag: "audio-codec";
|
|
251
267
|
setConfig: (audioCodec: "aac" | "mp3" | "opus" | "pcm-16" | null) => void;
|
|
@@ -1582,6 +1598,22 @@ export declare const BrowserSafeApis: {
|
|
|
1582
1598
|
type: string | null;
|
|
1583
1599
|
id: "package-manager";
|
|
1584
1600
|
};
|
|
1601
|
+
sampleRateOption: {
|
|
1602
|
+
name: string;
|
|
1603
|
+
cliFlag: "sample-rate";
|
|
1604
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
1605
|
+
ssrName: "sampleRate";
|
|
1606
|
+
docLink: string;
|
|
1607
|
+
type: number;
|
|
1608
|
+
getValue: ({ commandLine }: {
|
|
1609
|
+
commandLine: Record<string, unknown>;
|
|
1610
|
+
}, compositionSampleRate?: number | null | undefined) => {
|
|
1611
|
+
value: number;
|
|
1612
|
+
source: string;
|
|
1613
|
+
};
|
|
1614
|
+
setConfig: (value: number) => void;
|
|
1615
|
+
id: "sample-rate";
|
|
1616
|
+
};
|
|
1585
1617
|
webpackPollOption: {
|
|
1586
1618
|
name: string;
|
|
1587
1619
|
cliFlag: "webpack-poll";
|
|
@@ -2204,6 +2236,22 @@ export declare const BrowserSafeApis: {
|
|
|
2204
2236
|
setConfig: (value: string | null) => void;
|
|
2205
2237
|
id: "license-key";
|
|
2206
2238
|
};
|
|
2239
|
+
readonly sampleRate: {
|
|
2240
|
+
name: string;
|
|
2241
|
+
cliFlag: "sample-rate";
|
|
2242
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
2243
|
+
ssrName: "sampleRate";
|
|
2244
|
+
docLink: string;
|
|
2245
|
+
type: number;
|
|
2246
|
+
getValue: ({ commandLine }: {
|
|
2247
|
+
commandLine: Record<string, unknown>;
|
|
2248
|
+
}, compositionSampleRate?: number | null | undefined) => {
|
|
2249
|
+
value: number;
|
|
2250
|
+
source: string;
|
|
2251
|
+
};
|
|
2252
|
+
setConfig: (value: number) => void;
|
|
2253
|
+
id: "sample-rate";
|
|
2254
|
+
};
|
|
2207
2255
|
};
|
|
2208
2256
|
readonly stitchFramesToVideo: {
|
|
2209
2257
|
readonly separateAudioTo: {
|
|
@@ -2876,6 +2924,22 @@ export declare const BrowserSafeApis: {
|
|
|
2876
2924
|
setConfig: (pattern: string | null) => void;
|
|
2877
2925
|
id: "image-sequence-pattern";
|
|
2878
2926
|
};
|
|
2927
|
+
readonly sampleRate: {
|
|
2928
|
+
name: string;
|
|
2929
|
+
cliFlag: "sample-rate";
|
|
2930
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
2931
|
+
ssrName: "sampleRate";
|
|
2932
|
+
docLink: string;
|
|
2933
|
+
type: number;
|
|
2934
|
+
getValue: ({ commandLine }: {
|
|
2935
|
+
commandLine: Record<string, unknown>;
|
|
2936
|
+
}, compositionSampleRate?: number | null | undefined) => {
|
|
2937
|
+
value: number;
|
|
2938
|
+
source: string;
|
|
2939
|
+
};
|
|
2940
|
+
setConfig: (value: number) => void;
|
|
2941
|
+
id: "sample-rate";
|
|
2942
|
+
};
|
|
2879
2943
|
};
|
|
2880
2944
|
readonly renderMediaOnLambda: {
|
|
2881
2945
|
readonly mediaCacheSizeInBytes: {
|
|
@@ -3180,6 +3244,22 @@ export declare const BrowserSafeApis: {
|
|
|
3180
3244
|
setConfig: (value: string | null) => void;
|
|
3181
3245
|
id: "license-key";
|
|
3182
3246
|
};
|
|
3247
|
+
readonly sampleRate: {
|
|
3248
|
+
name: string;
|
|
3249
|
+
cliFlag: "sample-rate";
|
|
3250
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
3251
|
+
ssrName: "sampleRate";
|
|
3252
|
+
docLink: string;
|
|
3253
|
+
type: number;
|
|
3254
|
+
getValue: ({ commandLine }: {
|
|
3255
|
+
commandLine: Record<string, unknown>;
|
|
3256
|
+
}, compositionSampleRate?: number | null | undefined) => {
|
|
3257
|
+
value: number;
|
|
3258
|
+
source: string;
|
|
3259
|
+
};
|
|
3260
|
+
setConfig: (value: number) => void;
|
|
3261
|
+
id: "sample-rate";
|
|
3262
|
+
};
|
|
3183
3263
|
};
|
|
3184
3264
|
readonly renderStillOnLambda: {
|
|
3185
3265
|
readonly mediaCacheSizeInBytes: {
|
|
@@ -3746,6 +3826,22 @@ export declare const BrowserSafeApis: {
|
|
|
3746
3826
|
};
|
|
3747
3827
|
id: "jpeg-quality";
|
|
3748
3828
|
};
|
|
3829
|
+
readonly sampleRate: {
|
|
3830
|
+
name: string;
|
|
3831
|
+
cliFlag: "sample-rate";
|
|
3832
|
+
description: () => import("react/jsx-runtime").JSX.Element;
|
|
3833
|
+
ssrName: "sampleRate";
|
|
3834
|
+
docLink: string;
|
|
3835
|
+
type: number;
|
|
3836
|
+
getValue: ({ commandLine }: {
|
|
3837
|
+
commandLine: Record<string, unknown>;
|
|
3838
|
+
}, compositionSampleRate?: number | null | undefined) => {
|
|
3839
|
+
value: number;
|
|
3840
|
+
source: string;
|
|
3841
|
+
};
|
|
3842
|
+
setConfig: (value: number) => void;
|
|
3843
|
+
id: "sample-rate";
|
|
3844
|
+
};
|
|
3749
3845
|
};
|
|
3750
3846
|
readonly renderStillOnCloudRun: {
|
|
3751
3847
|
readonly mediaCacheSizeInBytes: {
|
package/dist/combine-audio.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CancelSignal } from './make-cancel-signal';
|
|
2
|
-
export declare const durationOf1Frame: number;
|
|
3
|
-
export declare const getClosestAlignedTime: (targetTime: number) => number;
|
|
4
|
-
export declare const createCombinedAudio: ({ seamless, filelistDir, files, indent, logLevel, audioBitrate, resolvedAudioCodec, output, chunkDurationInSeconds, addRemotionMetadata, binariesDirectory, fps, cancelSignal, onProgress, }: {
|
|
2
|
+
export declare const durationOf1Frame: (sampleRate: number) => number;
|
|
3
|
+
export declare const getClosestAlignedTime: (targetTime: number, sampleRate: number) => number;
|
|
4
|
+
export declare const createCombinedAudio: ({ seamless, filelistDir, files, indent, logLevel, audioBitrate, resolvedAudioCodec, output, chunkDurationInSeconds, addRemotionMetadata, binariesDirectory, fps, cancelSignal, onProgress, sampleRate, }: {
|
|
5
5
|
seamless: boolean;
|
|
6
6
|
filelistDir: string;
|
|
7
7
|
files: string[];
|
|
@@ -16,4 +16,5 @@ export declare const createCombinedAudio: ({ seamless, filelistDir, files, inden
|
|
|
16
16
|
fps: number;
|
|
17
17
|
cancelSignal: CancelSignal | undefined;
|
|
18
18
|
onProgress: (frames: number) => void;
|
|
19
|
+
sampleRate: number;
|
|
19
20
|
}) => Promise<string>;
|
package/dist/combine-audio.js
CHANGED
|
@@ -8,9 +8,9 @@ const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
|
8
8
|
const logger_1 = require("./logger");
|
|
9
9
|
const audio_codec_1 = require("./options/audio-codec");
|
|
10
10
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
11
|
-
const sample_rate_1 = require("./sample-rate");
|
|
12
11
|
const truthy_1 = require("./truthy");
|
|
13
|
-
|
|
12
|
+
const durationOf1Frame = (sampleRate) => (1024 / sampleRate) * 1000000;
|
|
13
|
+
exports.durationOf1Frame = durationOf1Frame;
|
|
14
14
|
const roundWithFix = (targetTime) => {
|
|
15
15
|
// Round values where the fractional part is > 0.4999999 up to the next integer,
|
|
16
16
|
// otherwise round down. This addresses floating-point precision issues that can
|
|
@@ -20,10 +20,11 @@ const roundWithFix = (targetTime) => {
|
|
|
20
20
|
}
|
|
21
21
|
return Math.floor(targetTime);
|
|
22
22
|
};
|
|
23
|
-
const getClosestAlignedTime = (targetTime) => {
|
|
24
|
-
const
|
|
23
|
+
const getClosestAlignedTime = (targetTime, sampleRate) => {
|
|
24
|
+
const dur = (0, exports.durationOf1Frame)(sampleRate);
|
|
25
|
+
const decimalFramesToTargetTime = (targetTime * 1000000) / dur;
|
|
25
26
|
const nearestFrameIndexForTargetTime = roundWithFix(decimalFramesToTargetTime);
|
|
26
|
-
return (nearestFrameIndexForTargetTime *
|
|
27
|
+
return (nearestFrameIndexForTargetTime * dur) / 1000000;
|
|
27
28
|
};
|
|
28
29
|
exports.getClosestAlignedTime = getClosestAlignedTime;
|
|
29
30
|
const encodeAudio = async ({ files, resolvedAudioCodec, audioBitrate, filelistDir, output, indent, logLevel, addRemotionMetadata, fps, binariesDirectory, cancelSignal, onProgress, }) => {
|
|
@@ -82,7 +83,7 @@ const encodeAudio = async ({ files, resolvedAudioCodec, audioBitrate, filelistDi
|
|
|
82
83
|
throw e;
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
|
-
const combineAudioSeamlessly = async ({ files, filelistDir, indent, logLevel, output, chunkDurationInSeconds, addRemotionMetadata, fps, binariesDirectory, cancelSignal, onProgress, }) => {
|
|
86
|
+
const combineAudioSeamlessly = async ({ files, filelistDir, indent, logLevel, output, chunkDurationInSeconds, addRemotionMetadata, fps, binariesDirectory, cancelSignal, onProgress, sampleRate, }) => {
|
|
86
87
|
var _a;
|
|
87
88
|
const startConcatenating = Date.now();
|
|
88
89
|
const fileList = files
|
|
@@ -90,8 +91,8 @@ const combineAudioSeamlessly = async ({ files, filelistDir, indent, logLevel, ou
|
|
|
90
91
|
const isLast = i === files.length - 1;
|
|
91
92
|
const targetStart = i * chunkDurationInSeconds;
|
|
92
93
|
const endStart = (i + 1) * chunkDurationInSeconds;
|
|
93
|
-
const startTime = (0, exports.getClosestAlignedTime)(targetStart) * 1000000;
|
|
94
|
-
const endTime = (0, exports.getClosestAlignedTime)(endStart) * 1000000;
|
|
94
|
+
const startTime = (0, exports.getClosestAlignedTime)(targetStart, sampleRate) * 1000000;
|
|
95
|
+
const endTime = (0, exports.getClosestAlignedTime)(endStart, sampleRate) * 1000000;
|
|
95
96
|
const realDuration = endTime - startTime;
|
|
96
97
|
let inpoint = 0;
|
|
97
98
|
if (i > 0) {
|
|
@@ -99,14 +100,14 @@ const combineAudioSeamlessly = async ({ files, filelistDir, indent, logLevel, ou
|
|
|
99
100
|
// additional 2 frames of silence at the start of the segment. When we slice out
|
|
100
101
|
// our real data with inpoint and outpoint, we'll want remove both the silence
|
|
101
102
|
// and the extra frames we asked for.
|
|
102
|
-
inpoint = exports.durationOf1Frame * 4;
|
|
103
|
+
inpoint = (0, exports.durationOf1Frame)(sampleRate) * 4;
|
|
103
104
|
}
|
|
104
105
|
// inpoint is inclusive and outpoint is exclusive. To avoid overlap, we subtract
|
|
105
106
|
// the duration of one frame from the outpoint.
|
|
106
107
|
// we don't have to subtract a frame if this is the last segment.
|
|
107
|
-
const outpoint = (i === 0 ? exports.durationOf1Frame * 2 : inpoint) +
|
|
108
|
+
const outpoint = (i === 0 ? (0, exports.durationOf1Frame)(sampleRate) * 2 : inpoint) +
|
|
108
109
|
realDuration -
|
|
109
|
-
(isLast ? 0 : exports.durationOf1Frame);
|
|
110
|
+
(isLast ? 0 : (0, exports.durationOf1Frame)(sampleRate));
|
|
110
111
|
return [`file '${p}'`, `inpoint ${inpoint}us`, `outpoint ${outpoint}us`]
|
|
111
112
|
.filter(truthy_1.truthy)
|
|
112
113
|
.join('\n');
|
|
@@ -158,7 +159,7 @@ const combineAudioSeamlessly = async ({ files, filelistDir, indent, logLevel, ou
|
|
|
158
159
|
throw e;
|
|
159
160
|
}
|
|
160
161
|
};
|
|
161
|
-
const createCombinedAudio = ({ seamless, filelistDir, files, indent, logLevel, audioBitrate, resolvedAudioCodec, output, chunkDurationInSeconds, addRemotionMetadata, binariesDirectory, fps, cancelSignal, onProgress, }) => {
|
|
162
|
+
const createCombinedAudio = ({ seamless, filelistDir, files, indent, logLevel, audioBitrate, resolvedAudioCodec, output, chunkDurationInSeconds, addRemotionMetadata, binariesDirectory, fps, cancelSignal, onProgress, sampleRate, }) => {
|
|
162
163
|
if (seamless) {
|
|
163
164
|
return combineAudioSeamlessly({
|
|
164
165
|
filelistDir,
|
|
@@ -172,6 +173,7 @@ const createCombinedAudio = ({ seamless, filelistDir, files, indent, logLevel, a
|
|
|
172
173
|
fps,
|
|
173
174
|
cancelSignal,
|
|
174
175
|
onProgress,
|
|
176
|
+
sampleRate,
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
return encodeAudio({
|
package/dist/combine-chunks.d.ts
CHANGED
|
@@ -29,9 +29,10 @@ type OptionalCombineChunksOptions = {
|
|
|
29
29
|
metadata: Record<string, string> | null;
|
|
30
30
|
frameRange: FrameRange | null;
|
|
31
31
|
everyNthFrame: number;
|
|
32
|
+
sampleRate: number;
|
|
32
33
|
};
|
|
33
34
|
export type CombineChunksOptions = MandatoryCombineChunksOptions & Partial<OptionalCombineChunksOptions>;
|
|
34
|
-
export declare const internalCombineChunks: ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, }: MandatoryCombineChunksOptions & OptionalCombineChunksOptions & {
|
|
35
|
+
export declare const internalCombineChunks: ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, }: MandatoryCombineChunksOptions & OptionalCombineChunksOptions & {
|
|
35
36
|
indent: boolean;
|
|
36
37
|
}) => Promise<void>;
|
|
37
38
|
export declare const combineChunks: (options: CombineChunksOptions) => Promise<void>;
|
package/dist/combine-chunks.js
CHANGED
|
@@ -33,7 +33,7 @@ const codecSupportsFastStart = {
|
|
|
33
33
|
wav: false,
|
|
34
34
|
};
|
|
35
35
|
const REMOTION_FILELIST_TOKEN = 'remotion-filelist';
|
|
36
|
-
const internalCombineChunks = async ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, }) => {
|
|
36
|
+
const internalCombineChunks = async ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, }) => {
|
|
37
37
|
(0, validate_number_of_gif_loops_1.validateNumberOfGifLoops)(numberOfGifLoops, codec);
|
|
38
38
|
const filelistDir = (0, tmp_dir_1.tmpDir)(REMOTION_FILELIST_TOKEN);
|
|
39
39
|
const shouldCreateVideo = !(0, is_audio_codec_1.isAudioCodec)(codec);
|
|
@@ -97,6 +97,7 @@ const internalCombineChunks = async ({ outputLocation: output, onProgress, codec
|
|
|
97
97
|
concatenatedAudio = frames;
|
|
98
98
|
updateProgress();
|
|
99
99
|
},
|
|
100
|
+
sampleRate,
|
|
100
101
|
})
|
|
101
102
|
: null,
|
|
102
103
|
shouldCreateVideo && !seamlessVideo && videoOutput
|
|
@@ -149,7 +150,7 @@ const internalCombineChunks = async ({ outputLocation: output, onProgress, codec
|
|
|
149
150
|
};
|
|
150
151
|
exports.internalCombineChunks = internalCombineChunks;
|
|
151
152
|
const combineChunks = (options) => {
|
|
152
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
153
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
153
154
|
return (0, exports.internalCombineChunks)({
|
|
154
155
|
audioBitrate: (_a = options.audioBitrate) !== null && _a !== void 0 ? _a : null,
|
|
155
156
|
numberOfGifLoops: (_b = options.numberOfGifLoops) !== null && _b !== void 0 ? _b : null,
|
|
@@ -170,6 +171,7 @@ const combineChunks = (options) => {
|
|
|
170
171
|
everyNthFrame: (_h = options.everyNthFrame) !== null && _h !== void 0 ? _h : 1,
|
|
171
172
|
frameRange: (_j = options.frameRange) !== null && _j !== void 0 ? _j : null,
|
|
172
173
|
compositionDurationInFrames: options.compositionDurationInFrames,
|
|
174
|
+
sampleRate: (_k = options.sampleRate) !== null && _k !== void 0 ? _k : 48000,
|
|
173
175
|
});
|
|
174
176
|
};
|
|
175
177
|
exports.combineChunks = combineChunks;
|
package/dist/create-audio.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type SeamlessAudioInfo = {
|
|
|
7
7
|
trimLeftOffset: number;
|
|
8
8
|
trimRightOffset: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const createAudio: ({ assets, onDownload, fps, logLevel, onProgress, downloadMap, remotionRoot, indent, binariesDirectory, audioBitrate, audioCodec, cancelSignal, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, }: {
|
|
10
|
+
export declare const createAudio: ({ assets, onDownload, fps, logLevel, onProgress, downloadMap, remotionRoot, indent, binariesDirectory, audioBitrate, audioCodec, cancelSignal, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, sampleRate, }: {
|
|
11
11
|
assets: FrameAndAssets[];
|
|
12
12
|
onDownload: RenderMediaOnDownload | undefined;
|
|
13
13
|
fps: number;
|
|
@@ -24,4 +24,5 @@ export declare const createAudio: ({ assets, onDownload, fps, logLevel, onProgre
|
|
|
24
24
|
trimLeftOffset: number;
|
|
25
25
|
trimRightOffset: number;
|
|
26
26
|
forSeamlessAacConcatenation: boolean;
|
|
27
|
+
sampleRate: number;
|
|
27
28
|
}) => Promise<string>;
|
package/dist/create-audio.js
CHANGED
|
@@ -15,7 +15,7 @@ const merge_audio_track_1 = require("./merge-audio-track");
|
|
|
15
15
|
const audio_codec_1 = require("./options/audio-codec");
|
|
16
16
|
const preprocess_audio_track_1 = require("./preprocess-audio-track");
|
|
17
17
|
const truthy_1 = require("./truthy");
|
|
18
|
-
const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, downloadMap, remotionRoot, indent, binariesDirectory, audioBitrate, audioCodec, cancelSignal, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, }) => {
|
|
18
|
+
const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, downloadMap, remotionRoot, indent, binariesDirectory, audioBitrate, audioCodec, cancelSignal, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, sampleRate, }) => {
|
|
19
19
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
20
20
|
assets,
|
|
21
21
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
@@ -59,6 +59,7 @@ const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, down
|
|
|
59
59
|
trimRightOffset,
|
|
60
60
|
forSeamlessAacConcatenation,
|
|
61
61
|
audioStreamIndex: asset.audioStreamIndex,
|
|
62
|
+
sampleRate,
|
|
62
63
|
});
|
|
63
64
|
preprocessProgress[index] = 1;
|
|
64
65
|
updateProgress();
|
|
@@ -69,6 +70,7 @@ const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, down
|
|
|
69
70
|
logLevel,
|
|
70
71
|
binariesDirectory,
|
|
71
72
|
cancelSignal,
|
|
73
|
+
sampleRate,
|
|
72
74
|
});
|
|
73
75
|
const inlinedAudio = downloadMap.inlineAudioMixing.getListOfAssets();
|
|
74
76
|
const preprocessed = [
|
|
@@ -100,6 +102,7 @@ const createAudio = async ({ assets, onDownload, fps, logLevel, onProgress, down
|
|
|
100
102
|
updateProgress();
|
|
101
103
|
},
|
|
102
104
|
chunkLengthInSeconds,
|
|
105
|
+
sampleRate,
|
|
103
106
|
});
|
|
104
107
|
await (0, compress_audio_1.compressAudio)({
|
|
105
108
|
audioBitrate,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { CancelSignal } from './make-cancel-signal';
|
|
2
|
-
export declare const createSilentAudio: ({ outName, indent, logLevel, binariesDirectory, cancelSignal, chunkLengthInSeconds, }: {
|
|
2
|
+
export declare const createSilentAudio: ({ outName, indent, logLevel, binariesDirectory, cancelSignal, chunkLengthInSeconds, sampleRate, }: {
|
|
3
3
|
chunkLengthInSeconds: number;
|
|
4
4
|
outName: string;
|
|
5
5
|
indent: boolean;
|
|
6
6
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
7
7
|
binariesDirectory: string | null;
|
|
8
8
|
cancelSignal: CancelSignal | undefined;
|
|
9
|
+
sampleRate: number;
|
|
9
10
|
}) => Promise<void>;
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSilentAudio = void 0;
|
|
4
4
|
const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
5
|
-
const
|
|
6
|
-
const createSilentAudio = async ({ outName, indent, logLevel, binariesDirectory, cancelSignal, chunkLengthInSeconds, }) => {
|
|
5
|
+
const createSilentAudio = async ({ outName, indent, logLevel, binariesDirectory, cancelSignal, chunkLengthInSeconds, sampleRate, }) => {
|
|
7
6
|
await (0, call_ffmpeg_1.callFf)({
|
|
8
7
|
bin: 'ffmpeg',
|
|
9
8
|
args: [
|
|
10
9
|
'-f',
|
|
11
10
|
'lavfi',
|
|
12
11
|
'-i',
|
|
13
|
-
`anullsrc=r=${
|
|
12
|
+
`anullsrc=r=${sampleRate}`,
|
|
14
13
|
'-c:a',
|
|
15
14
|
'pcm_s16le',
|
|
16
15
|
'-t',
|
|
17
16
|
String(chunkLengthInSeconds),
|
|
18
17
|
'-ar',
|
|
19
|
-
String(
|
|
18
|
+
String(sampleRate),
|
|
20
19
|
outName,
|
|
21
20
|
],
|
|
22
21
|
indent,
|