@remotion/renderer 4.0.0-alpha13 → 4.0.0-alpha14
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.d.ts +6 -4
- package/dist/assets/download-and-map-assets-to-file.js +30 -6
- package/dist/assets/download-file.d.ts +2 -2
- package/dist/assets/download-map.d.ts +3 -3
- package/dist/assets/ffmpeg-volume-expression.d.ts +2 -2
- package/dist/assets/get-audio-channels.d.ts +1 -0
- package/dist/assets/get-audio-channels.js +10 -5
- package/dist/assets/get-video-stream-duration.d.ts +9 -0
- package/dist/assets/get-video-stream-duration.js +71 -0
- package/dist/assets/read-file.js +1 -1
- package/dist/assets/types.d.ts +4 -4
- package/dist/audio-codec.d.ts +2 -2
- package/dist/browser/Browser.d.ts +9 -9
- package/dist/browser/Browser.js +26 -32
- package/dist/browser/BrowserFetcher.d.ts +1 -1
- package/dist/browser/BrowserPage.d.ts +11 -2
- package/dist/browser/BrowserPage.js +47 -12
- package/dist/browser/BrowserRunner.js +19 -2
- package/dist/browser/ConsoleMessage.d.ts +1 -1
- package/dist/browser/DOMWorld.js +8 -8
- package/dist/browser/EvalTypes.d.ts +7 -7
- package/dist/browser/FrameManager.js +11 -11
- package/dist/browser/JSHandle.js +14 -14
- package/dist/browser/LaunchOptions.d.ts +1 -1
- package/dist/browser/Launcher.js +0 -1
- package/dist/browser/LifecycleWatcher.d.ts +1 -1
- package/dist/browser/NetworkEventManager.d.ts +4 -4
- package/dist/browser/NodeWebSocketTransport.js +16 -16
- package/dist/browser/Product.d.ts +1 -1
- package/dist/browser/Target.d.ts +2 -1
- package/dist/browser/Target.js +8 -2
- package/dist/browser/devtools-types.d.ts +10 -10
- package/dist/browser/mitt/index.d.ts +6 -6
- package/dist/browser/revisions.d.ts +1 -1
- package/dist/browser/should-log-message.d.ts +24 -0
- package/dist/browser/should-log-message.js +72 -0
- package/dist/browser-executable.d.ts +1 -1
- package/dist/browser-log.d.ts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/calculate-sar-dar-pixels.d.ts +9 -0
- package/dist/calculate-sar-dar-pixels.js +19 -0
- package/dist/chalk/index.d.ts +4 -4
- package/dist/codec-supports-media.d.ts +1 -1
- package/dist/codec.d.ts +2 -2
- package/dist/combine-videos.d.ts +1 -1
- package/dist/compositor/compose.d.ts +11 -2
- package/dist/compositor/compose.js +15 -4
- package/dist/compositor/compositor.d.ts +1 -1
- package/dist/compositor/compositor.js +1 -1
- package/dist/compositor/payloads.d.ts +5 -5
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- package/dist/crf.d.ts +1 -1
- package/dist/determine-resize-params.d.ts +1 -0
- package/dist/determine-resize-params.js +10 -0
- package/dist/determine-vcodec-ffmpeg-flags.d.ts +2 -0
- package/dist/determine-vcodec-ffmpeg-flags.js +13 -0
- package/dist/ensure-ffmpeg.d.ts +18 -0
- package/dist/ensure-ffmpeg.js +58 -0
- package/dist/ensure-presentation-timestamp.d.ts +15 -0
- package/dist/ensure-presentation-timestamp.js +88 -0
- package/dist/error-handling/symbolicate-error.js +4 -2
- package/dist/extract-frame-from-video.d.ts +16 -0
- package/dist/extract-frame-from-video.js +191 -0
- package/dist/ffmpeg-executable.d.ts +1 -0
- package/dist/ffmpeg-executable.js +2 -0
- package/dist/ffmpeg-flags.d.ts +31 -0
- package/dist/ffmpeg-flags.js +245 -0
- package/dist/ffmpeg-override.d.ts +1 -1
- package/dist/file-extensions.d.ts +1 -1
- package/dist/frame-range.d.ts +1 -1
- package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
- package/dist/frame-to-ffmpeg-timestamp.js +8 -0
- package/dist/get-browser-instance.d.ts +6 -1
- package/dist/get-browser-instance.js +9 -4
- package/dist/get-can-extract-frames-fast.d.ts +14 -0
- package/dist/get-can-extract-frames-fast.js +71 -0
- package/dist/get-compositions.d.ts +18 -11
- package/dist/get-compositions.js +66 -49
- package/dist/get-frame-of-video-slow.d.ts +17 -0
- package/dist/get-frame-of-video-slow.js +72 -0
- package/dist/get-frame-padded-index.d.ts +1 -1
- package/dist/get-video-info.d.ts +8 -0
- package/dist/get-video-info.js +59 -0
- package/dist/image-format.d.ts +3 -3
- package/dist/index.d.ts +110 -21
- package/dist/index.js +25 -13
- package/dist/is-beyond-last-frame.d.ts +3 -0
- package/dist/is-beyond-last-frame.js +12 -0
- package/dist/jpeg-quality.d.ts +1 -0
- package/dist/jpeg-quality.js +2 -1
- package/dist/last-frame-from-video-cache.d.ts +17 -0
- package/dist/last-frame-from-video-cache.js +55 -0
- package/dist/legacy-webpack-config.d.ts +9 -0
- package/dist/legacy-webpack-config.js +13 -0
- package/dist/log-level.d.ts +1 -1
- package/dist/logger.d.ts +4 -2
- package/dist/logger.js +12 -5
- package/dist/make-cancel-signal.d.ts +2 -2
- package/dist/merge-audio-track.d.ts +1 -1
- package/dist/mime-types.js +1 -1
- package/dist/offthread-video-server.d.ts +36 -4
- package/dist/offthread-video-server.js +48 -4
- package/dist/open-browser.d.ts +19 -10
- package/dist/open-browser.js +34 -21
- package/dist/options/option.d.ts +1 -1
- package/dist/parse-browser-error-stack.d.ts +1 -1
- package/dist/perf.d.ts +1 -1
- package/dist/pixel-format.d.ts +1 -1
- package/dist/prepare-server.d.ts +20 -8
- package/dist/prepare-server.js +52 -8
- package/dist/preprocess-audio-track.d.ts +2 -2
- package/dist/prespawn-ffmpeg.d.ts +1 -1
- package/dist/prespawn-ffmpeg.js +7 -7
- package/dist/prores-profile.d.ts +1 -1
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.js +1 -2
- package/dist/quality.d.ts +1 -0
- package/dist/quality.js +21 -0
- package/dist/render-frames.d.ts +32 -11
- package/dist/render-frames.js +112 -77
- package/dist/render-media.d.ts +50 -21
- package/dist/render-media.js +249 -197
- package/dist/render-still.d.ts +33 -18
- package/dist/render-still.js +71 -43
- package/dist/replace-browser.d.ts +1 -1
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-task.d.ts +0 -1
- package/dist/select-composition.d.ts +19 -11
- package/dist/select-composition.js +79 -42
- package/dist/serve-static.d.ts +2 -3
- package/dist/serve-static.js +2 -4
- package/dist/set-props-and-env.d.ts +1 -1
- package/dist/stitch-frames-to-video.d.ts +32 -11
- package/dist/stitch-frames-to-video.js +121 -99
- package/dist/stringify-ffmpeg-filter.d.ts +2 -2
- package/dist/symbolicate-stacktrace.d.ts +16 -3
- package/dist/symbolicate-stacktrace.js +49 -24
- package/dist/take-frame-and-compose.d.ts +0 -1
- package/dist/truthy.d.ts +1 -1
- package/dist/try-to-extract-frame-of-video-fast.d.ts +12 -0
- package/dist/try-to-extract-frame-of-video-fast.js +55 -0
- package/dist/types.d.ts +2 -2
- package/dist/validate-ffmpeg.d.ts +7 -0
- package/dist/validate-ffmpeg.js +77 -0
- package/dist/validate-opengl-renderer.d.ts +1 -1
- package/dist/warn-about-ffmpeg-version.d.ts +5 -0
- package/dist/warn-about-ffmpeg-version.js +37 -0
- package/package.json +11 -11
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
+
import { OffthreadVideoServerEmitter } from '../offthread-video-server';
|
|
2
3
|
import type { DownloadMap } from './download-map';
|
|
3
|
-
export
|
|
4
|
+
export type RenderMediaOnDownload = (src: string) => ((progress: {
|
|
4
5
|
percent: number | null;
|
|
5
6
|
downloaded: number;
|
|
6
7
|
totalSize: number | null;
|
|
7
8
|
}) => void) | undefined | void;
|
|
8
|
-
export declare const downloadAsset: ({ src,
|
|
9
|
+
export declare const downloadAsset: ({ src, downloadMap, emitter, }: {
|
|
9
10
|
src: string;
|
|
10
|
-
|
|
11
|
+
emitter: OffthreadVideoServerEmitter;
|
|
11
12
|
downloadMap: DownloadMap;
|
|
12
13
|
}) => Promise<string>;
|
|
13
14
|
export declare const markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
|
|
@@ -19,6 +20,7 @@ export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, conte
|
|
|
19
20
|
}) => string;
|
|
20
21
|
export declare const downloadAndMapAssetsToFileUrl: ({ asset, onDownload, downloadMap, }: {
|
|
21
22
|
asset: TAsset;
|
|
22
|
-
onDownload: RenderMediaOnDownload;
|
|
23
|
+
onDownload: RenderMediaOnDownload | null;
|
|
23
24
|
downloadMap: DownloadMap;
|
|
24
25
|
}) => Promise<TAsset>;
|
|
26
|
+
export declare const attachDownloadListenerToEmitter: (emitter: OffthreadVideoServerEmitter, onDownload: RenderMediaOnDownload | null) => () => void;
|
|
@@ -26,13 +26,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl = exports.markAllAssetsAsDownloaded = exports.downloadAsset = void 0;
|
|
29
|
+
exports.attachDownloadListenerToEmitter = exports.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl = exports.markAllAssetsAsDownloaded = exports.downloadAsset = void 0;
|
|
30
30
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
31
31
|
const node_path_1 = __importStar(require("node:path"));
|
|
32
32
|
const remotion_1 = require("remotion");
|
|
33
33
|
const compress_assets_1 = require("../compress-assets");
|
|
34
34
|
const ensure_output_directory_1 = require("../ensure-output-directory");
|
|
35
35
|
const mime_types_1 = require("../mime-types");
|
|
36
|
+
const offthread_video_server_1 = require("../offthread-video-server");
|
|
36
37
|
const download_file_1 = require("./download-file");
|
|
37
38
|
const sanitize_filepath_1 = require("./sanitize-filepath");
|
|
38
39
|
const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
@@ -52,7 +53,7 @@ const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
|
52
53
|
return new Promise((resolve) => {
|
|
53
54
|
downloadMap.listeners[src][downloadDir].push(() => {
|
|
54
55
|
const srcMap = downloadMap.hasBeenDownloadedMap[src];
|
|
55
|
-
if (!srcMap ||
|
|
56
|
+
if (!(srcMap === null || srcMap === void 0 ? void 0 : srcMap[downloadDir])) {
|
|
56
57
|
throw new Error('Expected file for ' + src + 'to be available in ' + downloadDir);
|
|
57
58
|
}
|
|
58
59
|
resolve(srcMap[downloadDir]);
|
|
@@ -115,7 +116,7 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
|
|
|
115
116
|
throw new TypeError(errMessage);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
const downloadAsset = async ({ src,
|
|
119
|
+
const downloadAsset = async ({ src, downloadMap, emitter, }) => {
|
|
119
120
|
var _a, _b, _c;
|
|
120
121
|
if ((0, compress_assets_1.isAssetCompressed)(src)) {
|
|
121
122
|
return src;
|
|
@@ -145,7 +146,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
145
146
|
if (process.env.NODE_ENV === 'test') {
|
|
146
147
|
console.log('Actually downloading asset', src);
|
|
147
148
|
}
|
|
148
|
-
|
|
149
|
+
emitter.dispatchDownload(src);
|
|
149
150
|
if (src.startsWith('data:')) {
|
|
150
151
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
151
152
|
if (!assetDetails.includes(';')) {
|
|
@@ -175,7 +176,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
175
176
|
const { to } = await (0, download_file_1.downloadFile)({
|
|
176
177
|
url: src,
|
|
177
178
|
onProgress: (progress) => {
|
|
178
|
-
|
|
179
|
+
emitter.dispatchDownloadProgress(src, progress.percent, progress.downloaded, progress.totalSize);
|
|
179
180
|
},
|
|
180
181
|
to: (contentDisposition, contentType) => (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
181
182
|
contentDisposition,
|
|
@@ -242,14 +243,37 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
|
|
|
242
243
|
};
|
|
243
244
|
exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
|
|
244
245
|
const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
|
|
246
|
+
const emitter = new offthread_video_server_1.OffthreadVideoServerEmitter();
|
|
247
|
+
const cleanup = (0, exports.attachDownloadListenerToEmitter)(emitter, onDownload);
|
|
245
248
|
const newSrc = await (0, exports.downloadAsset)({
|
|
246
249
|
src: asset.src,
|
|
247
|
-
|
|
250
|
+
emitter,
|
|
248
251
|
downloadMap,
|
|
249
252
|
});
|
|
253
|
+
cleanup();
|
|
250
254
|
return {
|
|
251
255
|
...asset,
|
|
252
256
|
src: newSrc,
|
|
253
257
|
};
|
|
254
258
|
};
|
|
255
259
|
exports.downloadAndMapAssetsToFileUrl = downloadAndMapAssetsToFileUrl;
|
|
260
|
+
const attachDownloadListenerToEmitter = (emitter, onDownload) => {
|
|
261
|
+
const cleanup = [];
|
|
262
|
+
if (!onDownload) {
|
|
263
|
+
return () => undefined;
|
|
264
|
+
}
|
|
265
|
+
const a = emitter.addEventListener('download', ({ detail: { src: initialSrc } }) => {
|
|
266
|
+
const progress = onDownload(initialSrc);
|
|
267
|
+
const b = emitter.addEventListener('progress', ({ detail: { downloaded, percent, src: progressSrc, totalSize } }) => {
|
|
268
|
+
if (initialSrc === progressSrc) {
|
|
269
|
+
progress === null || progress === void 0 ? void 0 : progress({ downloaded, percent, totalSize });
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
cleanup.push(b);
|
|
273
|
+
});
|
|
274
|
+
cleanup.push(() => a());
|
|
275
|
+
return () => {
|
|
276
|
+
cleanup.forEach((c) => c());
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
exports.attachDownloadListenerToEmitter = attachDownloadListenerToEmitter;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
-
export
|
|
2
|
+
export type AudioChannelsAndDurationResultCache = {
|
|
3
3
|
channels: number;
|
|
4
4
|
duration: number | null;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type DownloadMap = {
|
|
7
7
|
id: string;
|
|
8
8
|
isDownloadingMap: {
|
|
9
9
|
[src: string]: {
|
|
@@ -33,7 +33,7 @@ export declare type DownloadMap = {
|
|
|
33
33
|
[key: string]: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type RenderAssetInfo = {
|
|
37
37
|
assets: TAsset[][];
|
|
38
38
|
imageSequenceName: string;
|
|
39
39
|
firstFrameIndex: number;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
|
|
2
|
+
export declare const getAudioChannelsAndDurationWithoutCache: (src: string) => Promise<AudioChannelsAndDurationResultCache>;
|
|
2
3
|
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string) => Promise<AudioChannelsAndDurationResultCache>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAudioChannelsAndDuration = void 0;
|
|
3
|
+
exports.getAudioChannelsAndDuration = exports.getAudioChannelsAndDurationWithoutCache = void 0;
|
|
4
4
|
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
5
5
|
const p_limit_1 = require("../p-limit");
|
|
6
6
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
7
|
-
async
|
|
8
|
-
if (downloadMap.durationOfAssetCache[src]) {
|
|
9
|
-
return downloadMap.durationOfAssetCache[src];
|
|
10
|
-
}
|
|
7
|
+
const getAudioChannelsAndDurationWithoutCache = async (src) => {
|
|
11
8
|
const args = [
|
|
12
9
|
['-v', 'error'],
|
|
13
10
|
['-show_entries', 'stream=channels:format=duration'],
|
|
@@ -23,6 +20,14 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src) {
|
|
|
23
20
|
channels: channels ? parseInt(channels[1], 10) : 0,
|
|
24
21
|
duration: duration ? parseFloat(duration[1]) : null,
|
|
25
22
|
};
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
exports.getAudioChannelsAndDurationWithoutCache = getAudioChannelsAndDurationWithoutCache;
|
|
26
|
+
async function getAudioChannelsAndDurationUnlimited(downloadMap, src) {
|
|
27
|
+
if (downloadMap.durationOfAssetCache[src]) {
|
|
28
|
+
return downloadMap.durationOfAssetCache[src];
|
|
29
|
+
}
|
|
30
|
+
const result = await (0, exports.getAudioChannelsAndDurationWithoutCache)(src);
|
|
26
31
|
downloadMap.durationOfAssetCache[src] = result;
|
|
27
32
|
return result;
|
|
28
33
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
|
+
import type { DownloadMap, VideoDurationResult } from './download-map';
|
|
3
|
+
export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
|
|
4
|
+
export declare function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }: {
|
|
5
|
+
src: string;
|
|
6
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
7
|
+
remotionRoot: string;
|
|
8
|
+
}): Promise<VideoDurationResult>;
|
|
9
|
+
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<VideoDurationResult>;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.getVideoStreamDuration = exports.getVideoStreamDurationwithoutCache = exports.parseVideoStreamDuration = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
9
|
+
const p_limit_1 = require("../p-limit");
|
|
10
|
+
const limit = (0, p_limit_1.pLimit)(1);
|
|
11
|
+
const parseAlternativeDuration = (stdout) => {
|
|
12
|
+
const webmDuration = stdout.match(/TAG:DURATION=([0-9.]+):([0-9.]+):([0-9.]+)/);
|
|
13
|
+
if (!webmDuration) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const [, hours, minutes, seconds] = webmDuration;
|
|
17
|
+
const hoursAsNumber = Number(hours);
|
|
18
|
+
if (Number.isNaN(hoursAsNumber)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const minutesAsNumber = Number(minutes);
|
|
22
|
+
if (Number.isNaN(minutesAsNumber)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const secondsAsNumber = Number(seconds);
|
|
26
|
+
if (Number.isNaN(secondsAsNumber)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return secondsAsNumber + minutesAsNumber * 60 + hoursAsNumber * 3600;
|
|
30
|
+
};
|
|
31
|
+
const parseVideoStreamDuration = (stdout) => {
|
|
32
|
+
const duration = stdout.match(/duration=([0-9.]+)/);
|
|
33
|
+
const alternativeDuration = parseAlternativeDuration(stdout);
|
|
34
|
+
const fps = stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
|
|
35
|
+
const result = {
|
|
36
|
+
duration: duration ? parseFloat(duration[1]) : alternativeDuration,
|
|
37
|
+
fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
exports.parseVideoStreamDuration = parseVideoStreamDuration;
|
|
42
|
+
async function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }) {
|
|
43
|
+
const args = [
|
|
44
|
+
['-v', 'error'],
|
|
45
|
+
['-select_streams', 'v:0'],
|
|
46
|
+
['-show_entries', 'stream'],
|
|
47
|
+
[src],
|
|
48
|
+
]
|
|
49
|
+
.reduce((acc, val) => acc.concat(val), [])
|
|
50
|
+
.filter(Boolean);
|
|
51
|
+
const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
|
|
52
|
+
const result = (0, exports.parseVideoStreamDuration)(task.stdout);
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
exports.getVideoStreamDurationwithoutCache = getVideoStreamDurationwithoutCache;
|
|
56
|
+
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
|
|
57
|
+
if (downloadMap.videoDurationResultCache[src]) {
|
|
58
|
+
return downloadMap.videoDurationResultCache[src];
|
|
59
|
+
}
|
|
60
|
+
const result = await getVideoStreamDurationwithoutCache({
|
|
61
|
+
src,
|
|
62
|
+
ffprobeExecutable,
|
|
63
|
+
remotionRoot,
|
|
64
|
+
});
|
|
65
|
+
downloadMap.videoDurationResultCache[src] = result;
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
|
|
69
|
+
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
|
|
70
|
+
};
|
|
71
|
+
exports.getVideoStreamDuration = getVideoStreamDuration;
|
package/dist/assets/read-file.js
CHANGED
|
@@ -14,7 +14,7 @@ const getClient = (url) => {
|
|
|
14
14
|
if (url.startsWith('http://')) {
|
|
15
15
|
return node_http_1.default.get;
|
|
16
16
|
}
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error(`Can only download URLs starting with http:// or https://, got "${url}"`);
|
|
18
18
|
};
|
|
19
19
|
const readFileWithoutRedirect = (url) => {
|
|
20
20
|
return new Promise((resolve, reject) => {
|
package/dist/assets/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
-
export
|
|
2
|
+
export type UnsafeAsset = Omit<TAsset, 'frame' | 'id' | 'volume' | 'mediaFrame'> & {
|
|
3
3
|
startInVideo: number;
|
|
4
4
|
duration: number | null;
|
|
5
5
|
trimLeft: number;
|
|
@@ -8,10 +8,10 @@ export declare type UnsafeAsset = Omit<TAsset, 'frame' | 'id' | 'volume' | 'medi
|
|
|
8
8
|
playbackRate: number;
|
|
9
9
|
allowAmplificationDuringRender: boolean;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type AssetVolume = number | number[];
|
|
12
|
+
export type MediaAsset = Omit<UnsafeAsset, 'duration' | 'volume'> & {
|
|
13
13
|
duration: number;
|
|
14
14
|
volume: AssetVolume;
|
|
15
15
|
};
|
|
16
16
|
export declare const uncompressMediaAsset: (allAssets: TAsset[], assetToUncompress: TAsset) => TAsset;
|
|
17
|
-
export
|
|
17
|
+
export type Assets = MediaAsset[];
|
package/dist/audio-codec.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
2
|
export declare const validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
|
|
3
|
-
export
|
|
3
|
+
export type AudioCodec = typeof validAudioCodecs[number];
|
|
4
4
|
export declare const supportedAudioCodecs: {
|
|
5
5
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
6
6
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
@@ -14,7 +14,7 @@ export declare const supportedAudioCodecs: {
|
|
|
14
14
|
readonly wav: readonly ["pcm-16"];
|
|
15
15
|
};
|
|
16
16
|
declare const audioCodecNames: readonly ["pcm_s16le", "aac", "libmp3lame", "libopus"];
|
|
17
|
-
|
|
17
|
+
type FfmpegAudioCodecName = typeof audioCodecNames[number];
|
|
18
18
|
export declare const mapAudioCodecToFfmpegAudioCodecName: (audioCodec: AudioCodec) => FfmpegAudioCodecName;
|
|
19
19
|
export declare const defaultAudioCodecs: {
|
|
20
20
|
[key in Codec]: {
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
|
|
16
17
|
import type { Page } from './BrowserPage';
|
|
17
18
|
import type { Connection } from './Connection';
|
|
18
19
|
import { EventEmitter } from './EventEmitter';
|
|
19
20
|
import type { Viewport } from './PuppeteerViewport';
|
|
20
21
|
import { Target } from './Target';
|
|
21
|
-
|
|
22
|
+
type BrowserCloseCallback = () => Promise<void> | void;
|
|
22
23
|
interface WaitForTargetOptions {
|
|
23
24
|
timeout?: number;
|
|
24
25
|
}
|
|
@@ -30,18 +31,17 @@ export declare const enum BrowserEmittedEvents {
|
|
|
30
31
|
}
|
|
31
32
|
export declare class HeadlessBrowser extends EventEmitter {
|
|
32
33
|
#private;
|
|
33
|
-
static _create({ connection,
|
|
34
|
+
static _create({ connection, defaultViewport, closeCallback, }: {
|
|
34
35
|
connection: Connection;
|
|
35
|
-
contextIds: string[];
|
|
36
36
|
defaultViewport: Viewport;
|
|
37
|
-
closeCallback
|
|
37
|
+
closeCallback: BrowserCloseCallback;
|
|
38
38
|
}): Promise<HeadlessBrowser>;
|
|
39
39
|
connection: Connection;
|
|
40
40
|
get _targets(): Map<string, Target>;
|
|
41
|
-
constructor(connection: Connection,
|
|
41
|
+
constructor(connection: Connection, defaultViewport: Viewport, closeCallback?: BrowserCloseCallback);
|
|
42
42
|
browserContexts(): BrowserContext[];
|
|
43
|
-
newPage(): Promise<Page>;
|
|
44
|
-
_createPageInContext(
|
|
43
|
+
newPage(context: AnySourceMapConsumer | null): Promise<Page>;
|
|
44
|
+
_createPageInContext(context: AnySourceMapConsumer | null): Promise<Page>;
|
|
45
45
|
targets(): Target[];
|
|
46
46
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
|
|
47
47
|
pages(): Promise<Page[]>;
|
|
@@ -50,13 +50,13 @@ export declare class HeadlessBrowser extends EventEmitter {
|
|
|
50
50
|
}
|
|
51
51
|
export declare class BrowserContext extends EventEmitter {
|
|
52
52
|
#private;
|
|
53
|
-
constructor(browser: HeadlessBrowser
|
|
53
|
+
constructor(browser: HeadlessBrowser);
|
|
54
54
|
targets(): Target[];
|
|
55
55
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: {
|
|
56
56
|
timeout?: number;
|
|
57
57
|
}): Promise<Target>;
|
|
58
58
|
pages(): Promise<Page[]>;
|
|
59
|
-
newPage(): Promise<Page>;
|
|
59
|
+
newPage(context: AnySourceMapConsumer | null): Promise<Page>;
|
|
60
60
|
browser(): HeadlessBrowser;
|
|
61
61
|
}
|
|
62
62
|
export {};
|
package/dist/browser/Browser.js
CHANGED
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
+
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");
|
|
20
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
+
};
|
|
17
22
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
18
23
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
19
24
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
20
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
21
26
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
22
27
|
};
|
|
23
|
-
var
|
|
24
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
|
-
};
|
|
28
|
-
var _HeadlessBrowser_instances, _HeadlessBrowser_defaultViewport, _HeadlessBrowser_closeCallback, _HeadlessBrowser_defaultContext, _HeadlessBrowser_contexts, _HeadlessBrowser_targets, _HeadlessBrowser_targetCreated, _HeadlessBrowser_targetDestroyed, _HeadlessBrowser_targetInfoChanged, _BrowserContext_browser, _BrowserContext_id;
|
|
28
|
+
var _HeadlessBrowser_instances, _HeadlessBrowser_defaultViewport, _HeadlessBrowser_closeCallback, _HeadlessBrowser_defaultContext, _HeadlessBrowser_contexts, _HeadlessBrowser_targets, _HeadlessBrowser_targetCreated, _HeadlessBrowser_targetDestroyed, _HeadlessBrowser_targetInfoChanged, _BrowserContext_browser;
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.BrowserContext = exports.HeadlessBrowser = void 0;
|
|
31
31
|
const assert_1 = require("./assert");
|
|
@@ -33,8 +33,15 @@ const EventEmitter_1 = require("./EventEmitter");
|
|
|
33
33
|
const Target_1 = require("./Target");
|
|
34
34
|
const util_1 = require("./util");
|
|
35
35
|
class HeadlessBrowser extends EventEmitter_1.EventEmitter {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
static async _create({ connection, defaultViewport, closeCallback, }) {
|
|
37
|
+
const browser = new HeadlessBrowser(connection, defaultViewport, closeCallback);
|
|
38
|
+
await connection.send('Target.setDiscoverTargets', { discover: true });
|
|
39
|
+
return browser;
|
|
40
|
+
}
|
|
41
|
+
get _targets() {
|
|
42
|
+
return __classPrivateFieldGet(this, _HeadlessBrowser_targets, "f");
|
|
43
|
+
}
|
|
44
|
+
constructor(connection, defaultViewport, closeCallback) {
|
|
38
45
|
super();
|
|
39
46
|
_HeadlessBrowser_instances.add(this);
|
|
40
47
|
_HeadlessBrowser_defaultViewport.set(this, void 0);
|
|
@@ -50,32 +57,21 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
|
|
|
50
57
|
}, "f");
|
|
51
58
|
__classPrivateFieldSet(this, _HeadlessBrowser_defaultContext, new BrowserContext(this), "f");
|
|
52
59
|
__classPrivateFieldSet(this, _HeadlessBrowser_contexts, new Map(), "f");
|
|
53
|
-
for (const contextId of contextIds) {
|
|
54
|
-
__classPrivateFieldGet(this, _HeadlessBrowser_contexts, "f").set(contextId, new BrowserContext(this, contextId));
|
|
55
|
-
}
|
|
56
60
|
__classPrivateFieldSet(this, _HeadlessBrowser_targets, new Map(), "f");
|
|
57
61
|
this.connection.on('Target.targetCreated', __classPrivateFieldGet(this, _HeadlessBrowser_instances, "m", _HeadlessBrowser_targetCreated).bind(this));
|
|
58
62
|
this.connection.on('Target.targetDestroyed', __classPrivateFieldGet(this, _HeadlessBrowser_instances, "m", _HeadlessBrowser_targetDestroyed).bind(this));
|
|
59
63
|
this.connection.on('Target.targetInfoChanged', __classPrivateFieldGet(this, _HeadlessBrowser_instances, "m", _HeadlessBrowser_targetInfoChanged).bind(this));
|
|
60
64
|
}
|
|
61
|
-
static async _create({ connection, contextIds, defaultViewport, closeCallback, }) {
|
|
62
|
-
const browser = new HeadlessBrowser(connection, contextIds, defaultViewport, closeCallback);
|
|
63
|
-
await connection.send('Target.setDiscoverTargets', { discover: true });
|
|
64
|
-
return browser;
|
|
65
|
-
}
|
|
66
|
-
get _targets() {
|
|
67
|
-
return __classPrivateFieldGet(this, _HeadlessBrowser_targets, "f");
|
|
68
|
-
}
|
|
69
65
|
browserContexts() {
|
|
70
66
|
return [__classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f"), ...Array.from(__classPrivateFieldGet(this, _HeadlessBrowser_contexts, "f").values())];
|
|
71
67
|
}
|
|
72
|
-
newPage() {
|
|
73
|
-
return __classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f").newPage();
|
|
68
|
+
newPage(context) {
|
|
69
|
+
return __classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f").newPage(context);
|
|
74
70
|
}
|
|
75
|
-
async _createPageInContext(
|
|
71
|
+
async _createPageInContext(context) {
|
|
76
72
|
const { targetId } = await this.connection.send('Target.createTarget', {
|
|
77
73
|
url: 'about:blank',
|
|
78
|
-
browserContextId:
|
|
74
|
+
browserContextId: undefined,
|
|
79
75
|
});
|
|
80
76
|
const target = __classPrivateFieldGet(this, _HeadlessBrowser_targets, "f").get(targetId);
|
|
81
77
|
if (!target) {
|
|
@@ -85,9 +81,9 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
|
|
|
85
81
|
if (!initialized) {
|
|
86
82
|
throw new Error(`Failed to create target for page (id = ${targetId})`);
|
|
87
83
|
}
|
|
88
|
-
const page = await target.page();
|
|
84
|
+
const page = await target.page(context);
|
|
89
85
|
if (!page) {
|
|
90
|
-
throw new Error(`Failed to create a page for context
|
|
86
|
+
throw new Error(`Failed to create a page for context`);
|
|
91
87
|
}
|
|
92
88
|
return page;
|
|
93
89
|
}
|
|
@@ -185,12 +181,10 @@ _HeadlessBrowser_defaultViewport = new WeakMap(), _HeadlessBrowser_closeCallback
|
|
|
185
181
|
}
|
|
186
182
|
};
|
|
187
183
|
class BrowserContext extends EventEmitter_1.EventEmitter {
|
|
188
|
-
constructor(browser
|
|
184
|
+
constructor(browser) {
|
|
189
185
|
super();
|
|
190
186
|
_BrowserContext_browser.set(this, void 0);
|
|
191
|
-
_BrowserContext_id.set(this, void 0);
|
|
192
187
|
__classPrivateFieldSet(this, _BrowserContext_browser, browser, "f");
|
|
193
|
-
__classPrivateFieldSet(this, _BrowserContext_id, contextId, "f");
|
|
194
188
|
}
|
|
195
189
|
targets() {
|
|
196
190
|
return __classPrivateFieldGet(this, _BrowserContext_browser, "f").targets().filter((target) => {
|
|
@@ -205,17 +199,17 @@ class BrowserContext extends EventEmitter_1.EventEmitter {
|
|
|
205
199
|
async pages() {
|
|
206
200
|
const pages = await Promise.all(this.targets()
|
|
207
201
|
.filter((target) => target.type() === 'page')
|
|
208
|
-
.map((target) => target.page()));
|
|
202
|
+
.map((target) => target.page(null)));
|
|
209
203
|
return pages.filter((page) => {
|
|
210
204
|
return Boolean(page);
|
|
211
205
|
});
|
|
212
206
|
}
|
|
213
|
-
newPage() {
|
|
214
|
-
return __classPrivateFieldGet(this, _BrowserContext_browser, "f")._createPageInContext(
|
|
207
|
+
newPage(context) {
|
|
208
|
+
return __classPrivateFieldGet(this, _BrowserContext_browser, "f")._createPageInContext(context);
|
|
215
209
|
}
|
|
216
210
|
browser() {
|
|
217
211
|
return __classPrivateFieldGet(this, _BrowserContext_browser, "f");
|
|
218
212
|
}
|
|
219
213
|
}
|
|
220
214
|
exports.BrowserContext = BrowserContext;
|
|
221
|
-
_BrowserContext_browser = new WeakMap()
|
|
215
|
+
_BrowserContext_browser = new WeakMap();
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Product } from './Product';
|
|
17
|
-
|
|
17
|
+
type Platform = 'linux' | 'mac' | 'mac_arm' | 'win32' | 'win64';
|
|
18
18
|
interface BrowserFetcherRevisionInfo {
|
|
19
19
|
folderPath: string;
|
|
20
20
|
executablePath: string;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
|
|
16
17
|
import type { HeadlessBrowser } from './Browser';
|
|
17
18
|
import type { CDPSession } from './Connection';
|
|
18
19
|
import { ConsoleMessage } from './ConsoleMessage';
|
|
@@ -40,11 +41,18 @@ interface PageEventObject {
|
|
|
40
41
|
export declare class Page extends EventEmitter {
|
|
41
42
|
#private;
|
|
42
43
|
id: string;
|
|
43
|
-
static _create(client
|
|
44
|
+
static _create({ client, target, defaultViewport, browser, sourcemapContext, }: {
|
|
45
|
+
client: CDPSession;
|
|
46
|
+
target: Target;
|
|
47
|
+
defaultViewport: Viewport;
|
|
48
|
+
browser: HeadlessBrowser;
|
|
49
|
+
sourcemapContext: AnySourceMapConsumer | null;
|
|
50
|
+
}): Promise<Page>;
|
|
44
51
|
closed: boolean;
|
|
45
52
|
browser: HeadlessBrowser;
|
|
46
53
|
screenshotTaskQueue: TaskQueue;
|
|
47
|
-
|
|
54
|
+
sourcemapContext: AnySourceMapConsumer | null;
|
|
55
|
+
constructor(client: CDPSession, target: Target, browser: HeadlessBrowser, sourcemapContext: AnySourceMapConsumer | null);
|
|
48
56
|
/**
|
|
49
57
|
* Listen to page events.
|
|
50
58
|
*/
|
|
@@ -76,5 +84,6 @@ export declare class Page extends EventEmitter {
|
|
|
76
84
|
close(options?: {
|
|
77
85
|
runBeforeUnload?: boolean;
|
|
78
86
|
}): Promise<void>;
|
|
87
|
+
setBrowserSourceMapContext(context: AnySourceMapConsumer | null): void;
|
|
79
88
|
}
|
|
80
89
|
export {};
|