@remotion/renderer 3.0.0 → 3.0.1
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/.prettierrc.js +14 -0
- package/dist/assets/download-and-map-assets-to-file.d.ts.map +1 -1
- package/dist/assets/download-and-map-assets-to-file.js +1 -1
- package/dist/assets/download-and-map-assets-to-file.js.map +1 -1
- package/dist/assets/read-file.d.ts +1 -1
- package/dist/assets/read-file.d.ts.map +1 -1
- package/dist/assets/read-file.js +17 -1
- package/dist/assets/read-file.js.map +1 -1
- package/dist/assets-to-ffmpeg-inputs.d.ts +1 -4
- package/dist/assets-to-ffmpeg-inputs.d.ts.map +1 -1
- package/dist/create-ffmpeg-complex-filter.d.ts +1 -4
- package/dist/create-ffmpeg-complex-filter.d.ts.map +1 -1
- package/dist/error-handling/handle-javascript-exception.js +1 -1
- package/dist/error-handling/handle-javascript-exception.js.map +1 -1
- package/dist/get-compositions.js +1 -1
- package/dist/get-compositions.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/open-browser.js +1 -1
- package/dist/open-browser.js.map +1 -1
- package/dist/provide-screenshot.d.ts +1 -0
- package/dist/provide-screenshot.d.ts.map +1 -1
- package/dist/puppeteer-screenshot.d.ts +1 -0
- package/dist/puppeteer-screenshot.d.ts.map +1 -1
- package/dist/render-frames.d.ts +45 -0
- package/dist/render-frames.d.ts.map +1 -0
- package/dist/render-frames.js +245 -0
- package/dist/render-frames.js.map +1 -0
- package/dist/render-media.d.ts +2 -2
- package/dist/render-media.d.ts.map +1 -1
- package/dist/render-media.js +12 -12
- package/dist/render-media.js.map +1 -1
- package/dist/screenshot-dom-element.d.ts +1 -0
- package/dist/screenshot-dom-element.d.ts.map +1 -1
- package/dist/screenshot-task.d.ts +1 -0
- package/dist/screenshot-task.d.ts.map +1 -1
- package/dist/screenshot-task.js.map +1 -1
- package/dist/stitch-frames-to-video.d.ts +32 -0
- package/dist/stitch-frames-to-video.d.ts.map +1 -0
- package/dist/stitch-frames-to-video.js +204 -0
- package/dist/stitch-frames-to-video.js.map +1 -0
- package/dist/symbolicate-stacktrace.d.ts +1 -1
- package/dist/symbolicate-stacktrace.d.ts.map +1 -1
- package/dist/symbolicate-stacktrace.js +8 -5
- package/dist/symbolicate-stacktrace.js.map +1 -1
- package/dist/validate-ffmpeg.js +1 -1
- package/dist/validate-ffmpeg.js.map +1 -1
- package/package.json +6 -6
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-lint.log +0 -27
- package/.turbo/turbo-test.log +0 -34
- package/dist/convert-mp3-to-pcm.d.ts +0 -7
- package/dist/convert-mp3-to-pcm.d.ts.map +0 -1
- package/dist/convert-mp3-to-pcm.js +0 -41
- package/dist/convert-mp3-to-pcm.js.map +0 -1
- package/dist/get-frame-number-length.d.ts +0 -8
- package/dist/get-frame-number-length.d.ts.map +0 -1
- package/dist/get-frame-number-length.js +0 -30
- package/dist/get-frame-number-length.js.map +0 -1
- package/dist/get-frame-range.d.ts +0 -3
- package/dist/get-frame-range.d.ts.map +0 -1
- package/dist/get-frame-range.js +0 -23
- package/dist/get-frame-range.js.map +0 -1
- package/dist/handle-javascript-exception.d.ts +0 -32
- package/dist/handle-javascript-exception.d.ts.map +0 -1
- package/dist/handle-javascript-exception.js +0 -82
- package/dist/handle-javascript-exception.js.map +0 -1
- package/dist/handle-null-audio.d.ts +0 -1
- package/dist/handle-null-audio.d.ts.map +0 -1
- package/dist/handle-null-audio.js +0 -2
- package/dist/handle-null-audio.js.map +0 -1
- package/dist/is-local-file.d.ts +0 -2
- package/dist/is-local-file.d.ts.map +0 -1
- package/dist/is-local-file.js +0 -13
- package/dist/is-local-file.js.map +0 -1
- package/dist/min-max.d.ts +0 -3
- package/dist/min-max.d.ts.map +0 -1
- package/dist/min-max.js +0 -34
- package/dist/min-max.js.map +0 -1
- package/dist/render-video.d.ts +0 -38
- package/dist/render-video.d.ts.map +0 -1
- package/dist/render-video.js +0 -169
- package/dist/render-video.js.map +0 -1
- package/dist/validate-frame.d.ts +0 -2
- package/dist/validate-frame.d.ts.map +0 -1
- package/dist/validate-frame.js +0 -25
- package/dist/validate-frame.js.map +0 -1
- package/dist/validate-quality.d.ts +0 -1
- package/dist/validate-quality.d.ts.map +0 -1
- package/dist/validate-quality.js +0 -2
- package/dist/validate-quality.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
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.renderFrames = exports.innerRenderFrames = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const remotion_1 = require("remotion");
|
|
10
|
+
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
11
|
+
const cycle_browser_tabs_1 = require("./cycle-browser-tabs");
|
|
12
|
+
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
13
|
+
const get_concurrency_1 = require("./get-concurrency");
|
|
14
|
+
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
15
|
+
const image_format_1 = require("./image-format");
|
|
16
|
+
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
17
|
+
const make_assets_download_dir_1 = require("./make-assets-download-dir");
|
|
18
|
+
const open_browser_1 = require("./open-browser");
|
|
19
|
+
const pool_1 = require("./pool");
|
|
20
|
+
const prepare_server_1 = require("./prepare-server");
|
|
21
|
+
const provide_screenshot_1 = require("./provide-screenshot");
|
|
22
|
+
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
23
|
+
const seek_to_frame_1 = require("./seek-to-frame");
|
|
24
|
+
const set_props_and_env_1 = require("./set-props-and-env");
|
|
25
|
+
const validate_scale_1 = require("./validate-scale");
|
|
26
|
+
const getComposition = (others) => {
|
|
27
|
+
if ('composition' in others) {
|
|
28
|
+
return others.composition;
|
|
29
|
+
}
|
|
30
|
+
if ('config' in others) {
|
|
31
|
+
return others.config;
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
const innerRenderFrames = async ({ parallelism, onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_IMAGE_FORMAT, frameRange, puppeteerInstance, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, }) => {
|
|
36
|
+
if (!puppeteerInstance) {
|
|
37
|
+
throw new Error('weird');
|
|
38
|
+
}
|
|
39
|
+
const actualParallelism = (0, get_concurrency_1.getActualConcurrency)(parallelism !== null && parallelism !== void 0 ? parallelism : null);
|
|
40
|
+
if (outputDir) {
|
|
41
|
+
if (!fs_1.default.existsSync(outputDir)) {
|
|
42
|
+
fs_1.default.mkdirSync(outputDir, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null);
|
|
48
|
+
const frameCount = realFrameRange[1] - realFrameRange[0] + 1;
|
|
49
|
+
const pages = new Array(actualParallelism).fill(true).map(async () => {
|
|
50
|
+
const page = await puppeteerInstance.newPage();
|
|
51
|
+
pagesArray.push(page);
|
|
52
|
+
page.setViewport({
|
|
53
|
+
width: composition.width,
|
|
54
|
+
height: composition.height,
|
|
55
|
+
deviceScaleFactor: scale !== null && scale !== void 0 ? scale : 1,
|
|
56
|
+
});
|
|
57
|
+
const logCallback = (log) => {
|
|
58
|
+
onBrowserLog === null || onBrowserLog === void 0 ? void 0 : onBrowserLog({
|
|
59
|
+
stackTrace: log.stackTrace(),
|
|
60
|
+
text: log.text(),
|
|
61
|
+
type: log.type(),
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
if (onBrowserLog) {
|
|
65
|
+
page.on('console', logCallback);
|
|
66
|
+
}
|
|
67
|
+
const initialFrame = typeof frameRange === 'number'
|
|
68
|
+
? frameRange
|
|
69
|
+
: frameRange === null || frameRange === undefined
|
|
70
|
+
? 0
|
|
71
|
+
: frameRange[0];
|
|
72
|
+
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
73
|
+
inputProps,
|
|
74
|
+
envVariables,
|
|
75
|
+
page,
|
|
76
|
+
serveUrl,
|
|
77
|
+
initialFrame,
|
|
78
|
+
timeoutInMilliseconds,
|
|
79
|
+
});
|
|
80
|
+
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
81
|
+
pageFunction: (id) => {
|
|
82
|
+
window.setBundleMode({
|
|
83
|
+
type: 'composition',
|
|
84
|
+
compositionName: id,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
args: [composition.id],
|
|
88
|
+
frame: null,
|
|
89
|
+
page,
|
|
90
|
+
});
|
|
91
|
+
page.off('console', logCallback);
|
|
92
|
+
return page;
|
|
93
|
+
});
|
|
94
|
+
const puppeteerPages = await Promise.all(pages);
|
|
95
|
+
const pool = new pool_1.Pool(puppeteerPages);
|
|
96
|
+
const [firstFrameIndex, lastFrameIndex] = realFrameRange;
|
|
97
|
+
// Substract one because 100 frames will be 00-99
|
|
98
|
+
// --> 2 digits
|
|
99
|
+
const filePadLength = String(lastFrameIndex).length;
|
|
100
|
+
let framesRendered = 0;
|
|
101
|
+
onStart({
|
|
102
|
+
frameCount,
|
|
103
|
+
});
|
|
104
|
+
const downloadDir = (0, make_assets_download_dir_1.makeAssetsDownloadTmpDir)();
|
|
105
|
+
const assets = new Array(frameCount).fill(undefined);
|
|
106
|
+
await Promise.all(new Array(frameCount)
|
|
107
|
+
.fill(Boolean)
|
|
108
|
+
.map((x, i) => i)
|
|
109
|
+
.map(async (index) => {
|
|
110
|
+
const frame = realFrameRange[0] + index;
|
|
111
|
+
const freePage = await pool.acquire();
|
|
112
|
+
const paddedIndex = String(frame).padStart(filePadLength, '0');
|
|
113
|
+
const errorCallbackOnFrame = (err) => {
|
|
114
|
+
onError(err);
|
|
115
|
+
};
|
|
116
|
+
const cleanupPageError = (0, handle_javascript_exception_1.handleJavascriptException)({
|
|
117
|
+
page: freePage,
|
|
118
|
+
onError: errorCallbackOnFrame,
|
|
119
|
+
frame,
|
|
120
|
+
});
|
|
121
|
+
freePage.on('error', errorCallbackOnFrame);
|
|
122
|
+
await (0, seek_to_frame_1.seekToFrame)({ frame, page: freePage });
|
|
123
|
+
if (imageFormat !== 'none') {
|
|
124
|
+
if (onFrameBuffer) {
|
|
125
|
+
const buffer = await (0, provide_screenshot_1.provideScreenshot)({
|
|
126
|
+
page: freePage,
|
|
127
|
+
imageFormat,
|
|
128
|
+
quality,
|
|
129
|
+
options: {
|
|
130
|
+
frame,
|
|
131
|
+
output: undefined,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
onFrameBuffer(buffer, frame);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (!outputDir) {
|
|
138
|
+
throw new Error('Called renderFrames() without specifying either `outputDir` or `onFrameBuffer`');
|
|
139
|
+
}
|
|
140
|
+
const output = path_1.default.join(outputDir, `element-${paddedIndex}.${imageFormat}`);
|
|
141
|
+
await (0, provide_screenshot_1.provideScreenshot)({
|
|
142
|
+
page: freePage,
|
|
143
|
+
imageFormat,
|
|
144
|
+
quality,
|
|
145
|
+
options: {
|
|
146
|
+
frame,
|
|
147
|
+
output,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const collectedAssets = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
153
|
+
pageFunction: () => {
|
|
154
|
+
return window.remotion_collectAssets();
|
|
155
|
+
},
|
|
156
|
+
args: [],
|
|
157
|
+
frame,
|
|
158
|
+
page: freePage,
|
|
159
|
+
});
|
|
160
|
+
const compressedAssets = collectedAssets.map((asset) => remotion_1.Internals.AssetCompression.compressAsset(assets.filter(remotion_1.Internals.truthy).flat(1), asset));
|
|
161
|
+
assets[index] = compressedAssets;
|
|
162
|
+
compressedAssets.forEach((asset) => {
|
|
163
|
+
(0, download_and_map_assets_to_file_1.downloadAndMapAssetsToFileUrl)({
|
|
164
|
+
asset,
|
|
165
|
+
downloadDir,
|
|
166
|
+
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
167
|
+
}).catch((err) => {
|
|
168
|
+
onError(new Error(`Error while downloading asset: ${err.stack}`));
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
pool.release(freePage);
|
|
172
|
+
framesRendered++;
|
|
173
|
+
onFrameUpdate(framesRendered, frame);
|
|
174
|
+
cleanupPageError();
|
|
175
|
+
freePage.off('error', errorCallbackOnFrame);
|
|
176
|
+
return compressedAssets;
|
|
177
|
+
}));
|
|
178
|
+
const returnValue = {
|
|
179
|
+
assetsInfo: {
|
|
180
|
+
assets,
|
|
181
|
+
downloadDir,
|
|
182
|
+
firstFrameIndex,
|
|
183
|
+
imageSequenceName: `element-%0${filePadLength}d.${imageFormat}`,
|
|
184
|
+
},
|
|
185
|
+
frameCount,
|
|
186
|
+
};
|
|
187
|
+
return returnValue;
|
|
188
|
+
};
|
|
189
|
+
exports.innerRenderFrames = innerRenderFrames;
|
|
190
|
+
const renderFrames = async (options) => {
|
|
191
|
+
var _a;
|
|
192
|
+
const composition = getComposition(options);
|
|
193
|
+
if (!composition) {
|
|
194
|
+
throw new Error('No `composition` option has been specified for renderFrames()');
|
|
195
|
+
}
|
|
196
|
+
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
|
|
197
|
+
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderFrames()`');
|
|
198
|
+
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderFrames()`');
|
|
199
|
+
remotion_1.Internals.validateDurationInFrames(composition.durationInFrames, 'in the `config` object passed to `renderFrames()`');
|
|
200
|
+
if (options.quality !== undefined && options.imageFormat !== 'jpeg') {
|
|
201
|
+
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
202
|
+
}
|
|
203
|
+
const selectedServeUrl = (0, legacy_webpack_config_1.getServeUrlWithFallback)(options);
|
|
204
|
+
remotion_1.Internals.validateQuality(options.quality);
|
|
205
|
+
(0, validate_scale_1.validateScale)(options.scale);
|
|
206
|
+
const { closeServer, serveUrl } = await (0, prepare_server_1.prepareServer)(selectedServeUrl);
|
|
207
|
+
const browserInstance = (_a = options.puppeteerInstance) !== null && _a !== void 0 ? _a : (await (0, open_browser_1.openBrowser)(remotion_1.Internals.DEFAULT_BROWSER, {
|
|
208
|
+
shouldDumpIo: options.dumpBrowserLogs,
|
|
209
|
+
browserExecutable: options.browserExecutable,
|
|
210
|
+
chromiumOptions: options.chromiumOptions,
|
|
211
|
+
}));
|
|
212
|
+
const { stopCycling } = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserInstance);
|
|
213
|
+
const openedPages = [];
|
|
214
|
+
return new Promise((resolve, reject) => {
|
|
215
|
+
(0, exports.innerRenderFrames)({
|
|
216
|
+
...options,
|
|
217
|
+
puppeteerInstance: browserInstance,
|
|
218
|
+
onError: (err) => reject(err),
|
|
219
|
+
pagesArray: openedPages,
|
|
220
|
+
serveUrl,
|
|
221
|
+
composition,
|
|
222
|
+
})
|
|
223
|
+
.then((res) => resolve(res))
|
|
224
|
+
.catch((err) => reject(err))
|
|
225
|
+
.finally(() => {
|
|
226
|
+
// If browser instance was passed in, we close all the pages
|
|
227
|
+
// we opened.
|
|
228
|
+
// If new browser was opened, then closing the browser as a cleanup.
|
|
229
|
+
if (options.puppeteerInstance) {
|
|
230
|
+
Promise.all(openedPages.map((p) => p.close())).catch((err) => {
|
|
231
|
+
console.log('Unable to close browser tab', err);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
browserInstance.close().catch((err) => {
|
|
236
|
+
console.log('Unable to close browser', err);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
stopCycling();
|
|
240
|
+
closeServer();
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
exports.renderFrames = renderFrames;
|
|
245
|
+
//# sourceMappingURL=render-frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-frames.js","sourceRoot":"","sources":["../src/render-frames.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAMxB,uCAOkB;AAClB,8FAGkD;AAElD,6DAAsD;AACtD,8FAAuF;AACvF,uDAAuD;AACvD,+DAAwD;AACxD,iDAAoD;AACpD,mEAGiC;AACjC,yEAAoE;AACpE,iDAA4D;AAC5D,iCAA4B;AAC5B,qDAA+C;AAC/C,6DAAuD;AACvD,6DAAgE;AAChE,mDAA4C;AAC5C,2DAAmD;AAEnD,qDAA+C;AAmC/C,MAAM,cAAc,GAAG,CAAC,MAA2B,EAAE,EAAE;IACtD,IAAI,aAAa,IAAI,MAAM,EAAE;QAC5B,OAAO,MAAM,CAAC,WAAW,CAAC;KAC1B;IAED,IAAI,QAAQ,IAAI,MAAM,EAAE;QACvB,OAAO,MAAM,CAAC,MAAM,CAAC;KACrB;IAED,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACvC,WAAW,EACX,aAAa,EACb,SAAS,EACT,OAAO,EACP,UAAU,EACV,OAAO,EACP,WAAW,GAAG,mCAAoB,EAClC,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,KAAK,GAML,EAA+B,EAAE;IACjC,IAAI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,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBAC5D,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;gBACjD,CAAC,CAAC,CAAC;aACH;iBAAM;gBACN,eAAe,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACrC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;gBAC7C,CAAC,CAAC,CAAC;aACH;YAED,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAnFW,QAAA,YAAY,gBAmFvB"}
|
package/dist/render-media.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Browser as PuppeteerBrowser } from 'puppeteer-core';
|
|
2
2
|
import { Codec, FfmpegExecutable, FrameRange, PixelFormat, ProResProfile, SmallTCompMetadata } from 'remotion';
|
|
3
|
-
import { BrowserLog } from './browser-log';
|
|
4
|
-
import { OnStartData } from './types';
|
|
5
3
|
import { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
|
+
import { BrowserLog } from './browser-log';
|
|
6
5
|
import { ServeUrlOrWebpackBundle } from './legacy-webpack-config';
|
|
7
6
|
import { ChromiumOptions } from './open-browser';
|
|
7
|
+
import { OnStartData } from './types';
|
|
8
8
|
export declare type StitchingState = 'encoding' | 'muxing';
|
|
9
9
|
export declare type RenderMediaOnProgress = (progress: {
|
|
10
10
|
renderedFrames: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-media.d.ts","sourceRoot":"","sources":["../src/render-media.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACN,KAAK,EACL,gBAAgB,EAChB,UAAU,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ACpC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACvD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,uBAAuB,CAAC;AAI5B,eAAO,MAAM,WAAW,gUAyBrB,kBAAkB,kBAuLpB,CAAC"}
|
package/dist/render-media.js
CHANGED
|
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderMedia = void 0;
|
|
7
|
-
const os_1 = __importDefault(require("os"));
|
|
8
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
|
-
const
|
|
12
|
-
const render_1 = require("./render");
|
|
13
|
-
const tmp_dir_1 = require("./tmp-dir");
|
|
14
|
-
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
15
|
-
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
16
|
-
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
11
|
+
const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
|
|
17
12
|
const ensure_frames_in_order_1 = require("./ensure-frames-in-order");
|
|
13
|
+
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
14
|
+
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
18
15
|
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
16
|
+
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
17
|
+
const render_frames_1 = require("./render-frames");
|
|
18
|
+
const stitch_frames_to_video_1 = require("./stitch-frames-to-video");
|
|
19
|
+
const tmp_dir_1 = require("./tmp-dir");
|
|
21
20
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
21
|
+
const validate_scale_1 = require("./validate-scale");
|
|
22
22
|
const renderMedia = async ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, ...options }) => {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
remotion_1.Internals.validateQuality(quality);
|
|
@@ -61,7 +61,7 @@ const renderMedia = async ({ parallelism, proResProfile, crf, composition, image
|
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
if (preEncodedFileLocation) {
|
|
64
|
-
preStitcher = await (0,
|
|
64
|
+
preStitcher = await (0, stitch_frames_to_video_1.spawnFfmpeg)({
|
|
65
65
|
width: composition.width * (scale !== null && scale !== void 0 ? scale : 1),
|
|
66
66
|
height: composition.height * (scale !== null && scale !== void 0 ? scale : 1),
|
|
67
67
|
fps: composition.fps,
|
|
@@ -87,7 +87,7 @@ const renderMedia = async ({ parallelism, proResProfile, crf, composition, image
|
|
|
87
87
|
stitcherFfmpeg = preStitcher.task;
|
|
88
88
|
}
|
|
89
89
|
const { waitForRightTimeOfFrameToBeInserted, setFrameToStitch, waitForFinish, } = (0, ensure_frames_in_order_1.ensureFramesInOrder)((0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null));
|
|
90
|
-
const { assetsInfo } = await (0,
|
|
90
|
+
const { assetsInfo } = await (0, render_frames_1.renderFrames)({
|
|
91
91
|
config: composition,
|
|
92
92
|
onFrameUpdate: (frame) => {
|
|
93
93
|
renderedFrames = frame;
|
|
@@ -139,7 +139,7 @@ const renderMedia = async ({ parallelism, proResProfile, crf, composition, image
|
|
|
139
139
|
callUpdate();
|
|
140
140
|
(0, ensure_output_directory_1.ensureOutputDirectory)(outputLocation);
|
|
141
141
|
const stitchStart = Date.now();
|
|
142
|
-
await (0,
|
|
142
|
+
await (0, stitch_frames_to_video_1.stitchFramesToVideo)({
|
|
143
143
|
width: composition.width * (scale !== null && scale !== void 0 ? scale : 1),
|
|
144
144
|
height: composition.height * (scale !== null && scale !== void 0 ? scale : 1),
|
|
145
145
|
fps: composition.fps,
|
package/dist/render-media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-media.js","sourceRoot":"","sources":["../src/render-media.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AAExB,uCAQkB;
|
|
1
|
+
{"version":3,"file":"render-media.js","sourceRoot":"","sources":["../src/render-media.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AAExB,uCAQkB;AAGlB,2EAAmE;AACnE,qEAA6D;AAC7D,uEAAgE;AAChE,yEAAqE;AACrE,+DAAwD;AACxD,mEAGiC;AAEjC,mDAA6C;AAC7C,qEAA0E;AAC1E,uCAAiC;AAEjC,+FAAsF;AACtF,qDAA+C;AAwCxC,MAA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V,gBAAgB;YAChB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC7B,WAAW,GAAG,QAAQ,CAAC;gBACvB,aAAa,GAAG,KAAK,CAAC;gBACtB,UAAU,EAAE,CAAC;YACd,CAAC;YACD,UAAU;YACV,OAAO,EAAE,oBAAS,CAAC,OAAO,CAAC,sBAAsB,CAChD,oBAAS,CAAC,OAAO,CAAC,WAAW,EAAE,EAC/B,SAAS,CACT;YACD,GAAG,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,SAAS;SAC3B,CAAC,CAAC;QACH,aAAa,GAAG,WAAW,CAAC,gBAAgB,CAAC;QAC7C,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;QACzC,UAAU,EAAE,CAAC;KACb;YAAS;QACT,IACC,sBAAsB,KAAK,IAAI;YAC/B,YAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,EACpC;YACD,YAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;SACtC;KACD;AACF,CAAC,CAAC;AAhNW,QAAA,WAAW,eAgNtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-dom-element.d.ts","sourceRoot":"","sources":["../src/screenshot-dom-element.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAIrC,eAAO,MAAM,oBAAoB;UAM1B,UAAU,IAAI;iBACP,WAAW;aACf,MAAM,GAAG,SAAS;;;;;MAKxB,QAAQ,MAAM,CAoCjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"screenshot-dom-element.d.ts","sourceRoot":"","sources":["../src/screenshot-dom-element.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAIrC,eAAO,MAAM,oBAAoB;UAM1B,UAAU,IAAI;iBACP,WAAW;aACf,MAAM,GAAG,SAAS;;;;;MAKxB,QAAQ,MAAM,CAoCjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-task.d.ts","sourceRoot":"","sources":["../src/screenshot-task.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,IAAI,EAAE,iBAAiB,EAAS,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAY,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,eAAe,SACrB,IAAI,UACF,gBAAgB,WACf,iBAAiB,KACxB,QAAQ,MAAM,GAAG,MAAM,CAqCzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"screenshot-task.d.ts","sourceRoot":"","sources":["../src/screenshot-task.ts"],"names":[],"mappings":";AACA,OAAO,EAAa,IAAI,EAAE,iBAAiB,EAAS,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAY,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,eAAe,SACrB,IAAI,UACF,gBAAgB,WACf,iBAAiB,KACxB,QAAQ,MAAM,GAAG,MAAM,CAqCzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-task.js","sourceRoot":"","sources":["../src/screenshot-task.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,uCAAqD;AAE9C,MAAM,eAAe,GAAG,KAAK,EACnC,IAAU,EACV,MAAwB,EACxB,OAA0B,EACC,EAAE;IAC7B,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"screenshot-task.js","sourceRoot":"","sources":["../src/screenshot-task.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,uCAAqD;AAE9C,MAAM,eAAe,GAAG,KAAK,EACnC,IAAU,EACV,MAAwB,EACxB,OAA0B,EACC,EAAE;IAC7B,MAAM,MAAM,GAAI,IAAyC,CAAC,OAAO,CAAC;IAClE,MAAM,MAAM,GAAI,IAA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IAEvC,IAAI,OAAO,CAAC,IAAI;QAAE,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpE,oBAAS,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAzCW,QAAA,eAAe,mBAyC1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import { Codec, FfmpegExecutable, ImageFormat, PixelFormat, ProResProfile, RenderAssetInfo } from 'remotion';
|
|
3
|
+
import { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
|
+
export declare type StitcherOptions = {
|
|
5
|
+
fps: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
outputLocation: string;
|
|
9
|
+
force: boolean;
|
|
10
|
+
assetsInfo: RenderAssetInfo | null;
|
|
11
|
+
pixelFormat?: PixelFormat;
|
|
12
|
+
codec?: Codec;
|
|
13
|
+
crf?: number | null;
|
|
14
|
+
onProgress?: (progress: number) => void;
|
|
15
|
+
onDownload?: RenderMediaOnDownload;
|
|
16
|
+
proResProfile?: ProResProfile;
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
ffmpegExecutable?: FfmpegExecutable;
|
|
19
|
+
dir?: string;
|
|
20
|
+
internalOptions?: {
|
|
21
|
+
preEncodedFileLocation: string | null;
|
|
22
|
+
parallelEncoding: boolean;
|
|
23
|
+
imageFormat: ImageFormat;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const spawnFfmpeg: (options: StitcherOptions) => Promise<{
|
|
27
|
+
task: execa.ExecaChildProcess<string>;
|
|
28
|
+
cleanup: (() => void) | undefined;
|
|
29
|
+
getLogs: () => string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const stitchFramesToVideo: (options: StitcherOptions) => Promise<void>;
|
|
32
|
+
//# sourceMappingURL=stitch-frames-to-video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stitch-frames-to-video.d.ts","sourceRoot":"","sources":["../src/stitch-frames-to-video.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACN,KAAK,EACL,gBAAgB,EAChB,WAAW,EAEX,WAAW,EACX,aAAa,EACb,eAAe,EACf,MAAM,UAAU,CAAC;AAIlB,OAAO,EAEN,qBAAqB,EACrB,MAAM,0CAA0C,CAAC;AAalD,oBAAY,eAAe,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE;QACjB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;QACtC,gBAAgB,EAAE,OAAO,CAAC;QAC1B,WAAW,EAAE,WAAW,CAAC;KACzB,CAAC;CACF,CAAC;AA+CF,eAAO,MAAM,WAAW,YAAmB,eAAe;;;;EA0JzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACtB,eAAe,KACtB,QAAQ,IAAI,CASd,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
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.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const remotion_1 = require("remotion");
|
|
9
|
+
const assets_to_ffmpeg_inputs_1 = require("./assets-to-ffmpeg-inputs");
|
|
10
|
+
const calculate_asset_positions_1 = require("./assets/calculate-asset-positions");
|
|
11
|
+
const convert_assets_to_file_urls_1 = require("./assets/convert-assets-to-file-urls");
|
|
12
|
+
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
13
|
+
const get_asset_audio_details_1 = require("./assets/get-asset-audio-details");
|
|
14
|
+
const calculate_ffmpeg_filters_1 = require("./calculate-ffmpeg-filters");
|
|
15
|
+
const create_ffmpeg_complex_filter_1 = require("./create-ffmpeg-complex-filter");
|
|
16
|
+
const get_audio_codec_name_1 = require("./get-audio-codec-name");
|
|
17
|
+
const get_codec_name_1 = require("./get-codec-name");
|
|
18
|
+
const get_prores_profile_name_1 = require("./get-prores-profile-name");
|
|
19
|
+
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
20
|
+
const sample_rate_1 = require("./sample-rate");
|
|
21
|
+
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
22
|
+
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
23
|
+
const getAssetsData = async (options) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_CODEC;
|
|
26
|
+
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
27
|
+
const isAudioOnly = encoderName === null;
|
|
28
|
+
const fileUrlAssets = await (options.assetsInfo
|
|
29
|
+
? (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
30
|
+
assets: options.assetsInfo.assets,
|
|
31
|
+
downloadDir: options.assetsInfo.downloadDir,
|
|
32
|
+
onDownload: (_b = options.onDownload) !== null && _b !== void 0 ? _b : (() => () => undefined),
|
|
33
|
+
})
|
|
34
|
+
: null);
|
|
35
|
+
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)();
|
|
36
|
+
const assetPositions = fileUrlAssets === null ? [] : (0, calculate_asset_positions_1.calculateAssetPositions)(fileUrlAssets);
|
|
37
|
+
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)();
|
|
38
|
+
const assetAudioDetails = await (0, get_asset_audio_details_1.getAssetAudioDetails)({
|
|
39
|
+
assetPaths: assetPositions.map((a) => a.src),
|
|
40
|
+
});
|
|
41
|
+
const filters = (0, calculate_ffmpeg_filters_1.calculateFfmpegFilters)({
|
|
42
|
+
assetAudioDetails,
|
|
43
|
+
assetPositions,
|
|
44
|
+
fps: options.fps,
|
|
45
|
+
videoTrackCount: isAudioOnly ? 0 : 1,
|
|
46
|
+
});
|
|
47
|
+
if (options.verbose) {
|
|
48
|
+
console.log('asset positions', assetPositions);
|
|
49
|
+
}
|
|
50
|
+
if (options.verbose) {
|
|
51
|
+
console.log('filters', filters);
|
|
52
|
+
}
|
|
53
|
+
const { complexFilterFlag, cleanup } = await (0, create_ffmpeg_complex_filter_1.createFfmpegComplexFilter)(filters);
|
|
54
|
+
return {
|
|
55
|
+
complexFilterFlag,
|
|
56
|
+
cleanup,
|
|
57
|
+
assetPositions,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const spawnFfmpeg = async (options) => {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
62
|
+
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
63
|
+
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
64
|
+
remotion_1.Internals.validateFps(options.fps, 'passed to `stitchFramesToVideo()`');
|
|
65
|
+
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_CODEC;
|
|
66
|
+
(0, validate_even_dimensions_with_codec_1.validateEvenDimensionsWithCodec)({
|
|
67
|
+
width: options.width,
|
|
68
|
+
height: options.height,
|
|
69
|
+
codec,
|
|
70
|
+
scale: 1,
|
|
71
|
+
});
|
|
72
|
+
const crf = (_b = options.crf) !== null && _b !== void 0 ? _b : remotion_1.Internals.getDefaultCrfForCodec(codec);
|
|
73
|
+
const pixelFormat = (_c = options.pixelFormat) !== null && _c !== void 0 ? _c : remotion_1.Internals.DEFAULT_PIXEL_FORMAT;
|
|
74
|
+
await (0, validate_ffmpeg_1.validateFfmpeg)((_d = options.ffmpegExecutable) !== null && _d !== void 0 ? _d : null);
|
|
75
|
+
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
76
|
+
const audioCodecName = (0, get_audio_codec_name_1.getAudioCodecName)(codec);
|
|
77
|
+
const proResProfileName = (0, get_prores_profile_name_1.getProResProfileName)(codec, options.proResProfile);
|
|
78
|
+
const isAudioOnly = encoderName === null;
|
|
79
|
+
const supportsCrf = encoderName && codec !== 'prores';
|
|
80
|
+
if (options.verbose) {
|
|
81
|
+
console.log('[verbose] ffmpeg', (_e = options.ffmpegExecutable) !== null && _e !== void 0 ? _e : 'ffmpeg in PATH');
|
|
82
|
+
console.log('[verbose] encoder', encoderName);
|
|
83
|
+
console.log('[verbose] audioCodec', audioCodecName);
|
|
84
|
+
console.log('[verbose] pixelFormat', pixelFormat);
|
|
85
|
+
if (supportsCrf) {
|
|
86
|
+
console.log('[verbose] crf', crf);
|
|
87
|
+
}
|
|
88
|
+
console.log('[verbose] codec', codec);
|
|
89
|
+
console.log('[verbose] isAudioOnly', isAudioOnly);
|
|
90
|
+
console.log('[verbose] proResProfileName', proResProfileName);
|
|
91
|
+
}
|
|
92
|
+
remotion_1.Internals.validateSelectedCrfAndCodecCombination(crf, codec);
|
|
93
|
+
remotion_1.Internals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
|
|
94
|
+
const { complexFilterFlag = undefined, cleanup = undefined, assetPositions = undefined, } = ((_f = options.internalOptions) === null || _f === void 0 ? void 0 : _f.parallelEncoding)
|
|
95
|
+
? {}
|
|
96
|
+
: await getAssetsData(options);
|
|
97
|
+
const ffmpegArgs = [
|
|
98
|
+
['-r', String(options.fps)],
|
|
99
|
+
...(((_g = options.internalOptions) === null || _g === void 0 ? void 0 : _g.preEncodedFileLocation)
|
|
100
|
+
? [['-i', (_h = options.internalOptions) === null || _h === void 0 ? void 0 : _h.preEncodedFileLocation]]
|
|
101
|
+
: isAudioOnly
|
|
102
|
+
? []
|
|
103
|
+
: [
|
|
104
|
+
[
|
|
105
|
+
'-f',
|
|
106
|
+
((_j = options.internalOptions) === null || _j === void 0 ? void 0 : _j.parallelEncoding)
|
|
107
|
+
? ['image2pipe']
|
|
108
|
+
: 'image2',
|
|
109
|
+
],
|
|
110
|
+
['-s', `${options.width}x${options.height}`],
|
|
111
|
+
options.assetsInfo
|
|
112
|
+
? ['-start_number', String(options.assetsInfo.firstFrameIndex)]
|
|
113
|
+
: null,
|
|
114
|
+
options.assetsInfo
|
|
115
|
+
? ['-i', options.assetsInfo.imageSequenceName]
|
|
116
|
+
: null,
|
|
117
|
+
// If scale is very small (like 0.1), FFMPEG cannot figure out the image
|
|
118
|
+
// format on it's own and we need to hint the format
|
|
119
|
+
((_k = options.internalOptions) === null || _k === void 0 ? void 0 : _k.parallelEncoding)
|
|
120
|
+
? [
|
|
121
|
+
'-vcodec',
|
|
122
|
+
options.internalOptions.imageFormat === 'jpeg'
|
|
123
|
+
? 'mjpeg'
|
|
124
|
+
: 'png',
|
|
125
|
+
]
|
|
126
|
+
: null,
|
|
127
|
+
((_l = options.internalOptions) === null || _l === void 0 ? void 0 : _l.parallelEncoding) ? ['-i', '-'] : null,
|
|
128
|
+
]),
|
|
129
|
+
...(options.assetsInfo && assetPositions
|
|
130
|
+
? (0, assets_to_ffmpeg_inputs_1.assetsToFfmpegInputs)({
|
|
131
|
+
assets: assetPositions.map((a) => a.src),
|
|
132
|
+
isAudioOnly,
|
|
133
|
+
fps: options.fps,
|
|
134
|
+
frameCount: options.assetsInfo.assets.length,
|
|
135
|
+
})
|
|
136
|
+
: []),
|
|
137
|
+
encoderName
|
|
138
|
+
? // -c:v is the same as -vcodec as -codec:video
|
|
139
|
+
// and specified the video codec.
|
|
140
|
+
['-c:v', encoderName]
|
|
141
|
+
: // If only exporting audio, we drop the video explicitly
|
|
142
|
+
['-vn'],
|
|
143
|
+
...(((_m = options.internalOptions) === null || _m === void 0 ? void 0 : _m.preEncodedFileLocation)
|
|
144
|
+
? []
|
|
145
|
+
: [
|
|
146
|
+
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
147
|
+
supportsCrf ? ['-crf', String(crf)] : null,
|
|
148
|
+
isAudioOnly ? null : ['-pix_fmt', pixelFormat],
|
|
149
|
+
// Without explicitly disabling auto-alt-ref,
|
|
150
|
+
// transparent WebM generation doesn't work
|
|
151
|
+
pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
|
|
152
|
+
isAudioOnly ? null : ['-b:v', '1M'],
|
|
153
|
+
]),
|
|
154
|
+
'-ar',
|
|
155
|
+
String(sample_rate_1.DEFAULT_SAMPLE_RATE),
|
|
156
|
+
// Stereo sound, even force mono to be stereo
|
|
157
|
+
// Otherwise mixing mono + stereo ends up speeding up the audio
|
|
158
|
+
'-ac',
|
|
159
|
+
'2',
|
|
160
|
+
audioCodecName ? ['-c:a', audioCodecName] : null,
|
|
161
|
+
complexFilterFlag,
|
|
162
|
+
// Ignore audio from image sequence
|
|
163
|
+
isAudioOnly ? null : ['-map', '0:v'],
|
|
164
|
+
// Ignore metadata that may come from remote media
|
|
165
|
+
isAudioOnly ? null : ['-map_metadata', '-1'],
|
|
166
|
+
options.force ? '-y' : null,
|
|
167
|
+
options.outputLocation,
|
|
168
|
+
];
|
|
169
|
+
if (options.verbose) {
|
|
170
|
+
console.log('Generated FFMPEG command:');
|
|
171
|
+
console.log(ffmpegArgs);
|
|
172
|
+
}
|
|
173
|
+
const ffmpegString = ffmpegArgs.flat(2).filter(Boolean);
|
|
174
|
+
const task = (0, execa_1.default)((_o = options.ffmpegExecutable) !== null && _o !== void 0 ? _o : 'ffmpeg', ffmpegString, {
|
|
175
|
+
cwd: ((_p = options.internalOptions) === null || _p === void 0 ? void 0 : _p.parallelEncoding) ? undefined : options.dir,
|
|
176
|
+
});
|
|
177
|
+
let ffmpegOutput = '';
|
|
178
|
+
(_q = task.stderr) === null || _q === void 0 ? void 0 : _q.on('data', (data) => {
|
|
179
|
+
const str = data.toString();
|
|
180
|
+
ffmpegOutput += str;
|
|
181
|
+
if (options.onProgress) {
|
|
182
|
+
const parsed = (0, parse_ffmpeg_progress_1.parseFfmpegProgress)(str);
|
|
183
|
+
if (parsed !== undefined) {
|
|
184
|
+
options.onProgress(parsed);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return { task, cleanup, getLogs: () => ffmpegOutput };
|
|
189
|
+
};
|
|
190
|
+
exports.spawnFfmpeg = spawnFfmpeg;
|
|
191
|
+
const stitchFramesToVideo = async (options) => {
|
|
192
|
+
const { task, cleanup, getLogs } = await (0, exports.spawnFfmpeg)(options);
|
|
193
|
+
try {
|
|
194
|
+
await task;
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
throw new Error(getLogs());
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
cleanup === null || cleanup === void 0 ? void 0 : cleanup();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
exports.stitchFramesToVideo = stitchFramesToVideo;
|
|
204
|
+
//# sourceMappingURL=stitch-frames-to-video.js.map
|