@remotion/renderer 3.2.43-retry.19 → 3.3.0
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/assets/download-and-map-assets-to-file.js +7 -7
- package/dist/assets/get-audio-channels.d.ts +1 -1
- package/dist/assets/get-audio-channels.js +5 -4
- package/dist/assets/get-video-stream-duration.d.ts +1 -1
- package/dist/assets/get-video-stream-duration.js +5 -4
- package/dist/browser/Browser.js +5 -0
- package/dist/browser/BrowserFetcher.d.ts +1 -0
- package/dist/browser/BrowserFetcher.js +11 -10
- package/dist/browser/BrowserPage.d.ts +8 -2
- package/dist/browser/BrowserPage.js +7 -10
- package/dist/browser/FrameManager.d.ts +0 -2
- package/dist/browser/FrameManager.js +0 -3
- package/dist/browser/Launcher.d.ts +7 -1
- package/dist/browser/Launcher.js +2 -4
- package/dist/browser/PuppeteerNode.js +2 -6
- package/dist/combine-videos.d.ts +7 -2
- package/dist/combine-videos.js +4 -3
- package/dist/convert-to-pcm.d.ts +2 -1
- package/dist/convert-to-pcm.js +3 -2
- package/dist/create-silent-audio.d.ts +2 -1
- package/dist/create-silent-audio.js +3 -2
- package/dist/cycle-browser-tabs.js +4 -5
- package/dist/ensure-ffmpeg.d.ts +10 -0
- package/dist/ensure-ffmpeg.js +50 -0
- package/dist/ensure-presentation-timestamp.d.ts +8 -1
- package/dist/ensure-presentation-timestamp.js +14 -5
- package/dist/extract-frame-from-video.d.ts +1 -1
- package/dist/extract-frame-from-video.js +22 -9
- package/dist/ffmpeg-flags.d.ts +16 -1
- package/dist/ffmpeg-flags.js +168 -7
- package/dist/get-compositions.js +10 -6
- package/dist/get-extension-from-codec.js +4 -0
- package/dist/get-video-info.d.ts +1 -1
- package/dist/get-video-info.js +5 -4
- package/dist/guess-extension-for-media.d.ts +5 -1
- package/dist/guess-extension-for-media.js +3 -2
- package/dist/index.d.ts +9 -3
- package/dist/index.js +7 -1
- package/dist/last-frame-from-video-cache.d.ts +1 -1
- package/dist/merge-audio-track.d.ts +1 -0
- package/dist/merge-audio-track.js +7 -2
- package/dist/offthread-video-server.d.ts +2 -1
- package/dist/offthread-video-server.js +2 -1
- package/dist/prepare-server.d.ts +2 -1
- package/dist/prepare-server.js +3 -1
- package/dist/preprocess-audio-track.d.ts +1 -0
- package/dist/preprocess-audio-track.js +4 -3
- package/dist/prespawn-ffmpeg.d.ts +1 -1
- package/dist/prespawn-ffmpeg.js +4 -3
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.js +1 -1
- package/dist/render-frames.js +19 -13
- package/dist/render-media.d.ts +0 -1
- package/dist/render-media.js +4 -2
- package/dist/render-still.js +2 -0
- package/dist/replace-browser.d.ts +1 -1
- package/dist/replace-browser.js +3 -2
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-task.d.ts +1 -2
- package/dist/screenshot-task.js +3 -3
- package/dist/seek-to-frame.d.ts +1 -0
- package/dist/seek-to-frame.js +24 -3
- package/dist/serve-static.d.ts +1 -0
- package/dist/serve-static.js +1 -0
- package/dist/stitch-frames-to-video.d.ts +6 -0
- package/dist/stitch-frames-to-video.js +27 -20
- package/dist/validate-ffmpeg.d.ts +4 -2
- package/dist/validate-ffmpeg.js +35 -46
- package/package.json +3 -3
|
@@ -141,13 +141,6 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
141
141
|
downloadMap.isDownloadingMap[src][downloadDir] = true;
|
|
142
142
|
const onProgress = onDownload(src);
|
|
143
143
|
if (src.startsWith('data:')) {
|
|
144
|
-
const output = (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
145
|
-
contentDisposition: null,
|
|
146
|
-
downloadDir,
|
|
147
|
-
src,
|
|
148
|
-
contentType: null,
|
|
149
|
-
});
|
|
150
|
-
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
151
144
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
152
145
|
if (!assetDetails.includes(';')) {
|
|
153
146
|
const errMessage = [
|
|
@@ -161,6 +154,13 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
161
154
|
const [mimeType, encoding] = assetDetails.split(';');
|
|
162
155
|
validateMimeType(mimeType, src);
|
|
163
156
|
validateBufferEncoding(encoding, src);
|
|
157
|
+
const output = (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
158
|
+
contentDisposition: null,
|
|
159
|
+
downloadDir,
|
|
160
|
+
src,
|
|
161
|
+
contentType: mimeType,
|
|
162
|
+
});
|
|
163
|
+
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
164
164
|
const buff = Buffer.from(assetData, encoding);
|
|
165
165
|
await fs_1.default.promises.writeFile(output, buff);
|
|
166
166
|
notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
2
|
import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
|
|
3
|
-
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<AudioChannelsAndDurationResultCache>;
|
|
3
|
+
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<AudioChannelsAndDurationResultCache>;
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getAudioChannelsAndDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
8
9
|
const p_limit_1 = require("../p-limit");
|
|
9
10
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
10
|
-
async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
11
|
+
async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
|
|
11
12
|
if (downloadMap.durationOfAssetCache[src]) {
|
|
12
13
|
return downloadMap.durationOfAssetCache[src];
|
|
13
14
|
}
|
|
@@ -19,7 +20,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
19
20
|
]
|
|
20
21
|
.reduce((acc, val) => acc.concat(val), [])
|
|
21
22
|
.filter(Boolean);
|
|
22
|
-
const task = await (0, execa_1.default)(
|
|
23
|
+
const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
|
|
23
24
|
const channels = task.stdout.match(/channels=([0-9]+)/);
|
|
24
25
|
const duration = task.stdout.match(/duration=([0-9.]+)/);
|
|
25
26
|
const result = {
|
|
@@ -29,7 +30,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
29
30
|
downloadMap.durationOfAssetCache[src] = result;
|
|
30
31
|
return result;
|
|
31
32
|
}
|
|
32
|
-
const getAudioChannelsAndDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
33
|
-
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
33
|
+
const getAudioChannelsAndDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
|
|
34
|
+
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
|
|
34
35
|
};
|
|
35
36
|
exports.getAudioChannelsAndDuration = getAudioChannelsAndDuration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
2
|
import type { DownloadMap, VideoDurationResult } from './download-map';
|
|
3
3
|
export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
|
|
4
|
-
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<VideoDurationResult>;
|
|
4
|
+
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<VideoDurationResult>;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getVideoStreamDuration = exports.parseVideoStreamDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
8
9
|
const p_limit_1 = require("../p-limit");
|
|
9
10
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
10
11
|
const parseAlternativeDuration = (stdout) => {
|
|
@@ -38,7 +39,7 @@ const parseVideoStreamDuration = (stdout) => {
|
|
|
38
39
|
return result;
|
|
39
40
|
};
|
|
40
41
|
exports.parseVideoStreamDuration = parseVideoStreamDuration;
|
|
41
|
-
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
42
|
+
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
|
|
42
43
|
if (downloadMap.videoDurationResultCache[src]) {
|
|
43
44
|
return downloadMap.videoDurationResultCache[src];
|
|
44
45
|
}
|
|
@@ -50,10 +51,10 @@ async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutab
|
|
|
50
51
|
]
|
|
51
52
|
.reduce((acc, val) => acc.concat(val), [])
|
|
52
53
|
.filter(Boolean);
|
|
53
|
-
const task = await (0, execa_1.default)(
|
|
54
|
+
const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
|
|
54
55
|
return (0, exports.parseVideoStreamDuration)(task.stdout);
|
|
55
56
|
}
|
|
56
|
-
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
57
|
-
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
57
|
+
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
|
|
58
|
+
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
|
|
58
59
|
};
|
|
59
60
|
exports.getVideoStreamDuration = getVideoStreamDuration;
|
package/dist/browser/Browser.js
CHANGED
|
@@ -134,6 +134,11 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
134
134
|
}
|
|
135
135
|
async close(silent) {
|
|
136
136
|
await __classPrivateFieldGet(this, _Browser_closeCallback, "f").call(null);
|
|
137
|
+
(await this.pages()).forEach((page) => {
|
|
138
|
+
console.log('disposing', page.id);
|
|
139
|
+
page.emit("disposed" /* PageEmittedEvents.Disposed */);
|
|
140
|
+
page.closed = true;
|
|
141
|
+
});
|
|
137
142
|
this.disconnect();
|
|
138
143
|
this.emit(silent ? "closed-silent" /* BrowserEmittedEvents.ClosedSilent */ : "closed" /* BrowserEmittedEvents.Closed */);
|
|
139
144
|
}
|
|
@@ -86,4 +86,5 @@ export declare class BrowserFetcher {
|
|
|
86
86
|
*/
|
|
87
87
|
revisionInfo(revision: string): BrowserFetcherRevisionInfo;
|
|
88
88
|
}
|
|
89
|
+
export declare function _downloadFile(url: string, destinationPath: string, progressCallback: (x: number, y: number) => void): Promise<number>;
|
|
89
90
|
export {};
|
|
@@ -53,7 +53,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
53
53
|
};
|
|
54
54
|
var _BrowserFetcher_instances, _BrowserFetcher_product, _BrowserFetcher_downloadsFolder, _BrowserFetcher_downloadHost, _BrowserFetcher_platform, _BrowserFetcher_getFolderPath;
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.BrowserFetcher = void 0;
|
|
56
|
+
exports._downloadFile = exports.BrowserFetcher = void 0;
|
|
57
57
|
const childProcess = __importStar(require("child_process"));
|
|
58
58
|
const fs = __importStar(require("fs"));
|
|
59
59
|
const http = __importStar(require("http"));
|
|
@@ -388,6 +388,13 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
388
388
|
let downloadedBytes = 0;
|
|
389
389
|
let totalBytes = 0;
|
|
390
390
|
let lastProgress = Date.now();
|
|
391
|
+
function onData(chunk) {
|
|
392
|
+
downloadedBytes += chunk.length;
|
|
393
|
+
if (Date.now() - lastProgress > 1000) {
|
|
394
|
+
progressCallback(downloadedBytes, totalBytes);
|
|
395
|
+
lastProgress = Date.now();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
391
398
|
const request = httpRequest(url, 'GET', (response) => {
|
|
392
399
|
if (response.statusCode !== 200) {
|
|
393
400
|
const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`);
|
|
@@ -397,8 +404,8 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
397
404
|
return;
|
|
398
405
|
}
|
|
399
406
|
const file = fs.createWriteStream(destinationPath);
|
|
400
|
-
file.on('
|
|
401
|
-
return fulfill();
|
|
407
|
+
file.on('close', () => {
|
|
408
|
+
return fulfill(totalBytes);
|
|
402
409
|
});
|
|
403
410
|
file.on('error', (error) => {
|
|
404
411
|
return reject(error);
|
|
@@ -411,14 +418,8 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
411
418
|
return reject(error);
|
|
412
419
|
});
|
|
413
420
|
return promise;
|
|
414
|
-
function onData(chunk) {
|
|
415
|
-
downloadedBytes += chunk.length;
|
|
416
|
-
if (Date.now() - lastProgress > 1000) {
|
|
417
|
-
progressCallback(downloadedBytes, totalBytes);
|
|
418
|
-
lastProgress = Date.now();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
421
|
}
|
|
422
|
+
exports._downloadFile = _downloadFile;
|
|
422
423
|
function install(archivePath, folderPath) {
|
|
423
424
|
if (archivePath.endsWith('.zip')) {
|
|
424
425
|
return (0, extract_zip_1.default)(archivePath, { dir: folderPath });
|
|
@@ -27,13 +27,21 @@ import { TaskQueue } from './TaskQueue';
|
|
|
27
27
|
interface WaitForOptions {
|
|
28
28
|
timeout?: number;
|
|
29
29
|
}
|
|
30
|
+
export declare const enum PageEmittedEvents {
|
|
31
|
+
Console = "console",
|
|
32
|
+
Error = "error",
|
|
33
|
+
Disposed = "disposed"
|
|
34
|
+
}
|
|
30
35
|
interface PageEventObject {
|
|
31
36
|
console: ConsoleMessage;
|
|
32
37
|
error: Error;
|
|
38
|
+
disposed: undefined;
|
|
33
39
|
}
|
|
34
40
|
export declare class Page extends EventEmitter {
|
|
35
41
|
#private;
|
|
42
|
+
id: string;
|
|
36
43
|
static _create(client: CDPSession, target: Target, defaultViewport: Viewport, browser: Browser): Promise<Page>;
|
|
44
|
+
closed: boolean;
|
|
37
45
|
browser: Browser;
|
|
38
46
|
screenshotTaskQueue: TaskQueue;
|
|
39
47
|
constructor(client: CDPSession, target: Target, browser: Browser);
|
|
@@ -68,7 +76,5 @@ export declare class Page extends EventEmitter {
|
|
|
68
76
|
close(options?: {
|
|
69
77
|
runBeforeUnload?: boolean;
|
|
70
78
|
}): Promise<void>;
|
|
71
|
-
isClosed(): boolean;
|
|
72
|
-
waitForFunction(browser: Browser, pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
73
79
|
}
|
|
74
80
|
export {};
|
|
@@ -25,7 +25,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var _Page_instances,
|
|
28
|
+
var _Page_instances, _Page_client, _Page_target, _Page_timeoutSettings, _Page_frameManager, _Page_pageBindings, _Page_initialize, _Page_onTargetCrashed, _Page_onLogEntryAdded, _Page_onConsoleAPI, _Page_onBindingCalled, _Page_addConsoleMessage;
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.Page = void 0;
|
|
31
31
|
const assert_1 = require("./assert");
|
|
@@ -40,7 +40,7 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
40
40
|
constructor(client, target, browser) {
|
|
41
41
|
super();
|
|
42
42
|
_Page_instances.add(this);
|
|
43
|
-
|
|
43
|
+
this.closed = false;
|
|
44
44
|
_Page_client.set(this, void 0);
|
|
45
45
|
_Page_target.set(this, void 0);
|
|
46
46
|
_Page_timeoutSettings.set(this, new TimeoutSettings_1.TimeoutSettings());
|
|
@@ -51,6 +51,7 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
51
51
|
__classPrivateFieldSet(this, _Page_frameManager, new FrameManager_1.FrameManager(client, this, __classPrivateFieldGet(this, _Page_timeoutSettings, "f")), "f");
|
|
52
52
|
this.screenshotTaskQueue = new TaskQueue_1.TaskQueue();
|
|
53
53
|
this.browser = browser;
|
|
54
|
+
this.id = String(Math.random());
|
|
54
55
|
client.on('Target.attachedToTarget', (event) => {
|
|
55
56
|
switch (event.targetInfo.type) {
|
|
56
57
|
case 'iframe':
|
|
@@ -166,7 +167,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
166
167
|
}
|
|
167
168
|
async close(options = { runBeforeUnload: undefined }) {
|
|
168
169
|
const connection = __classPrivateFieldGet(this, _Page_client, "f").connection();
|
|
169
|
-
|
|
170
|
+
if (!connection) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
170
173
|
const runBeforeUnload = Boolean(options.runBeforeUnload);
|
|
171
174
|
if (runBeforeUnload) {
|
|
172
175
|
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.close');
|
|
@@ -178,15 +181,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
178
181
|
await __classPrivateFieldGet(this, _Page_target, "f")._isClosedPromise;
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
isClosed() {
|
|
182
|
-
return __classPrivateFieldGet(this, _Page_closed, "f");
|
|
183
|
-
}
|
|
184
|
-
waitForFunction(browser, pageFunction, ...args) {
|
|
185
|
-
return this.mainFrame().waitForFunction(browser, pageFunction, ...args);
|
|
186
|
-
}
|
|
187
184
|
}
|
|
188
185
|
exports.Page = Page;
|
|
189
|
-
|
|
186
|
+
_Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSettings = new WeakMap(), _Page_frameManager = new WeakMap(), _Page_pageBindings = new WeakMap(), _Page_instances = new WeakSet(), _Page_initialize = async function _Page_initialize() {
|
|
190
187
|
await Promise.all([
|
|
191
188
|
__classPrivateFieldGet(this, _Page_frameManager, "f").initialize(),
|
|
192
189
|
__classPrivateFieldGet(this, _Page_client, "f").send('Target.setAutoAttach', {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { Browser } from './Browser';
|
|
17
16
|
import type { Page } from './BrowserPage';
|
|
18
17
|
import type { CDPSession } from './Connection';
|
|
19
18
|
import type { Frame as TFrame } from './devtools-types';
|
|
@@ -83,7 +82,6 @@ export declare class Frame {
|
|
|
83
82
|
evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
|
|
84
83
|
url(): string;
|
|
85
84
|
childFrames(): Frame[];
|
|
86
|
-
waitForFunction(browser: Browser, pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
87
85
|
_navigated(framePayload: TFrame): void;
|
|
88
86
|
_navigatedWithinDocument(url: string): void;
|
|
89
87
|
_onLifecycleEvent(loaderId: string, name: string): void;
|
|
@@ -460,9 +460,6 @@ class Frame {
|
|
|
460
460
|
childFrames() {
|
|
461
461
|
return Array.from(this._childFrames);
|
|
462
462
|
}
|
|
463
|
-
waitForFunction(browser, pageFunction, ...args) {
|
|
464
|
-
return this._mainWorld.waitForFunction(browser, pageFunction, ...args);
|
|
465
|
-
}
|
|
466
463
|
_navigated(framePayload) {
|
|
467
464
|
this._name = framePayload.name;
|
|
468
465
|
__classPrivateFieldSet(this, _Frame_url, `${framePayload.url}${framePayload.urlFragment || ''}`, "f");
|
|
@@ -6,4 +6,10 @@ export interface ProductLauncher {
|
|
|
6
6
|
executablePath: (path?: any) => string;
|
|
7
7
|
product: Product;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export declare class ChromeLauncher implements ProductLauncher {
|
|
10
|
+
_preferredRevision: string;
|
|
11
|
+
constructor(preferredRevision: string);
|
|
12
|
+
launch(options: PuppeteerNodeLaunchOptions): Promise<Browser>;
|
|
13
|
+
executablePath(): string;
|
|
14
|
+
get product(): Product;
|
|
15
|
+
}
|
package/dist/browser/Launcher.js
CHANGED
|
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ChromeLauncher = void 0;
|
|
26
27
|
/**
|
|
27
28
|
* Copyright 2017 Google Inc. All rights reserved.
|
|
28
29
|
*
|
|
@@ -125,6 +126,7 @@ class ChromeLauncher {
|
|
|
125
126
|
return 'chrome';
|
|
126
127
|
}
|
|
127
128
|
}
|
|
129
|
+
exports.ChromeLauncher = ChromeLauncher;
|
|
128
130
|
function resolveExecutablePath(launcher) {
|
|
129
131
|
const { product, _preferredRevision } = launcher;
|
|
130
132
|
const browserFetcher = new BrowserFetcher_1.BrowserFetcher({
|
|
@@ -140,7 +142,3 @@ function resolveExecutablePath(launcher) {
|
|
|
140
142
|
: `Could not find expected browser (${product}) locally. ${product === 'chrome' ? chromeHelp : firefoxHelp}`;
|
|
141
143
|
return { executablePath: revisionInfo.executablePath, missingText };
|
|
142
144
|
}
|
|
143
|
-
function Launcher(preferredRevision) {
|
|
144
|
-
return new ChromeLauncher(preferredRevision);
|
|
145
|
-
}
|
|
146
|
-
exports.default = Launcher;
|
|
@@ -25,14 +25,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
28
|
var _PuppeteerNode_lazyLauncher, _PuppeteerNode_productName;
|
|
32
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
30
|
exports.PuppeteerNode = void 0;
|
|
34
31
|
const BrowserFetcher_1 = require("./BrowserFetcher");
|
|
35
|
-
const Launcher_1 =
|
|
32
|
+
const Launcher_1 = require("./Launcher");
|
|
36
33
|
const revisions_1 = require("./revisions");
|
|
37
34
|
class PuppeteerNode {
|
|
38
35
|
constructor(settings) {
|
|
@@ -62,8 +59,7 @@ class PuppeteerNode {
|
|
|
62
59
|
default:
|
|
63
60
|
this._preferredRevision = revisions_1.PUPPETEER_REVISIONS.chromium;
|
|
64
61
|
}
|
|
65
|
-
|
|
66
|
-
__classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, (0, Launcher_1.default)(this._preferredRevision), "f");
|
|
62
|
+
__classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, new Launcher_1.ChromeLauncher(this._preferredRevision), "f");
|
|
67
63
|
}
|
|
68
64
|
return __classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f");
|
|
69
65
|
}
|
package/dist/combine-videos.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
|
|
2
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
|
+
declare type Options = {
|
|
3
4
|
files: string[];
|
|
4
5
|
filelistDir: string;
|
|
5
6
|
output: string;
|
|
@@ -8,4 +9,8 @@ export declare const combineVideos: ({ files, filelistDir, output, onProgress, n
|
|
|
8
9
|
codec: Codec;
|
|
9
10
|
fps: number;
|
|
10
11
|
numberOfGifLoops: number | null;
|
|
11
|
-
|
|
12
|
+
remotionRoot: string;
|
|
13
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
14
|
+
};
|
|
15
|
+
export declare const combineVideos: (options: Options) => Promise<void>;
|
|
16
|
+
export {};
|
package/dist/combine-videos.js
CHANGED
|
@@ -8,17 +8,19 @@ exports.combineVideos = void 0;
|
|
|
8
8
|
const execa_1 = __importDefault(require("execa"));
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = require("path");
|
|
11
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
11
12
|
const get_audio_codec_name_1 = require("./get-audio-codec-name");
|
|
12
13
|
const is_audio_codec_1 = require("./is-audio-codec");
|
|
13
14
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
14
15
|
const truthy_1 = require("./truthy");
|
|
15
|
-
const combineVideos = async (
|
|
16
|
+
const combineVideos = async (options) => {
|
|
16
17
|
var _a;
|
|
18
|
+
const { files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, } = options;
|
|
17
19
|
const fileList = files.map((p) => `file '${p}'`).join('\n');
|
|
18
20
|
const fileListTxt = (0, path_1.join)(filelistDir, 'files.txt');
|
|
19
21
|
(0, fs_1.writeFileSync)(fileListTxt, fileList);
|
|
20
22
|
try {
|
|
21
|
-
const task = (0, execa_1.default)('ffmpeg', [
|
|
23
|
+
const task = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
22
24
|
(0, is_audio_codec_1.isAudioCodec)(codec) ? null : '-r',
|
|
23
25
|
(0, is_audio_codec_1.isAudioCodec)(codec) ? null : String(fps),
|
|
24
26
|
'-f',
|
|
@@ -42,7 +44,6 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
42
44
|
'512K',
|
|
43
45
|
codec === 'h264' ? '-movflags' : null,
|
|
44
46
|
codec === 'h264' ? 'faststart' : null,
|
|
45
|
-
'-shortest',
|
|
46
47
|
'-y',
|
|
47
48
|
output,
|
|
48
49
|
].filter(truthy_1.truthy));
|
package/dist/convert-to-pcm.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
|
-
export declare const convertToPcm: ({ ffmpegExecutable, input, outName, }: {
|
|
2
|
+
export declare const convertToPcm: ({ ffmpegExecutable, input, outName, remotionRoot, }: {
|
|
3
3
|
ffmpegExecutable: FfmpegExecutable;
|
|
4
4
|
input: string;
|
|
5
5
|
outName: string;
|
|
6
|
+
remotionRoot: string;
|
|
6
7
|
}) => Promise<void>;
|
package/dist/convert-to-pcm.js
CHANGED
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.convertToPcm = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
8
9
|
const sample_rate_1 = require("./sample-rate");
|
|
9
|
-
const convertToPcm = async ({ ffmpegExecutable, input, outName, }) => {
|
|
10
|
-
await (0, execa_1.default)(
|
|
10
|
+
const convertToPcm = async ({ ffmpegExecutable, input, outName, remotionRoot, }) => {
|
|
11
|
+
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
11
12
|
'-i',
|
|
12
13
|
input,
|
|
13
14
|
'-c:a',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
|
-
export declare const createSilentAudio: ({ ffmpegExecutable, numberOfSeconds, outName, }: {
|
|
2
|
+
export declare const createSilentAudio: ({ ffmpegExecutable, numberOfSeconds, outName, remotionRoot, }: {
|
|
3
3
|
ffmpegExecutable: FfmpegExecutable;
|
|
4
4
|
numberOfSeconds: number;
|
|
5
5
|
outName: string;
|
|
6
|
+
remotionRoot: string;
|
|
6
7
|
}) => Promise<void>;
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createSilentAudio = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
8
9
|
const sample_rate_1 = require("./sample-rate");
|
|
9
|
-
const createSilentAudio = async ({ ffmpegExecutable, numberOfSeconds, outName, }) => {
|
|
10
|
-
await (0, execa_1.default)(
|
|
10
|
+
const createSilentAudio = async ({ ffmpegExecutable, numberOfSeconds, outName, remotionRoot, }) => {
|
|
11
|
+
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
11
12
|
'-f',
|
|
12
13
|
'lavfi',
|
|
13
14
|
'-i',
|
|
@@ -16,22 +16,21 @@ const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
|
|
|
16
16
|
.getBrowser()
|
|
17
17
|
.pages()
|
|
18
18
|
.then((pages) => {
|
|
19
|
-
var _a;
|
|
20
19
|
if (pages.length === 0) {
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
const currentPage = pages[i % pages.length];
|
|
24
23
|
i++;
|
|
25
|
-
if (!(
|
|
24
|
+
if (!(currentPage === null || currentPage === void 0 ? void 0 : currentPage.closed) &&
|
|
26
25
|
!stopped &&
|
|
27
26
|
(currentPage === null || currentPage === void 0 ? void 0 : currentPage.url()) !== 'about:blank') {
|
|
28
27
|
return currentPage.bringToFront();
|
|
29
28
|
}
|
|
30
29
|
})
|
|
31
|
-
.
|
|
30
|
+
.catch((err) => console.log(err))
|
|
31
|
+
.finally(() => {
|
|
32
32
|
set();
|
|
33
|
-
})
|
|
34
|
-
.catch((err) => console.log(err));
|
|
33
|
+
});
|
|
35
34
|
}, 200);
|
|
36
35
|
};
|
|
37
36
|
set();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type EnsureFfmpegOptions = {
|
|
2
|
+
remotionRoot?: string;
|
|
3
|
+
};
|
|
4
|
+
declare type Result = {
|
|
5
|
+
result: 'found-in-path' | 'found-in-node-modules' | 'installed';
|
|
6
|
+
wasAlreadyInstalled: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const ensureFfmpeg: (options?: EnsureFfmpegOptions) => Promise<Result>;
|
|
9
|
+
export declare const ensureFfprobe: (options?: EnsureFfmpegOptions) => Promise<Result>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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.ensureFfprobe = exports.ensureFfmpeg = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
10
|
+
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
11
|
+
const ensureFfmpegOrFfprobe = async (binary, options) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const exists = (0, validate_ffmpeg_1.binaryExists)(binary);
|
|
14
|
+
const remotionRoot = (_a = options === null || options === void 0 ? void 0 : options.remotionRoot) !== null && _a !== void 0 ? _a : process.cwd();
|
|
15
|
+
if (exists) {
|
|
16
|
+
return {
|
|
17
|
+
wasAlreadyInstalled: true,
|
|
18
|
+
result: 'found-in-path',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (process.platform === 'linux' && (0, fs_1.existsSync)(ffmpeg_flags_1.lambdaFfmpegPaths[binary])) {
|
|
22
|
+
return {
|
|
23
|
+
wasAlreadyInstalled: true,
|
|
24
|
+
result: 'found-in-path',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if ((0, ffmpeg_flags_1.ffmpegInNodeModules)(remotionRoot, binary)) {
|
|
28
|
+
return {
|
|
29
|
+
result: 'found-in-node-modules',
|
|
30
|
+
wasAlreadyInstalled: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
|
|
34
|
+
if (binaryUrl) {
|
|
35
|
+
await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
|
|
36
|
+
return {
|
|
37
|
+
result: 'installed',
|
|
38
|
+
wasAlreadyInstalled: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
|
|
42
|
+
};
|
|
43
|
+
const ensureFfmpeg = (options) => {
|
|
44
|
+
return ensureFfmpegOrFfprobe('ffmpeg', options);
|
|
45
|
+
};
|
|
46
|
+
exports.ensureFfmpeg = ensureFfmpeg;
|
|
47
|
+
const ensureFfprobe = (options) => {
|
|
48
|
+
return ensureFfmpegOrFfprobe('ffprobe', options);
|
|
49
|
+
};
|
|
50
|
+
exports.ensureFfprobe = ensureFfprobe;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
|
-
|
|
2
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
|
+
export declare const ensurePresentationTimestamps: ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
|
|
4
|
+
downloadMap: DownloadMap;
|
|
5
|
+
src: string;
|
|
6
|
+
remotionRoot: string;
|
|
7
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
8
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
9
|
+
}) => Promise<string>;
|
|
@@ -6,16 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ensurePresentationTimestamps = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
9
10
|
const guess_extension_for_media_1 = require("./guess-extension-for-media");
|
|
10
11
|
const truthy_1 = require("./truthy");
|
|
11
12
|
let callbacks = [];
|
|
12
|
-
const getTemporaryOutputName = async (src) => {
|
|
13
|
+
const getTemporaryOutputName = async ({ src, remotionRoot, ffprobeBinary, }) => {
|
|
13
14
|
const parts = src.split(path_1.default.sep);
|
|
14
15
|
// If there is no file extension for the video, then we need to temporarily add an extension
|
|
15
16
|
const lastPart = parts[parts.length - 1];
|
|
16
17
|
const extraExtension = lastPart.includes('.')
|
|
17
18
|
? null
|
|
18
|
-
: await (0, guess_extension_for_media_1.guessExtensionForVideo)(
|
|
19
|
+
: await (0, guess_extension_for_media_1.guessExtensionForVideo)({
|
|
20
|
+
src,
|
|
21
|
+
remotionRoot,
|
|
22
|
+
ffprobeBinary,
|
|
23
|
+
});
|
|
19
24
|
return parts
|
|
20
25
|
.map((p, i) => {
|
|
21
26
|
if (i === parts.length - 1) {
|
|
@@ -25,7 +30,7 @@ const getTemporaryOutputName = async (src) => {
|
|
|
25
30
|
})
|
|
26
31
|
.join(path_1.default.sep);
|
|
27
32
|
};
|
|
28
|
-
const ensurePresentationTimestamps = async (downloadMap, src) => {
|
|
33
|
+
const ensurePresentationTimestamps = async ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
|
|
29
34
|
const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
|
|
30
35
|
if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
|
|
31
36
|
return new Promise((resolve) => {
|
|
@@ -40,8 +45,12 @@ const ensurePresentationTimestamps = async (downloadMap, src) => {
|
|
|
40
45
|
}
|
|
41
46
|
downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
|
|
42
47
|
// If there is no file extension for the video, then we need to tempoa
|
|
43
|
-
const output = await getTemporaryOutputName(
|
|
44
|
-
|
|
48
|
+
const output = await getTemporaryOutputName({
|
|
49
|
+
src,
|
|
50
|
+
remotionRoot,
|
|
51
|
+
ffprobeBinary: ffprobeExecutable,
|
|
52
|
+
});
|
|
53
|
+
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
45
54
|
'-i',
|
|
46
55
|
src,
|
|
47
56
|
'-fflags',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
3
2
|
import type { DownloadMap } from './assets/download-map';
|
|
4
3
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
@@ -11,6 +10,7 @@ declare type Options = {
|
|
|
11
10
|
ffprobeExecutable: FfmpegExecutable;
|
|
12
11
|
imageFormat: OffthreadVideoImageFormat;
|
|
13
12
|
downloadMap: DownloadMap;
|
|
13
|
+
remotionRoot: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
|
|
16
16
|
export {};
|