@remotion/cli 3.3.18 → 3.3.19
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 +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/open-browser.d.ts +2 -0
- package/dist/config/open-browser.js +15 -0
- package/dist/convert-entry-point-to-serve-url.d.ts +1 -0
- package/dist/convert-entry-point-to-serve-url.js +15 -0
- package/dist/editor/components/CollapsableOptions.d.ts +6 -0
- package/dist/editor/components/CollapsableOptions.js +35 -0
- package/dist/editor/components/InlineAction.d.ts +5 -0
- package/dist/editor/components/InlineAction.js +32 -0
- package/dist/editor/components/RenderButton.d.ts +1 -1
- package/dist/editor/components/RenderButton.js +24 -34
- package/dist/editor/components/RenderModal/RenderErrorModal.d.ts +5 -0
- package/dist/editor/components/RenderModal/RenderErrorModal.js +64 -0
- package/dist/editor/components/RenderModal/RenderModal.d.ts +8 -2
- package/dist/editor/components/RenderModal/RenderModal.js +204 -32
- package/dist/editor/components/RenderQueue/CircularProgress.d.ts +5 -0
- package/dist/editor/components/RenderQueue/CircularProgress.js +18 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.js +26 -0
- package/dist/editor/components/RenderQueue/RenderQueueItem.js +14 -1
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.js +11 -3
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.js +12 -52
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.js +27 -0
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +6 -40
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +22 -0
- package/dist/editor/components/RenderQueue/actions.d.ts +32 -0
- package/dist/editor/components/RenderQueue/actions.js +75 -0
- package/dist/editor/components/RenderQueue/context.d.ts +1 -0
- package/dist/editor/components/RenderQueue/context.js +6 -1
- package/dist/editor/components/RenderQueue/index.js +1 -1
- package/dist/editor/components/RenderQueue/item-style.d.ts +2 -0
- package/dist/editor/components/RenderQueue/item-style.js +21 -0
- package/dist/editor/components/RenderToolbarIcon.d.ts +2 -0
- package/dist/editor/components/RenderToolbarIcon.js +47 -0
- package/dist/editor/components/RendersTab.js +6 -2
- package/dist/editor/components/SegmentedControl.d.ts +15 -0
- package/dist/editor/components/SegmentedControl.js +46 -0
- package/dist/editor/components/SidebarContent.js +21 -4
- package/dist/editor/components/Tabs/index.js +3 -1
- package/dist/editor/components/Timeline/TimelineZoomControls.js +3 -1
- package/dist/editor/helpers/use-file-existence.d.ts +1 -0
- package/dist/editor/helpers/use-file-existence.js +57 -0
- package/dist/editor/helpers/use-menu-structure.js +15 -1
- package/dist/editor/icons/RenderStillIcon.d.ts +3 -0
- package/dist/editor/icons/RenderStillIcon.js +8 -0
- package/dist/editor/icons/render.d.ts +0 -1
- package/dist/editor/icons/render.js +1 -1
- package/dist/editor/icons/video.d.ts +5 -0
- package/dist/editor/icons/video.js +8 -0
- package/dist/file-watcher.d.ts +9 -0
- package/dist/file-watcher.js +35 -0
- package/dist/list-of-remotion-packages.js +1 -0
- package/dist/load-config.js +1 -10
- package/dist/parse-command-line.d.ts +1 -0
- package/dist/parse-command-line.js +1 -0
- package/dist/preview-server/actions.d.ts +0 -0
- package/dist/preview-server/actions.js +1 -0
- package/dist/preview-server/api-routes.d.ts +4 -0
- package/dist/preview-server/api-routes.js +15 -0
- package/dist/preview-server/api-types.d.ts +26 -0
- package/dist/preview-server/api-types.js +2 -0
- package/dist/preview-server/file-existence-watchers.d.ts +10 -0
- package/dist/preview-server/file-existence-watchers.js +46 -0
- package/dist/preview-server/get-file-existence.d.ts +2 -0
- package/dist/preview-server/get-file-existence.js +36 -0
- package/dist/preview-server/handler.d.ts +9 -0
- package/dist/preview-server/handler.js +34 -0
- package/dist/preview-server/render-queue/add-render.d.ts +3 -2
- package/dist/preview-server/render-queue/add-render.js +20 -25
- package/dist/preview-server/render-queue/index.d.ts +14 -3
- package/dist/preview-server/render-queue/index.js +51 -10
- package/dist/preview-server/render-queue/job.d.ts +56 -6
- package/dist/preview-server/render-queue/make-retry-payload.d.ts +3 -0
- package/dist/preview-server/render-queue/make-retry-payload.js +32 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.js +7 -5
- package/dist/preview-server/render-queue/open-in-file-explorer.js +1 -0
- package/dist/preview-server/render-queue/process-still.d.ts +7 -0
- package/dist/preview-server/render-queue/process-still.js +49 -0
- package/dist/preview-server/render-queue/process-video.d.ts +7 -0
- package/dist/preview-server/render-queue/process-video.js +55 -0
- package/dist/preview-server/render-queue/queue.d.ts +19 -0
- package/dist/preview-server/render-queue/queue.js +150 -0
- package/dist/preview-server/render-queue/remove-render.js +3 -2
- package/dist/preview-server/routes/add-render.d.ts +3 -0
- package/dist/preview-server/routes/add-render.js +52 -0
- package/dist/preview-server/routes/open-in-file-explorer.d.ts +3 -0
- package/dist/preview-server/routes/open-in-file-explorer.js +14 -0
- package/dist/preview-server/routes/remove-render.d.ts +3 -0
- package/dist/preview-server/routes/remove-render.js +9 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.js +13 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.js +9 -0
- package/dist/preview.js +25 -1
- package/dist/render-flows/render.d.ts +33 -0
- package/dist/render-flows/render.js +251 -0
- package/dist/render-flows/still.d.ts +30 -0
- package/dist/render-flows/still.js +170 -0
- package/package.json +7 -7
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processJobIfPossible = exports.removeJob = exports.addJob = exports.processJob = exports.notifyClientsOfJobUpdate = exports.getRenderQueue = void 0;
|
|
4
|
-
const bundler_1 = require("@remotion/bundler");
|
|
5
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const get_cli_options_1 = require("../../get-cli-options");
|
|
7
|
+
const setup_cache_1 = require("../../setup-cache");
|
|
6
8
|
const live_events_1 = require("../live-events");
|
|
7
9
|
let jobQueue = [];
|
|
8
10
|
const updateJob = (id, updater) => {
|
|
@@ -27,14 +29,35 @@ const notifyClientsOfJobUpdate = () => {
|
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
exports.notifyClientsOfJobUpdate = notifyClientsOfJobUpdate;
|
|
30
|
-
const processJob = async (job, entryPoint) => {
|
|
32
|
+
const processJob = async ({ job, remotionRoot, entryPoint, }) => {
|
|
31
33
|
if (job.type === 'still') {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const { publicDir, browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, port, scale, browser, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({
|
|
35
|
+
isLambda: false,
|
|
36
|
+
type: 'get-compositions',
|
|
37
|
+
remotionRoot,
|
|
38
|
+
});
|
|
39
|
+
const browserInstance = (0, renderer_1.openBrowser)(browser, {
|
|
40
|
+
browserExecutable,
|
|
41
|
+
chromiumOptions,
|
|
42
|
+
shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
|
|
43
|
+
forceDeviceScaleFactor: scale,
|
|
44
|
+
});
|
|
45
|
+
const serveUrl = await (0, setup_cache_1.bundleOnCli)({
|
|
46
|
+
fullPath: entryPoint,
|
|
47
|
+
publicDir,
|
|
48
|
+
remotionRoot,
|
|
49
|
+
steps: ['bundling'],
|
|
35
50
|
});
|
|
36
51
|
const compositions = await (0, renderer_1.getCompositions)(serveUrl, {
|
|
37
|
-
|
|
52
|
+
browserExecutable,
|
|
53
|
+
chromiumOptions,
|
|
54
|
+
envVariables,
|
|
55
|
+
ffmpegExecutable,
|
|
56
|
+
ffprobeExecutable,
|
|
57
|
+
inputProps,
|
|
58
|
+
port,
|
|
59
|
+
puppeteerInstance: await browserInstance,
|
|
60
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
38
61
|
});
|
|
39
62
|
const composition = compositions.find((c) => {
|
|
40
63
|
return c.id === job.compositionId;
|
|
@@ -46,15 +69,33 @@ const processJob = async (job, entryPoint) => {
|
|
|
46
69
|
composition,
|
|
47
70
|
output: job.outputLocation,
|
|
48
71
|
serveUrl,
|
|
72
|
+
browserExecutable,
|
|
73
|
+
chromiumOptions,
|
|
74
|
+
envVariables,
|
|
75
|
+
ffmpegExecutable,
|
|
76
|
+
ffprobeExecutable,
|
|
77
|
+
scale,
|
|
78
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
79
|
+
// TODO: Write download progress to CLI
|
|
80
|
+
overwrite: false,
|
|
81
|
+
// TODO: Allow user to overwrite file
|
|
82
|
+
port,
|
|
83
|
+
inputProps,
|
|
84
|
+
puppeteerInstance: await browserInstance,
|
|
85
|
+
// TODO: Allow to specify quality
|
|
86
|
+
// TODO: Allow to customize image format
|
|
87
|
+
imageFormat: 'png',
|
|
88
|
+
// TODO: Allow specific frame
|
|
89
|
+
// TODO: Allow cancel signal
|
|
49
90
|
// TODO: Accept CLI options
|
|
50
91
|
});
|
|
51
92
|
}
|
|
52
93
|
throw new TypeError(`Could not process job of type ${job.type}`);
|
|
53
94
|
};
|
|
54
95
|
exports.processJob = processJob;
|
|
55
|
-
const addJob = (job, entryPoint) => {
|
|
96
|
+
const addJob = ({ job, entryPoint, remotionRoot, }) => {
|
|
56
97
|
jobQueue.push(job);
|
|
57
|
-
(0, exports.processJobIfPossible)(entryPoint);
|
|
98
|
+
(0, exports.processJobIfPossible)({ entryPoint, remotionRoot });
|
|
58
99
|
(0, exports.notifyClientsOfJobUpdate)();
|
|
59
100
|
};
|
|
60
101
|
exports.addJob = addJob;
|
|
@@ -63,7 +104,7 @@ const removeJob = (jobId) => {
|
|
|
63
104
|
(0, exports.notifyClientsOfJobUpdate)();
|
|
64
105
|
};
|
|
65
106
|
exports.removeJob = removeJob;
|
|
66
|
-
const processJobIfPossible = async (entryPoint) => {
|
|
107
|
+
const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
67
108
|
const nextJob = jobQueue.find((q) => {
|
|
68
109
|
return q.status === 'idle';
|
|
69
110
|
});
|
|
@@ -77,7 +118,7 @@ const processJobIfPossible = async (entryPoint) => {
|
|
|
77
118
|
status: 'running',
|
|
78
119
|
};
|
|
79
120
|
});
|
|
80
|
-
await (0, exports.processJob)(nextJob, entryPoint);
|
|
121
|
+
await (0, exports.processJob)({ job: nextJob, entryPoint, remotionRoot });
|
|
81
122
|
updateJob(nextJob.id, (job) => {
|
|
82
123
|
return {
|
|
83
124
|
...job,
|
|
@@ -1,29 +1,79 @@
|
|
|
1
|
+
import type { Codec, StillImageFormat } from '@remotion/renderer';
|
|
1
2
|
declare type RenderJobDynamicStatus = {
|
|
2
3
|
status: 'done';
|
|
3
4
|
} | {
|
|
4
5
|
status: 'running';
|
|
6
|
+
progress: number;
|
|
7
|
+
message: string;
|
|
5
8
|
} | {
|
|
6
9
|
status: 'idle';
|
|
7
10
|
} | {
|
|
8
11
|
status: 'failed';
|
|
9
|
-
error:
|
|
12
|
+
error: {
|
|
13
|
+
message: string;
|
|
14
|
+
stack: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare type JobProgressCallback = (options: {
|
|
18
|
+
progress: number;
|
|
19
|
+
message: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
declare type RenderJobDynamicFields = {
|
|
22
|
+
type: 'still';
|
|
23
|
+
imageFormat: StillImageFormat;
|
|
24
|
+
quality: number | null;
|
|
25
|
+
frame: number;
|
|
26
|
+
scale: number;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'video';
|
|
29
|
+
imageFormat: StillImageFormat;
|
|
30
|
+
quality: number | null;
|
|
31
|
+
scale: number;
|
|
32
|
+
codec: Codec;
|
|
10
33
|
};
|
|
11
34
|
export declare type RenderJob = {
|
|
12
35
|
startedAt: number;
|
|
13
36
|
compositionId: string;
|
|
14
|
-
type: 'still' | 'composition';
|
|
15
37
|
id: string;
|
|
16
|
-
|
|
17
|
-
|
|
38
|
+
outName: string;
|
|
39
|
+
deletedOutputLocation: boolean;
|
|
40
|
+
verbose: boolean;
|
|
41
|
+
} & RenderJobDynamicStatus & RenderJobDynamicFields;
|
|
42
|
+
export declare type RenderJobWithCleanup = RenderJob & {
|
|
43
|
+
cleanup: (() => void)[];
|
|
44
|
+
};
|
|
45
|
+
declare type AddRenderRequestDynamicFields = {
|
|
46
|
+
type: 'still';
|
|
47
|
+
imageFormat: StillImageFormat;
|
|
48
|
+
quality: number | null;
|
|
49
|
+
frame: number;
|
|
50
|
+
scale: number;
|
|
51
|
+
verbose: boolean;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'video';
|
|
54
|
+
codec: Codec;
|
|
55
|
+
imageFormat: StillImageFormat;
|
|
56
|
+
quality: number | null;
|
|
57
|
+
scale: number;
|
|
58
|
+
verbose: boolean;
|
|
59
|
+
};
|
|
18
60
|
export declare type AddRenderRequest = {
|
|
19
61
|
compositionId: string;
|
|
20
|
-
type: 'still' | 'composition';
|
|
21
62
|
outName: string;
|
|
22
|
-
};
|
|
63
|
+
} & AddRenderRequestDynamicFields;
|
|
23
64
|
export declare type RemoveRenderRequest = {
|
|
24
65
|
jobId: string;
|
|
25
66
|
};
|
|
26
67
|
export declare type OpenInFileExplorerRequest = {
|
|
27
68
|
directory: string;
|
|
28
69
|
};
|
|
70
|
+
export declare type SubscribeToFileExistenceRequest = {
|
|
71
|
+
file: string;
|
|
72
|
+
};
|
|
73
|
+
export declare type SubscribeToFileExistenceResponse = {
|
|
74
|
+
exists: boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare type UnsubscribeFromFileExistenceRequest = {
|
|
77
|
+
file: string;
|
|
78
|
+
};
|
|
29
79
|
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRetryPayload = void 0;
|
|
4
|
+
const makeRetryPayload = (job) => {
|
|
5
|
+
if (job.type === 'still') {
|
|
6
|
+
return {
|
|
7
|
+
type: 'render',
|
|
8
|
+
compositionId: job.compositionId,
|
|
9
|
+
initialFrame: job.frame,
|
|
10
|
+
initialImageFormat: job.imageFormat,
|
|
11
|
+
initialQuality: job.quality,
|
|
12
|
+
initialOutName: job.outName,
|
|
13
|
+
initialScale: job.scale,
|
|
14
|
+
initialVerbose: job.verbose,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (job.type === 'video') {
|
|
18
|
+
// TODO: Implement correct retry mechanism for video
|
|
19
|
+
return {
|
|
20
|
+
type: 'render',
|
|
21
|
+
compositionId: job.compositionId,
|
|
22
|
+
initialImageFormat: job.imageFormat,
|
|
23
|
+
initialQuality: job.quality,
|
|
24
|
+
initialOutName: job.outName,
|
|
25
|
+
initialScale: job.scale,
|
|
26
|
+
initialVerbose: job.verbose,
|
|
27
|
+
initialFrame: 0,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Job ${JSON.stringify(job)} Not implemented`);
|
|
31
|
+
};
|
|
32
|
+
exports.makeRetryPayload = makeRetryPayload;
|
|
@@ -3,22 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.openDirectoryInFinder = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const os_1 = require("os");
|
|
6
|
+
const truthy_1 = require("../../truthy");
|
|
6
7
|
const openDirectoryInFinder = (dirToOpen) => {
|
|
7
8
|
const command = (0, os_1.platform)() === 'darwin'
|
|
8
9
|
? 'open'
|
|
9
10
|
: (0, os_1.platform)() === 'linux'
|
|
10
11
|
? 'xdg-open'
|
|
11
|
-
: '
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
: 'start';
|
|
13
|
+
const p = (0, child_process_1.spawn)(command, [(0, os_1.platform)() === 'darwin' ? '-R' : null, dirToOpen].filter(truthy_1.truthy));
|
|
14
|
+
const stderrChunks = [];
|
|
15
|
+
p.stderr.on('data', (d) => stderrChunks.push(d));
|
|
15
16
|
return new Promise((resolve, reject) => {
|
|
16
17
|
p.on('exit', (code) => {
|
|
17
18
|
if (code === 0) {
|
|
18
19
|
resolve();
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
21
|
-
|
|
22
|
+
const message = Buffer.concat(stderrChunks).toString('utf-8');
|
|
23
|
+
reject(new Error(message));
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
26
|
p.on('error', (err) => {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JobProgressCallback, RenderJob } from './job';
|
|
2
|
+
export declare const processStill: ({ job, remotionRoot, entryPoint, onProgress, }: {
|
|
3
|
+
job: RenderJob;
|
|
4
|
+
remotionRoot: string;
|
|
5
|
+
entryPoint: string;
|
|
6
|
+
onProgress: JobProgressCallback;
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processStill = void 0;
|
|
4
|
+
const convert_entry_point_to_serve_url_1 = require("../../convert-entry-point-to-serve-url");
|
|
5
|
+
const get_cli_options_1 = require("../../get-cli-options");
|
|
6
|
+
const still_1 = require("../../render-flows/still");
|
|
7
|
+
const processStill = async ({ job, remotionRoot, entryPoint, onProgress, }) => {
|
|
8
|
+
var _a;
|
|
9
|
+
if (job.type !== 'still') {
|
|
10
|
+
throw new Error('Expected still job');
|
|
11
|
+
}
|
|
12
|
+
const { publicDir, browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, port, browser, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({
|
|
13
|
+
isLambda: false,
|
|
14
|
+
type: 'still',
|
|
15
|
+
remotionRoot,
|
|
16
|
+
});
|
|
17
|
+
const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(entryPoint);
|
|
18
|
+
await (0, still_1.renderStillFlow)({
|
|
19
|
+
remotionRoot,
|
|
20
|
+
browser,
|
|
21
|
+
browserExecutable,
|
|
22
|
+
chromiumOptions,
|
|
23
|
+
entryPointReason: 'same as preview',
|
|
24
|
+
envVariables,
|
|
25
|
+
ffmpegExecutable,
|
|
26
|
+
ffprobeExecutable,
|
|
27
|
+
height: null,
|
|
28
|
+
fullEntryPoint,
|
|
29
|
+
inputProps,
|
|
30
|
+
overwrite: true,
|
|
31
|
+
port,
|
|
32
|
+
publicDir,
|
|
33
|
+
puppeteerTimeout,
|
|
34
|
+
quality: (_a = job.quality) !== null && _a !== void 0 ? _a : undefined,
|
|
35
|
+
remainingArgs: [],
|
|
36
|
+
scale: job.scale,
|
|
37
|
+
stillFrame: job.frame,
|
|
38
|
+
width: null,
|
|
39
|
+
compositionIdFromUi: job.compositionId,
|
|
40
|
+
imageFormatFromUi: job.imageFormat,
|
|
41
|
+
configFileImageFormat: undefined,
|
|
42
|
+
logLevel: job.verbose ? 'verbose' : 'info',
|
|
43
|
+
onProgress,
|
|
44
|
+
indentOutput: true,
|
|
45
|
+
});
|
|
46
|
+
// TODO: Allow cancel signal
|
|
47
|
+
// TODO: Accept CLI options
|
|
48
|
+
};
|
|
49
|
+
exports.processStill = processStill;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JobProgressCallback, RenderJob } from './job';
|
|
2
|
+
export declare const processVideoJob: ({ job, remotionRoot, entryPoint, onProgress, }: {
|
|
3
|
+
job: RenderJob;
|
|
4
|
+
remotionRoot: string;
|
|
5
|
+
entryPoint: string;
|
|
6
|
+
onProgress: JobProgressCallback;
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processVideoJob = void 0;
|
|
4
|
+
const convert_entry_point_to_serve_url_1 = require("../../convert-entry-point-to-serve-url");
|
|
5
|
+
const get_cli_options_1 = require("../../get-cli-options");
|
|
6
|
+
const render_1 = require("../../render-flows/render");
|
|
7
|
+
const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, }) => {
|
|
8
|
+
var _a;
|
|
9
|
+
if (job.type !== 'video') {
|
|
10
|
+
throw new Error('Expected still job');
|
|
11
|
+
}
|
|
12
|
+
const { publicDir, browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, port, browser, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({
|
|
13
|
+
isLambda: false,
|
|
14
|
+
type: 'still',
|
|
15
|
+
remotionRoot,
|
|
16
|
+
});
|
|
17
|
+
const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(entryPoint);
|
|
18
|
+
await (0, render_1.renderCompFlow)({
|
|
19
|
+
remotionRoot,
|
|
20
|
+
browser,
|
|
21
|
+
browserExecutable,
|
|
22
|
+
chromiumOptions,
|
|
23
|
+
entryPointReason: 'same as preview',
|
|
24
|
+
envVariables,
|
|
25
|
+
ffmpegExecutable,
|
|
26
|
+
ffprobeExecutable,
|
|
27
|
+
height: null,
|
|
28
|
+
fullEntryPoint,
|
|
29
|
+
inputProps,
|
|
30
|
+
overwrite: true,
|
|
31
|
+
port,
|
|
32
|
+
publicDir,
|
|
33
|
+
puppeteerTimeout,
|
|
34
|
+
quality: (_a = job.quality) !== null && _a !== void 0 ? _a : undefined,
|
|
35
|
+
remainingArgs: [],
|
|
36
|
+
scale: job.scale,
|
|
37
|
+
width: null,
|
|
38
|
+
compositionIdFromUi: job.compositionId,
|
|
39
|
+
configFileImageFormat: undefined,
|
|
40
|
+
logLevel: job.verbose ? 'verbose' : 'info',
|
|
41
|
+
onProgress,
|
|
42
|
+
indentOutput: true,
|
|
43
|
+
// TODO: Make configurable
|
|
44
|
+
concurrency: null,
|
|
45
|
+
// TODO: Make configurable
|
|
46
|
+
everyNthFrame: 1,
|
|
47
|
+
// TODO: Make configurable
|
|
48
|
+
frameRange: null,
|
|
49
|
+
quiet: false,
|
|
50
|
+
shouldOutputImageSequence: false,
|
|
51
|
+
});
|
|
52
|
+
// TODO: Allow cancel signal
|
|
53
|
+
// TODO: Accept CLI options
|
|
54
|
+
};
|
|
55
|
+
exports.processVideoJob = processVideoJob;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JobProgressCallback, RenderJob, RenderJobWithCleanup } from './job';
|
|
2
|
+
export declare const getRenderQueue: () => RenderJob[];
|
|
3
|
+
export declare const notifyClientsOfJobUpdate: () => void;
|
|
4
|
+
export declare const processJob: ({ job, remotionRoot, entryPoint, onProgress, }: {
|
|
5
|
+
job: RenderJob;
|
|
6
|
+
remotionRoot: string;
|
|
7
|
+
entryPoint: string;
|
|
8
|
+
onProgress: JobProgressCallback;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
export declare const addJob: ({ job, entryPoint, remotionRoot, }: {
|
|
11
|
+
job: RenderJobWithCleanup;
|
|
12
|
+
entryPoint: string;
|
|
13
|
+
remotionRoot: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
export declare const removeJob: (jobId: string) => void;
|
|
16
|
+
export declare const processJobIfPossible: ({ remotionRoot, entryPoint, }: {
|
|
17
|
+
remotionRoot: string;
|
|
18
|
+
entryPoint: string;
|
|
19
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,150 @@
|
|
|
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.processJobIfPossible = exports.removeJob = exports.addJob = exports.processJob = exports.notifyClientsOfJobUpdate = exports.getRenderQueue = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const chalk_1 = require("../../chalk");
|
|
9
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
10
|
+
const log_1 = require("../../log");
|
|
11
|
+
const live_events_1 = require("../live-events");
|
|
12
|
+
const process_still_1 = require("./process-still");
|
|
13
|
+
const process_video_1 = require("./process-video");
|
|
14
|
+
let jobQueue = [];
|
|
15
|
+
const updateJob = (id, updater) => {
|
|
16
|
+
jobQueue = jobQueue.map((j) => {
|
|
17
|
+
if (id === j.id) {
|
|
18
|
+
return updater(j);
|
|
19
|
+
}
|
|
20
|
+
return j;
|
|
21
|
+
});
|
|
22
|
+
(0, exports.notifyClientsOfJobUpdate)();
|
|
23
|
+
};
|
|
24
|
+
const getRenderQueue = () => {
|
|
25
|
+
return jobQueue.map((j) => {
|
|
26
|
+
const { cleanup, ...rest } = j;
|
|
27
|
+
return rest;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.getRenderQueue = getRenderQueue;
|
|
31
|
+
const notifyClientsOfJobUpdate = () => {
|
|
32
|
+
(0, live_events_1.waitForLiveEventsListener)().then((listener) => {
|
|
33
|
+
listener.sendEventToClient({
|
|
34
|
+
type: 'render-queue-updated',
|
|
35
|
+
queue: (0, exports.getRenderQueue)(),
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.notifyClientsOfJobUpdate = notifyClientsOfJobUpdate;
|
|
40
|
+
const processJob = async ({ job, remotionRoot, entryPoint, onProgress, }) => {
|
|
41
|
+
if (job.type === 'still') {
|
|
42
|
+
await (0, process_still_1.processStill)({ job, remotionRoot, entryPoint, onProgress });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (job.type === 'video') {
|
|
46
|
+
await (0, process_video_1.processVideoJob)({ job, remotionRoot, entryPoint, onProgress });
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`Unknown job ${JSON.stringify(job)}`);
|
|
50
|
+
};
|
|
51
|
+
exports.processJob = processJob;
|
|
52
|
+
const addJob = ({ job, entryPoint, remotionRoot, }) => {
|
|
53
|
+
jobQueue.push(job);
|
|
54
|
+
(0, exports.processJobIfPossible)({ entryPoint, remotionRoot });
|
|
55
|
+
(0, exports.notifyClientsOfJobUpdate)();
|
|
56
|
+
};
|
|
57
|
+
exports.addJob = addJob;
|
|
58
|
+
const removeJob = (jobId) => {
|
|
59
|
+
jobQueue = jobQueue.filter((job) => {
|
|
60
|
+
if (job.id === jobId) {
|
|
61
|
+
job.cleanup.forEach((c) => {
|
|
62
|
+
c();
|
|
63
|
+
});
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
(0, exports.notifyClientsOfJobUpdate)();
|
|
69
|
+
};
|
|
70
|
+
exports.removeJob = removeJob;
|
|
71
|
+
const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
72
|
+
const nextJob = jobQueue.find((q) => {
|
|
73
|
+
return q.status === 'idle';
|
|
74
|
+
});
|
|
75
|
+
if (!nextJob) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
updateJob(nextJob.id, (job) => {
|
|
80
|
+
return {
|
|
81
|
+
...job,
|
|
82
|
+
status: 'running',
|
|
83
|
+
progress: 0,
|
|
84
|
+
message: 'Starting job...',
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const startTime = Date.now();
|
|
88
|
+
log_1.Log.info(chalk_1.chalk.gray('╭─ Starting render '));
|
|
89
|
+
await (0, exports.processJob)({
|
|
90
|
+
job: nextJob,
|
|
91
|
+
entryPoint,
|
|
92
|
+
remotionRoot,
|
|
93
|
+
onProgress: ({ message, progress }) => {
|
|
94
|
+
updateJob(nextJob.id, (job) => {
|
|
95
|
+
return {
|
|
96
|
+
...job,
|
|
97
|
+
status: 'running',
|
|
98
|
+
progress,
|
|
99
|
+
message,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
log_1.Log.info(chalk_1.chalk.gray('╰─ Done in ' + (Date.now() - startTime) + 'ms.'));
|
|
105
|
+
const { unwatch } = (0, file_watcher_1.installFileWatcher)({
|
|
106
|
+
file: path_1.default.resolve(remotionRoot, nextJob.outName),
|
|
107
|
+
onChange: (type) => {
|
|
108
|
+
if (type === 'created') {
|
|
109
|
+
updateJob(nextJob.id, (job) => ({
|
|
110
|
+
...job,
|
|
111
|
+
deletedOutputLocation: false,
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
if (type === 'deleted') {
|
|
115
|
+
updateJob(nextJob.id, (job) => ({
|
|
116
|
+
...job,
|
|
117
|
+
deletedOutputLocation: true,
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
updateJob(nextJob.id, (job) => ({
|
|
123
|
+
...job,
|
|
124
|
+
status: 'done',
|
|
125
|
+
cleanup: [...job.cleanup, unwatch],
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
// TODO: Tell to look in preview to find the error
|
|
130
|
+
log_1.Log.error(chalk_1.chalk.gray('╰─ Render failed:'), err);
|
|
131
|
+
updateJob(nextJob.id, (job) => {
|
|
132
|
+
return {
|
|
133
|
+
...job,
|
|
134
|
+
status: 'failed',
|
|
135
|
+
error: {
|
|
136
|
+
message: err.message,
|
|
137
|
+
stack: err.stack,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
(0, live_events_1.waitForLiveEventsListener)().then((listener) => {
|
|
142
|
+
listener.sendEventToClient({
|
|
143
|
+
type: 'render-job-failed',
|
|
144
|
+
compositionId: nextJob.compositionId,
|
|
145
|
+
error: err,
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
exports.processJobIfPossible = processJobIfPossible;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleRemoveRender = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
4
|
const parse_body_1 = require("../parse-body");
|
|
5
|
+
const queue_1 = require("./queue");
|
|
6
6
|
const handleRemoveRender = async (req, res) => {
|
|
7
7
|
if (req.method === 'OPTIONS') {
|
|
8
8
|
res.statusCode = 200;
|
|
9
9
|
res.end();
|
|
10
|
+
return;
|
|
10
11
|
}
|
|
11
12
|
try {
|
|
12
13
|
const body = (await (0, parse_body_1.parseRequestBody)(req));
|
|
13
|
-
(0,
|
|
14
|
+
(0, queue_1.removeJob)(body.jobId);
|
|
14
15
|
res.setHeader('content-type', 'application/json');
|
|
15
16
|
res.writeHead(200);
|
|
16
17
|
res.end(JSON.stringify({
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAddRender = void 0;
|
|
4
|
+
const queue_1 = require("../render-queue/queue");
|
|
5
|
+
const handleAddRender = ({ input, entryPoint, remotionRoot, }) => {
|
|
6
|
+
const id = String(Math.random()).replace('0.', '');
|
|
7
|
+
if (input.type === 'video') {
|
|
8
|
+
(0, queue_1.addJob)({
|
|
9
|
+
entryPoint,
|
|
10
|
+
remotionRoot,
|
|
11
|
+
job: {
|
|
12
|
+
cleanup: [],
|
|
13
|
+
// TODO: Allow to change codec
|
|
14
|
+
codec: 'h264',
|
|
15
|
+
compositionId: input.compositionId,
|
|
16
|
+
deletedOutputLocation: false,
|
|
17
|
+
type: 'video',
|
|
18
|
+
status: 'idle',
|
|
19
|
+
id,
|
|
20
|
+
imageFormat: input.imageFormat,
|
|
21
|
+
outName: input.outName,
|
|
22
|
+
quality: input.quality,
|
|
23
|
+
scale: input.scale,
|
|
24
|
+
startedAt: Date.now(),
|
|
25
|
+
verbose: input.verbose,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (input.type === 'still') {
|
|
30
|
+
(0, queue_1.addJob)({
|
|
31
|
+
job: {
|
|
32
|
+
compositionId: input.compositionId,
|
|
33
|
+
id: String(Math.random()).replace('0.', ''),
|
|
34
|
+
startedAt: Date.now(),
|
|
35
|
+
type: 'still',
|
|
36
|
+
outName: input.outName,
|
|
37
|
+
status: 'idle',
|
|
38
|
+
imageFormat: input.imageFormat,
|
|
39
|
+
quality: input.quality,
|
|
40
|
+
frame: input.frame,
|
|
41
|
+
scale: input.scale,
|
|
42
|
+
cleanup: [],
|
|
43
|
+
deletedOutputLocation: false,
|
|
44
|
+
verbose: input.verbose,
|
|
45
|
+
},
|
|
46
|
+
entryPoint,
|
|
47
|
+
remotionRoot,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return Promise.resolve(undefined);
|
|
51
|
+
};
|
|
52
|
+
exports.handleAddRender = handleAddRender;
|
|
@@ -0,0 +1,14 @@
|
|
|
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.handleOpenInFileExplorer = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const open_directory_in_finder_1 = require("../render-queue/open-directory-in-finder");
|
|
9
|
+
const handleOpenInFileExplorer = ({ input: { directory }, remotionRoot }) => {
|
|
10
|
+
const actualDirectory = path_1.default.resolve(remotionRoot, directory);
|
|
11
|
+
// TODO: Disallow opening file that is not in Remotion CWD
|
|
12
|
+
return (0, open_directory_in_finder_1.openDirectoryInFinder)(actualDirectory);
|
|
13
|
+
};
|
|
14
|
+
exports.handleOpenInFileExplorer = handleOpenInFileExplorer;
|