init commit
This commit is contained in:
26
remotion/node_modules/@remotion/renderer/dist/prestitcher-memory-usage.js
generated
vendored
Normal file
26
remotion/node_modules/@remotion/renderer/dist/prestitcher-memory-usage.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.shouldUseParallelEncoding = void 0;
|
||||
const get_available_memory_1 = require("./memory/get-available-memory");
|
||||
const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
|
||||
// Empirically we detected that per 1 million pixels, FFMPEG uses around 1GB of memory, relatively independent of
|
||||
// the duration of the video.
|
||||
const memoryUsageFor4K = 1000000000;
|
||||
const memoryUsageOfPixel = memoryUsageFor4K / 1000000;
|
||||
return memoryUsageOfPixel * width * height;
|
||||
};
|
||||
const shouldUseParallelEncoding = ({ width, height, logLevel, }) => {
|
||||
const freeMemory = (0, get_available_memory_1.getAvailableMemory)(logLevel);
|
||||
const estimatedUsage = estimateMemoryUsageForPrestitcher({
|
||||
height,
|
||||
width,
|
||||
});
|
||||
const hasEnoughMemory = freeMemory - estimatedUsage > 2000000000 &&
|
||||
estimatedUsage / freeMemory < 0.5;
|
||||
return {
|
||||
hasEnoughMemory,
|
||||
freeMemory,
|
||||
estimatedUsage,
|
||||
};
|
||||
};
|
||||
exports.shouldUseParallelEncoding = shouldUseParallelEncoding;
|
||||
Reference in New Issue
Block a user