@remotion/renderer 3.2.40 → 3.2.41
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/LICENSE.md
CHANGED
|
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
|
|
|
36
36
|
|
|
37
37
|
## Company license
|
|
38
38
|
|
|
39
|
-
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
|
|
39
|
+
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
|
|
40
40
|
|
|
41
41
|
Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findRemotionRoot = exports.findClosestPackageJson = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const recursionLimit = 5;
|
|
10
|
+
const findClosestPackageJson = () => {
|
|
11
|
+
let currentDir = process.cwd();
|
|
12
|
+
let possiblePackageJson = '';
|
|
13
|
+
for (let i = 0; i < recursionLimit; i++) {
|
|
14
|
+
possiblePackageJson = path_1.default.join(currentDir, 'package.json');
|
|
15
|
+
const exists = fs_1.default.existsSync(possiblePackageJson);
|
|
16
|
+
if (exists) {
|
|
17
|
+
return possiblePackageJson;
|
|
18
|
+
}
|
|
19
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
exports.findClosestPackageJson = findClosestPackageJson;
|
|
24
|
+
const findRemotionRoot = () => {
|
|
25
|
+
const closestPackageJson = (0, exports.findClosestPackageJson)();
|
|
26
|
+
if (closestPackageJson === null) {
|
|
27
|
+
return process.cwd();
|
|
28
|
+
}
|
|
29
|
+
return path_1.default.dirname(closestPackageJson);
|
|
30
|
+
};
|
|
31
|
+
exports.findRemotionRoot = findRemotionRoot;
|
package/dist/render-frames.js
CHANGED
|
@@ -31,6 +31,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
31
31
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
32
32
|
const truthy_1 = require("./truthy");
|
|
33
33
|
const validate_scale_1 = require("./validate-scale");
|
|
34
|
+
const MAX_RETRIES_PER_FRAME = 1;
|
|
34
35
|
const getComposition = (others) => {
|
|
35
36
|
if ('composition' in others) {
|
|
36
37
|
return others.composition;
|
|
@@ -69,7 +70,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
69
70
|
const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null);
|
|
70
71
|
const framesToRender = (0, get_duration_from_frame_range_1.getFramesToRender)(realFrameRange, everyNthFrame);
|
|
71
72
|
const lastFrame = framesToRender[framesToRender.length - 1];
|
|
72
|
-
const
|
|
73
|
+
const makePage = async () => {
|
|
73
74
|
const page = await puppeteerInstance.newPage();
|
|
74
75
|
pagesArray.push(page);
|
|
75
76
|
await page.setViewport({
|
|
@@ -126,7 +127,8 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
126
127
|
});
|
|
127
128
|
page.off('console', logCallback);
|
|
128
129
|
return page;
|
|
129
|
-
}
|
|
130
|
+
};
|
|
131
|
+
const pages = new Array(actualConcurrency).fill(true).map(makePage);
|
|
130
132
|
// If rendering a GIF and skipping frames, we must ensure it starts from 0
|
|
131
133
|
// and then is consecutive so FFMPEG recognizes the sequence
|
|
132
134
|
const countType = everyNthFrame === 1 ? 'actual-frames' : 'from-zero';
|
|
@@ -145,15 +147,15 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
145
147
|
cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
|
|
146
148
|
stopped = true;
|
|
147
149
|
});
|
|
148
|
-
const
|
|
150
|
+
const renderFrameWithOptionToReject = async (frame, index, reject) => {
|
|
149
151
|
const pool = await poolPromise;
|
|
150
152
|
const freePage = await pool.acquire();
|
|
151
153
|
if (stopped) {
|
|
152
|
-
|
|
154
|
+
return reject(new Error('Render was stopped'));
|
|
153
155
|
}
|
|
154
156
|
const startTime = perf_hooks_1.performance.now();
|
|
155
157
|
const errorCallbackOnFrame = (err) => {
|
|
156
|
-
|
|
158
|
+
reject(err);
|
|
157
159
|
};
|
|
158
160
|
const cleanupPageError = (0, handle_javascript_exception_1.handleJavascriptException)({
|
|
159
161
|
page: freePage,
|
|
@@ -219,13 +221,44 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
219
221
|
onError(new Error(`Error while downloading asset: ${err.stack}`));
|
|
220
222
|
});
|
|
221
223
|
});
|
|
222
|
-
pool.release(freePage);
|
|
223
224
|
framesRendered++;
|
|
224
225
|
onFrameUpdate(framesRendered, frame, perf_hooks_1.performance.now() - startTime);
|
|
225
226
|
cleanupPageError();
|
|
226
227
|
freePage.off('error', errorCallbackOnFrame);
|
|
227
|
-
|
|
228
|
-
}
|
|
228
|
+
pool.release(freePage);
|
|
229
|
+
};
|
|
230
|
+
const renderFrame = (frame, index) => {
|
|
231
|
+
return new Promise((resolve, reject) => {
|
|
232
|
+
renderFrameWithOptionToReject(frame, index, reject)
|
|
233
|
+
.then(() => {
|
|
234
|
+
resolve();
|
|
235
|
+
})
|
|
236
|
+
.catch((err) => {
|
|
237
|
+
reject(err);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const renderFrameAndRetryTargetClose = async (frame, index, retriesLeft, attempt) => {
|
|
242
|
+
var _a;
|
|
243
|
+
try {
|
|
244
|
+
await renderFrame(frame, index);
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
if (!((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('Target closed'))) {
|
|
248
|
+
throw err;
|
|
249
|
+
}
|
|
250
|
+
if (retriesLeft === 0) {
|
|
251
|
+
console.warn(err, `The browser crashed ${attempt} times while rendering frame ${frame}. Not retrying anymore. Learn more about this error under https://www.remotion.dev/docs/target-closed`);
|
|
252
|
+
throw err;
|
|
253
|
+
}
|
|
254
|
+
console.warn(`The browser crashed while rendering frame ${frame}, retrying ${retriesLeft} more times. Learn more about this error under https://www.remotion.dev/docs/target-closed`);
|
|
255
|
+
const pool = await poolPromise;
|
|
256
|
+
const page = await makePage();
|
|
257
|
+
pool.release(page);
|
|
258
|
+
await renderFrameAndRetryTargetClose(frame, index, retriesLeft - 1, attempt + 1);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const progress = Promise.all(framesToRender.map((frame, index) => renderFrameAndRetryTargetClose(frame, index, MAX_RETRIES_PER_FRAME, 1)));
|
|
229
262
|
const happyPath = progress.then(() => {
|
|
230
263
|
const firstFrameIndex = countType === 'from-zero' ? 0 : framesToRender[0];
|
|
231
264
|
const returnValue = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.41",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"execa": "5.1.1",
|
|
24
24
|
"extract-zip": "2.0.1",
|
|
25
|
-
"remotion": "3.2.
|
|
25
|
+
"remotion": "3.2.41",
|
|
26
26
|
"source-map": "^0.8.0-beta.0",
|
|
27
27
|
"ws": "8.7.0"
|
|
28
28
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "017d1f002dfe81d451e4707ca0a58f30e3a080b9"
|
|
61
61
|
}
|