@remotion/renderer 4.0.535 → 4.0.537
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/browser/BrowserPage.js +5 -4
- package/dist/client.d.ts +22 -41
- package/dist/esm/client.mjs +677 -721
- package/dist/esm/index.mjs +81 -74
- package/dist/mime-db.js +5 -0
- package/dist/options/index.d.ts +22 -41
- package/dist/options/index.js +4 -6
- package/dist/options/sequence-activity-limit.d.ts +19 -0
- package/dist/options/sequence-activity-limit.js +44 -0
- package/dist/options/{experimental-client-side-rendering.d.ts → show-layer-frame-numbers.d.ts} +6 -3
- package/dist/options/show-layer-frame-numbers.js +34 -0
- package/dist/serve-static.js +4 -4
- package/dist/stringify-ffmpeg-filter.js +8 -4
- package/package.json +16 -14
- package/dist/options/experimental-client-side-rendering.js +0 -30
- package/dist/prestitcher-memory-usage.d.ts +0 -13
- package/dist/prestitcher-memory-usage.js +0 -33
- package/dist/render-partitions.d.ts +0 -7
- package/dist/render-partitions.js +0 -50
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldUseParallelEncoding = exports.hasEnoughMemoryForParallelEncoding = void 0;
|
|
4
|
-
const get_available_memory_1 = require("./memory/get-available-memory");
|
|
5
|
-
const MINIMUM_MEMORY_LEFT = 2000000000;
|
|
6
|
-
const hasEnoughMemoryForParallelEncoding = ({ freeMemory, estimatedUsage, }) => {
|
|
7
|
-
return freeMemory - estimatedUsage > MINIMUM_MEMORY_LEFT;
|
|
8
|
-
};
|
|
9
|
-
exports.hasEnoughMemoryForParallelEncoding = hasEnoughMemoryForParallelEncoding;
|
|
10
|
-
const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
|
|
11
|
-
// Empirically we detected that per 1 million pixels, FFMPEG uses around 1GB of memory, relatively independent of
|
|
12
|
-
// the duration of the video.
|
|
13
|
-
const memoryUsageFor4K = 1000000000;
|
|
14
|
-
const memoryUsageOfPixel = memoryUsageFor4K / 1000000;
|
|
15
|
-
return memoryUsageOfPixel * width * height;
|
|
16
|
-
};
|
|
17
|
-
const shouldUseParallelEncoding = ({ width, height, logLevel, }) => {
|
|
18
|
-
const freeMemory = (0, get_available_memory_1.getAvailableMemory)(logLevel);
|
|
19
|
-
const estimatedUsage = estimateMemoryUsageForPrestitcher({
|
|
20
|
-
height,
|
|
21
|
-
width,
|
|
22
|
-
});
|
|
23
|
-
const hasEnoughMemory = (0, exports.hasEnoughMemoryForParallelEncoding)({
|
|
24
|
-
estimatedUsage,
|
|
25
|
-
freeMemory,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
hasEnoughMemory,
|
|
29
|
-
freeMemory,
|
|
30
|
-
estimatedUsage,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
exports.shouldUseParallelEncoding = shouldUseParallelEncoding;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderPartitions = void 0;
|
|
4
|
-
const renderPartitions = ({ frames, concurrency, }) => {
|
|
5
|
-
const partitions = [];
|
|
6
|
-
let start = 0;
|
|
7
|
-
for (let i = 0; i < concurrency; i++) {
|
|
8
|
-
const end = start + Math.ceil((frames.length - start) / (concurrency - i));
|
|
9
|
-
partitions.push(frames.slice(start, end));
|
|
10
|
-
start = end;
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
partitions,
|
|
14
|
-
getNextFrame: (pageIndex) => {
|
|
15
|
-
if (partitions[pageIndex].length === 0) {
|
|
16
|
-
const partitionLengths = partitions.map((p) => p.length);
|
|
17
|
-
if (partitionLengths.every((p) => p === 0)) {
|
|
18
|
-
throw new Error('No more frames to render');
|
|
19
|
-
}
|
|
20
|
-
let longestRemainingPartitionIndex = -1;
|
|
21
|
-
for (let i = 0; i < partitions.length; i++) {
|
|
22
|
-
if (longestRemainingPartitionIndex === -1) {
|
|
23
|
-
longestRemainingPartitionIndex = i;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (partitions[i].length >
|
|
27
|
-
partitions[longestRemainingPartitionIndex].length) {
|
|
28
|
-
longestRemainingPartitionIndex = i;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (longestRemainingPartitionIndex === -1) {
|
|
32
|
-
throw new Error('No more frames to render');
|
|
33
|
-
}
|
|
34
|
-
// Round up - let's say only one frame is left to render, we should take this one
|
|
35
|
-
const slicePoint = Math.ceil(partitions[longestRemainingPartitionIndex].length / 2) -
|
|
36
|
-
// but don't forget it's zero indexed :)
|
|
37
|
-
1;
|
|
38
|
-
partitions[pageIndex] =
|
|
39
|
-
partitions[longestRemainingPartitionIndex].slice(slicePoint);
|
|
40
|
-
partitions[longestRemainingPartitionIndex] = partitions[longestRemainingPartitionIndex].slice(0, slicePoint);
|
|
41
|
-
}
|
|
42
|
-
const value = partitions[pageIndex].shift();
|
|
43
|
-
if (value === undefined) {
|
|
44
|
-
throw new Error('No more frames to render');
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
exports.renderPartitions = renderPartitions;
|