@remotion/renderer 3.3.32 → 3.3.34
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/is-target-closed-err.d.ts +1 -0
- package/dist/browser/is-target-closed-err.js +9 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +7 -0
- package/dist/extract-frame-from-video.d.ts +1 -0
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/get-extension-from-codec.js +2 -8
- package/dist/get-frame-of-video-slow.d.ts +2 -4
- package/dist/get-port.d.ts +4 -1
- package/dist/get-port.js +8 -8
- package/dist/guess-extension-for-media.d.ts +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/last-frame-from-video-cache.d.ts +1 -0
- package/dist/locks.d.ts +7 -0
- package/dist/locks.js +44 -0
- package/dist/provide-screenshot.d.ts +1 -0
- package/dist/puppeteer-screenshot.d.ts +1 -0
- package/dist/render-frames.js +10 -3
- package/dist/render-media.js +1 -1
- package/dist/screenshot-dom-element.d.ts +1 -0
- package/dist/screenshot-task.d.ts +1 -0
- package/dist/serve-static.js +4 -1
- package/dist/stitch-frames-to-video.js +1 -1
- package/dist/take-frame-and-compose.d.ts +1 -0
- package/dist/try-to-extract-frame-of-video-fast.d.ts +1 -0
- package/dist/wait-for-symbolication-error-to-be-done.js +5 -31
- package/package.json +10 -10
- package/dist/compositor/compositor.d.ts +0 -12
- package/dist/compositor/compositor.js +0 -111
- package/dist/determine-vcodec-ffmepg-flags.d.ts +0 -2
- package/dist/determine-vcodec-ffmepg-flags.js +0 -13
- package/dist/get-compositions-from-bundle.d.ts +0 -7
- package/dist/get-compositions-from-bundle.js +0 -55
- package/dist/get-compositions-from-markup.d.ts +0 -3
- package/dist/get-compositions-from-markup.js +0 -17
- package/dist/get-compositions-on-server.d.ts +0 -3
- package/dist/get-compositions-on-server.js +0 -18
- package/dist/get-video-signals.d.ts +0 -2
- package/dist/get-video-signals.js +0 -28
- package/dist/make-comp-manager-context.d.ts +0 -2
- package/dist/make-comp-manager-context.js +0 -45
- package/dist/make-timeline-context-value.d.ts +0 -2
- package/dist/make-timeline-context-value.js +0 -20
- package/dist/render-on-server.d.ts +0 -3
- package/dist/render-on-server.js +0 -90
- package/dist/render-svg.d.ts +0 -8
- package/dist/render-svg.js +0 -13
- package/dist/render-video-layer.d.ts +0 -9
- package/dist/render-video-layer.js +0 -23
- package/dist/render-web-frame.d.ts +0 -74
- package/dist/render-web-frame.js +0 -259
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isTargetClosedErr: (error: Error | undefined) => boolean | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTargetClosedErr = void 0;
|
|
4
|
+
const isTargetClosedErr = (error) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
return (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('Target closed')) ||
|
|
7
|
+
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('Session closed')));
|
|
8
|
+
};
|
|
9
|
+
exports.isTargetClosedErr = isTargetClosedErr;
|
package/dist/client.d.ts
ADDED
package/dist/client.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserSafeApis = void 0;
|
|
4
|
+
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
5
|
+
exports.BrowserSafeApis = {
|
|
6
|
+
getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
|
|
7
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
export declare const getFileExtensionFromCodec: (codec: Codec
|
|
2
|
+
export declare const getFileExtensionFromCodec: (codec: Codec) => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFileExtensionFromCodec = void 0;
|
|
4
4
|
const codec_1 = require("./codec");
|
|
5
|
-
const getFileExtensionFromCodec = (codec
|
|
5
|
+
const getFileExtensionFromCodec = (codec) => {
|
|
6
6
|
if (!codec_1.validCodecs.includes(codec)) {
|
|
7
7
|
throw new Error(`Codec must be one of the following: ${codec_1.validCodecs.join(', ')}, but got ${codec}`);
|
|
8
8
|
}
|
|
@@ -13,10 +13,7 @@ const getFileExtensionFromCodec = (codec, type) => {
|
|
|
13
13
|
return 'mp4';
|
|
14
14
|
// The chunks will be rendered as mkv, but the final output will still be MP4
|
|
15
15
|
case 'h264-mkv':
|
|
16
|
-
|
|
17
|
-
return 'mkv';
|
|
18
|
-
}
|
|
19
|
-
return 'mp4';
|
|
16
|
+
return 'mkv';
|
|
20
17
|
case 'h265':
|
|
21
18
|
return 'mp4';
|
|
22
19
|
case 'mp3':
|
|
@@ -28,9 +25,6 @@ const getFileExtensionFromCodec = (codec, type) => {
|
|
|
28
25
|
case 'vp9':
|
|
29
26
|
return 'webm';
|
|
30
27
|
case 'gif':
|
|
31
|
-
if (type === 'chunk') {
|
|
32
|
-
return 'mkv';
|
|
33
|
-
}
|
|
34
28
|
return 'gif';
|
|
35
29
|
case 'wav':
|
|
36
30
|
return 'wav';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
2
3
|
import type { SpecialVCodecForTransparency } from './assets/download-map';
|
|
3
4
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
@@ -7,10 +8,7 @@ export declare const getFrameOfVideoSlow: ({ src, duration, ffmpegExecutable, im
|
|
|
7
8
|
duration: number;
|
|
8
9
|
imageFormat: OffthreadVideoImageFormat;
|
|
9
10
|
specialVCodecForTransparency: SpecialVCodecForTransparency;
|
|
10
|
-
needsResize: [
|
|
11
|
-
number,
|
|
12
|
-
number
|
|
13
|
-
] | null;
|
|
11
|
+
needsResize: [number, number] | null;
|
|
14
12
|
offset: number;
|
|
15
13
|
fps: number | null;
|
|
16
14
|
remotionRoot: string;
|
package/dist/get-port.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare const getDesiredPort: (desiredPort: number | undefined, from: number, to: number) => Promise<
|
|
1
|
+
export declare const getDesiredPort: (desiredPort: number | undefined, from: number, to: number) => Promise<{
|
|
2
|
+
port: number;
|
|
3
|
+
didUsePort: () => void;
|
|
4
|
+
}>;
|
package/dist/get-port.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getDesiredPort = void 0;
|
|
7
7
|
const net_1 = __importDefault(require("net"));
|
|
8
|
-
const
|
|
8
|
+
const locks_1 = require("./locks");
|
|
9
9
|
const getAvailablePort = (portToTry) => new Promise((resolve) => {
|
|
10
10
|
let status = 'unavailable';
|
|
11
11
|
const host = '127.0.0.1';
|
|
@@ -35,21 +35,21 @@ const getPort = async (from, to) => {
|
|
|
35
35
|
}
|
|
36
36
|
throw new Error('No available ports found');
|
|
37
37
|
};
|
|
38
|
-
const
|
|
38
|
+
const portLocks = (0, locks_1.createLock)({ timeout: 10000 });
|
|
39
|
+
const getDesiredPort = async (desiredPort, from, to) => {
|
|
40
|
+
await portLocks.waitForAllToBeDone();
|
|
41
|
+
const lockPortSelection = portLocks.lock();
|
|
42
|
+
const didUsePort = () => portLocks.unlock(lockPortSelection);
|
|
39
43
|
if (typeof desiredPort !== 'undefined' &&
|
|
40
44
|
(await getAvailablePort(desiredPort)) === 'available') {
|
|
41
|
-
return desiredPort;
|
|
45
|
+
return { port: desiredPort, didUsePort };
|
|
42
46
|
}
|
|
43
47
|
const actualPort = await getPort(from, to);
|
|
44
48
|
// If did specify a port but did not get that one, fail hard.
|
|
45
49
|
if (desiredPort && desiredPort !== actualPort) {
|
|
46
50
|
throw new Error(`You specified port ${desiredPort} to be used for the HTTP server, but it is not available. Choose a different port or remove the setting to let Remotion automatically select a free port.`);
|
|
47
51
|
}
|
|
48
|
-
return actualPort;
|
|
49
|
-
};
|
|
50
|
-
const limit = (0, p_limit_1.pLimit)(1);
|
|
51
|
-
const getDesiredPort = (desiredPort, from, to) => {
|
|
52
|
-
return limit(() => getDesiredPortUnlimited(desiredPort, from, to));
|
|
52
|
+
return { port: actualPort, didUsePort };
|
|
53
53
|
};
|
|
54
54
|
exports.getDesiredPort = getDesiredPort;
|
|
55
55
|
const makeRange = (from, to) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import execa from 'execa';
|
|
3
2
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
4
3
|
import { mimeContentType, mimeLookup } from './mime-types';
|
|
@@ -60,7 +59,7 @@ export declare const RenderInternals: {
|
|
|
60
59
|
scale: number;
|
|
61
60
|
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
62
61
|
}) => void;
|
|
63
|
-
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif"
|
|
62
|
+
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
|
|
64
63
|
tmpDir: (str: string) => string;
|
|
65
64
|
deleteDirectory: (directory: string) => Promise<void>;
|
|
66
65
|
isServeUrl: (potentialUrl: string) => boolean;
|
|
@@ -85,7 +84,10 @@ export declare const RenderInternals: {
|
|
|
85
84
|
SymbolicateableError: typeof SymbolicateableError;
|
|
86
85
|
getFramesToRender: (frameRange: [number, number], everyNthFrame: number) => number[];
|
|
87
86
|
getExtensionOfFilename: (filename: string | null) => string | null;
|
|
88
|
-
getDesiredPort: (desiredPort: number | undefined, from: number, to: number) => Promise<
|
|
87
|
+
getDesiredPort: (desiredPort: number | undefined, from: number, to: number) => Promise<{
|
|
88
|
+
port: number;
|
|
89
|
+
didUsePort: () => void;
|
|
90
|
+
}>;
|
|
89
91
|
isPathInside: (thePath: string, potentialParent: string) => boolean;
|
|
90
92
|
execa: {
|
|
91
93
|
(file: string, arguments?: readonly string[] | undefined, options?: execa.Options<string> | undefined): execa.ExecaChildProcess<string>;
|
|
@@ -125,7 +127,7 @@ export declare const RenderInternals: {
|
|
|
125
127
|
DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
126
128
|
isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
127
129
|
logLevels: readonly ["verbose", "info", "warn", "error"];
|
|
128
|
-
isEqualOrBelowLogLevel: (currentLevel: "verbose" | "
|
|
130
|
+
isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
|
|
129
131
|
isValidLogLevel: (level: string) => boolean;
|
|
130
132
|
perf: typeof perf;
|
|
131
133
|
makeDownloadMap: () => import("./assets/download-map").DownloadMap;
|
package/dist/locks.d.ts
ADDED
package/dist/locks.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLock = void 0;
|
|
4
|
+
const createLock = ({ timeout }) => {
|
|
5
|
+
let locks = [];
|
|
6
|
+
const waiters = [];
|
|
7
|
+
const lock = () => {
|
|
8
|
+
const id = Math.random();
|
|
9
|
+
locks.push(id);
|
|
10
|
+
return id;
|
|
11
|
+
};
|
|
12
|
+
const unlock = (id) => {
|
|
13
|
+
locks = locks.filter((l) => l !== id);
|
|
14
|
+
resolveWaiters();
|
|
15
|
+
};
|
|
16
|
+
const resolveWaiters = () => {
|
|
17
|
+
if (locks.length === 0) {
|
|
18
|
+
waiters.forEach((w) => w());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const waitForAllToBeDone = () => {
|
|
22
|
+
const success = new Promise((resolve) => {
|
|
23
|
+
waiters.push(() => {
|
|
24
|
+
resolve();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
resolveWaiters();
|
|
28
|
+
if (timeout === null) {
|
|
29
|
+
return success;
|
|
30
|
+
}
|
|
31
|
+
const timeoutFn = new Promise((resolve) => {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
return resolve();
|
|
34
|
+
}, timeout);
|
|
35
|
+
});
|
|
36
|
+
return Promise.race([success, timeoutFn]);
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
lock,
|
|
40
|
+
unlock,
|
|
41
|
+
waitForAllToBeDone,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.createLock = createLock;
|
package/dist/render-frames.js
CHANGED
|
@@ -245,8 +245,11 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
245
245
|
if ((0, make_cancel_signal_1.isUserCancelledRender)(err)) {
|
|
246
246
|
throw err;
|
|
247
247
|
}
|
|
248
|
+
if (stopped) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
248
251
|
if (retriesLeft === 0) {
|
|
249
|
-
console.warn(
|
|
252
|
+
console.warn(`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`);
|
|
250
253
|
throw err;
|
|
251
254
|
}
|
|
252
255
|
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`);
|
|
@@ -370,7 +373,9 @@ const renderFrames = (options) => {
|
|
|
370
373
|
// If new browser was opened, then closing the browser as a cleanup.
|
|
371
374
|
if (options.puppeteerInstance) {
|
|
372
375
|
Promise.all(openedPages.map((p) => p.close())).catch((err) => {
|
|
373
|
-
|
|
376
|
+
if (!(err === null || err === void 0 ? void 0 : err.message.includes('Target closed'))) {
|
|
377
|
+
console.log('Unable to close browser tab', err);
|
|
378
|
+
}
|
|
374
379
|
});
|
|
375
380
|
}
|
|
376
381
|
else {
|
|
@@ -379,7 +384,9 @@ const renderFrames = (options) => {
|
|
|
379
384
|
return puppeteerInstance.close(true);
|
|
380
385
|
})
|
|
381
386
|
.catch((err) => {
|
|
382
|
-
|
|
387
|
+
if (!(err === null || err === void 0 ? void 0 : err.message.includes('Target closed'))) {
|
|
388
|
+
console.log('Unable to close browser', err);
|
|
389
|
+
}
|
|
383
390
|
});
|
|
384
391
|
}
|
|
385
392
|
cleanup.forEach((c) => {
|
package/dist/render-media.js
CHANGED
|
@@ -115,7 +115,7 @@ const renderMedia = ({ proResProfile, crf, composition, ffmpegExecutable, ffprob
|
|
|
115
115
|
const quality = imageFormat === 'jpeg' ? options.quality : undefined;
|
|
116
116
|
(0, image_format_1.validateSelectedPixelFormatAndImageFormatCombination)(pixelFormat, imageFormat);
|
|
117
117
|
const preEncodedFileLocation = parallelEncoding
|
|
118
|
-
? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec
|
|
118
|
+
? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec))
|
|
119
119
|
: null;
|
|
120
120
|
const outputDir = parallelEncoding
|
|
121
121
|
? null
|
package/dist/serve-static.js
CHANGED
|
@@ -10,7 +10,7 @@ const offthread_video_server_1 = require("./offthread-video-server");
|
|
|
10
10
|
const serve_handler_1 = require("./serve-handler");
|
|
11
11
|
const serveStatic = async (path, options) => {
|
|
12
12
|
var _a;
|
|
13
|
-
const port = await (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100);
|
|
13
|
+
const { port, didUsePort } = await (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100);
|
|
14
14
|
const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
15
15
|
ffmpegExecutable: options.ffmpegExecutable,
|
|
16
16
|
ffprobeExecutable: options.ffprobeExecutable,
|
|
@@ -47,6 +47,9 @@ const serveStatic = async (path, options) => {
|
|
|
47
47
|
delete connections[key];
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
server.on('listening', () => {
|
|
51
|
+
didUsePort();
|
|
52
|
+
});
|
|
50
53
|
const destroyConnections = function () {
|
|
51
54
|
for (const key in connections)
|
|
52
55
|
connections[key].destroy();
|
|
@@ -134,7 +134,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
134
134
|
const mediaSupport = (0, codec_supports_media_1.codecSupportsMedia)(codec);
|
|
135
135
|
const tempFile = options.outputLocation
|
|
136
136
|
? null
|
|
137
|
-
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec
|
|
137
|
+
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec)}`);
|
|
138
138
|
const shouldRenderAudio = mediaSupport.audio &&
|
|
139
139
|
(options.assetsInfo.assets.flat(1).length > 0 ||
|
|
140
140
|
options.enforceAudioTrack) &&
|
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.waitForSymbolicationToBeDone = exports.unlockErrorSymbolicationLock = exports.registerErrorSymbolicationLock = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return id;
|
|
10
|
-
};
|
|
11
|
-
exports.registerErrorSymbolicationLock = registerErrorSymbolicationLock;
|
|
12
|
-
const unlockErrorSymbolicationLock = (id) => {
|
|
13
|
-
locks = locks.filter((l) => l !== id);
|
|
14
|
-
resolveWaiters();
|
|
15
|
-
};
|
|
16
|
-
exports.unlockErrorSymbolicationLock = unlockErrorSymbolicationLock;
|
|
17
|
-
const resolveWaiters = () => {
|
|
18
|
-
if (locks.length === 0) {
|
|
19
|
-
waiters.forEach((w) => w());
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const waitForSymbolicationToBeDone = () => {
|
|
23
|
-
const success = new Promise((resolve) => {
|
|
24
|
-
waiters.push(() => {
|
|
25
|
-
resolve();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
const timeout = new Promise((resolve) => {
|
|
29
|
-
setTimeout(() => resolve(), 5000);
|
|
30
|
-
});
|
|
31
|
-
resolveWaiters();
|
|
32
|
-
return Promise.all([success, timeout]);
|
|
33
|
-
};
|
|
34
|
-
exports.waitForSymbolicationToBeDone = waitForSymbolicationToBeDone;
|
|
4
|
+
const locks_1 = require("./locks");
|
|
5
|
+
const { lock, unlock, waitForAllToBeDone } = (0, locks_1.createLock)({ timeout: 50000 });
|
|
6
|
+
exports.registerErrorSymbolicationLock = lock;
|
|
7
|
+
exports.unlockErrorSymbolicationLock = unlock;
|
|
8
|
+
exports.waitForSymbolicationToBeDone = waitForAllToBeDone;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.34",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"execa": "5.1.1",
|
|
26
26
|
"extract-zip": "2.0.1",
|
|
27
|
-
"remotion": "3.3.
|
|
27
|
+
"remotion": "3.3.34",
|
|
28
28
|
"source-map": "^0.8.0-beta.0",
|
|
29
29
|
"ws": "8.7.0"
|
|
30
30
|
},
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"vitest": "0.24.3"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@remotion/compositor-darwin-arm64": "3.3.
|
|
53
|
-
"@remotion/compositor-darwin-x64": "3.3.
|
|
54
|
-
"@remotion/compositor-linux-arm64-gnu": "3.3.
|
|
55
|
-
"@remotion/compositor-linux-arm64-musl": "3.3.
|
|
56
|
-
"@remotion/compositor-linux-x64-gnu": "3.3.
|
|
57
|
-
"@remotion/compositor-linux-x64-musl": "3.3.
|
|
58
|
-
"@remotion/compositor-win32-x64-msvc": "3.3.
|
|
52
|
+
"@remotion/compositor-darwin-arm64": "3.3.34",
|
|
53
|
+
"@remotion/compositor-darwin-x64": "3.3.34",
|
|
54
|
+
"@remotion/compositor-linux-arm64-gnu": "3.3.34",
|
|
55
|
+
"@remotion/compositor-linux-arm64-musl": "3.3.34",
|
|
56
|
+
"@remotion/compositor-linux-x64-gnu": "3.3.34",
|
|
57
|
+
"@remotion/compositor-linux-x64-musl": "3.3.34",
|
|
58
|
+
"@remotion/compositor-win32-x64-msvc": "3.3.34"
|
|
59
59
|
},
|
|
60
60
|
"keywords": [
|
|
61
61
|
"remotion",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b078979b3e2f5cc4d240f112b827e7ef951aa318"
|
|
71
71
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CompositorCommand, CompositorInitiatePayload } from './payloads';
|
|
2
|
-
export declare type Compositor = {
|
|
3
|
-
finishCommands: () => void;
|
|
4
|
-
executeCommand: (payload: Omit<CompositorCommand, 'nonce'>) => Promise<void>;
|
|
5
|
-
waitForDone: () => Promise<void>;
|
|
6
|
-
};
|
|
7
|
-
export declare const spawnCompositorOrReuse: ({ initiatePayload, renderId, }: {
|
|
8
|
-
initiatePayload: CompositorInitiatePayload;
|
|
9
|
-
renderId: string;
|
|
10
|
-
}) => Compositor;
|
|
11
|
-
export declare const releaseCompositorWithId: (renderId: string) => void;
|
|
12
|
-
export declare const waitForCompositorWithIdToQuit: (renderId: string) => Promise<void>;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.waitForCompositorWithIdToQuit = exports.releaseCompositorWithId = exports.spawnCompositorOrReuse = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const truthy_1 = require("../truthy");
|
|
6
|
-
const get_executable_path_1 = require("./get-executable-path");
|
|
7
|
-
const compositorMap = {};
|
|
8
|
-
const spawnCompositorOrReuse = ({ initiatePayload, renderId, }) => {
|
|
9
|
-
if (!compositorMap[renderId]) {
|
|
10
|
-
compositorMap[renderId] = startCompositor(initiatePayload);
|
|
11
|
-
}
|
|
12
|
-
return compositorMap[renderId];
|
|
13
|
-
};
|
|
14
|
-
exports.spawnCompositorOrReuse = spawnCompositorOrReuse;
|
|
15
|
-
const releaseCompositorWithId = (renderId) => {
|
|
16
|
-
if (compositorMap[renderId]) {
|
|
17
|
-
compositorMap[renderId].finishCommands();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.releaseCompositorWithId = releaseCompositorWithId;
|
|
21
|
-
const waitForCompositorWithIdToQuit = (renderId) => {
|
|
22
|
-
if (!compositorMap[renderId]) {
|
|
23
|
-
throw new TypeError('No compositor with that id');
|
|
24
|
-
}
|
|
25
|
-
return compositorMap[renderId].waitForDone();
|
|
26
|
-
};
|
|
27
|
-
exports.waitForCompositorWithIdToQuit = waitForCompositorWithIdToQuit;
|
|
28
|
-
const startCompositor = (compositorInitiatePayload) => {
|
|
29
|
-
const bin = (0, get_executable_path_1.getExecutablePath)();
|
|
30
|
-
const child = (0, child_process_1.spawn)(`${bin}`, [JSON.stringify(compositorInitiatePayload)]);
|
|
31
|
-
const stderrChunks = [];
|
|
32
|
-
let stdoutListeners = [];
|
|
33
|
-
let stderrListeners = [];
|
|
34
|
-
child.stderr.on('data', (d) => {
|
|
35
|
-
stderrChunks.push(d);
|
|
36
|
-
const str = d.toString('utf-8');
|
|
37
|
-
stderrListeners.forEach((s) => s(str));
|
|
38
|
-
});
|
|
39
|
-
child.stdout.on('data', (d) => {
|
|
40
|
-
const str = d.toString('utf-8');
|
|
41
|
-
stdoutListeners.forEach((s) => s(str));
|
|
42
|
-
});
|
|
43
|
-
let nonce = 0;
|
|
44
|
-
return {
|
|
45
|
-
waitForDone: () => {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
child.on('exit', (code) => {
|
|
48
|
-
if (code === 0) {
|
|
49
|
-
resolve();
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
reject(Buffer.concat(stderrChunks).toString('utf-8'));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
finishCommands: () => {
|
|
58
|
-
child.stdin.write('EOF\n');
|
|
59
|
-
},
|
|
60
|
-
executeCommand: (payload) => {
|
|
61
|
-
const actualPayload = {
|
|
62
|
-
...payload,
|
|
63
|
-
nonce,
|
|
64
|
-
};
|
|
65
|
-
nonce++;
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
child.stdin.write(JSON.stringify(actualPayload) + '\n');
|
|
68
|
-
const onStderr = (message) => {
|
|
69
|
-
let parsed = null;
|
|
70
|
-
try {
|
|
71
|
-
const content = JSON.parse(message);
|
|
72
|
-
if (content.msg_type === 'error') {
|
|
73
|
-
parsed = content;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
// TODO: Obviously bad, does not handle panics
|
|
78
|
-
console.log('Rust debug err:', message);
|
|
79
|
-
}
|
|
80
|
-
if (parsed) {
|
|
81
|
-
const err = new Error(parsed.error);
|
|
82
|
-
err.stack = parsed.error + '\n' + parsed.backtrace;
|
|
83
|
-
reject(err);
|
|
84
|
-
stdoutListeners = stdoutListeners.filter((s) => s !== onStdout);
|
|
85
|
-
stderrListeners = stderrListeners.filter((s) => s !== onStderr);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const onStdout = (str) => {
|
|
89
|
-
const lineSplit = str.split('\n');
|
|
90
|
-
for (const line of lineSplit.filter(truthy_1.truthy)) {
|
|
91
|
-
let parsed = null;
|
|
92
|
-
try {
|
|
93
|
-
const p = JSON.parse(line);
|
|
94
|
-
if (p.msg_type === 'finish') {
|
|
95
|
-
parsed = p;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (e) { }
|
|
99
|
-
if (parsed && parsed.nonce === actualPayload.nonce) {
|
|
100
|
-
resolve();
|
|
101
|
-
stdoutListeners = stdoutListeners.filter((s) => s !== onStdout);
|
|
102
|
-
stderrListeners = stderrListeners.filter((s) => s !== onStderr);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
stdoutListeners.push(onStdout);
|
|
107
|
-
stderrListeners.push(onStderr);
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determineVcodecFfmepgFlags = void 0;
|
|
4
|
-
const truthy_1 = require("./truthy");
|
|
5
|
-
const determineVcodecFfmepgFlags = (vcodecFlag) => {
|
|
6
|
-
return [
|
|
7
|
-
vcodecFlag === 'vp9' ? '-vcodec' : null,
|
|
8
|
-
vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
|
|
9
|
-
vcodecFlag === 'vp8' ? '-vcodec' : null,
|
|
10
|
-
vcodecFlag === 'vp8' ? 'libvpx' : null,
|
|
11
|
-
].filter(truthy_1.truthy);
|
|
12
|
-
};
|
|
13
|
-
exports.determineVcodecFfmepgFlags = determineVcodecFfmepgFlags;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { TCompMetadata } from 'remotion';
|
|
3
|
-
import type { GetCompositionsConfig } from './get-compositions';
|
|
4
|
-
export declare const getCompositionsFromBundle: (bundle: string, options: GetCompositionsConfig) => {
|
|
5
|
-
compositions: TCompMetadata[];
|
|
6
|
-
root: ComponentType;
|
|
7
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
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.getCompositionsFromBundle = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const remotion_1 = require("remotion");
|
|
10
|
-
const vm_1 = __importDefault(require("vm"));
|
|
11
|
-
const is_serve_url_1 = require("./is-serve-url");
|
|
12
|
-
const getCompositionsFromBundle = (bundle, options) => {
|
|
13
|
-
const bundleFile = path_1.default.join(bundle, 'bundle.js');
|
|
14
|
-
if ((0, is_serve_url_1.isServeUrl)(bundle)) {
|
|
15
|
-
throw new Error('Can only use getCompositionFromBundle from a local file');
|
|
16
|
-
}
|
|
17
|
-
const content = fs_1.default.readFileSync(bundleFile, 'utf-8');
|
|
18
|
-
// @ts-éxpect-error
|
|
19
|
-
process.env.REMOTION_SERVER_RENDERING = 'true';
|
|
20
|
-
const context = {
|
|
21
|
-
window: {
|
|
22
|
-
remotion_envVariables: options.envVariables,
|
|
23
|
-
},
|
|
24
|
-
clearTimeout: () => {
|
|
25
|
-
console.trace('clearTimeout() called inside a server-side bundle. This is not supported.');
|
|
26
|
-
},
|
|
27
|
-
setTimeout: () => {
|
|
28
|
-
console.trace('setTimeout() called inside a server-side bundle. This is not supported.');
|
|
29
|
-
},
|
|
30
|
-
process: {
|
|
31
|
-
env: {
|
|
32
|
-
REMOTION_SERVER_RENDERING: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
require,
|
|
36
|
-
Buffer,
|
|
37
|
-
console,
|
|
38
|
-
};
|
|
39
|
-
const vmContext = vm_1.default.createContext(context);
|
|
40
|
-
// TODO: Set props and env
|
|
41
|
-
const code = content;
|
|
42
|
-
vm_1.default.runInContext(code, vmContext, {
|
|
43
|
-
filename: bundleFile,
|
|
44
|
-
breakOnSigint: true,
|
|
45
|
-
});
|
|
46
|
-
const theRoot = remotion_1.Internals.getRoot();
|
|
47
|
-
if (!theRoot) {
|
|
48
|
-
throw new Error('Did not call getRoot() in the bundle. Delaying the calling of getRoot() is not supported in server-side-rendering.');
|
|
49
|
-
}
|
|
50
|
-
const Comp = theRoot;
|
|
51
|
-
const comps = (0, remotion_1.getCompositionsFromMarkup)(Comp);
|
|
52
|
-
remotion_1.Internals.clearRoot();
|
|
53
|
-
return { compositions: comps, root: Comp };
|
|
54
|
-
};
|
|
55
|
-
exports.getCompositionsFromBundle = getCompositionsFromBundle;
|