@remotion/renderer 4.0.0-oops.3 → 4.0.0-prefetch.11
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/calculate-asset-positions.d.ts +2 -2
- package/dist/assets/convert-assets-to-file-urls.d.ts +5 -4
- package/dist/assets/convert-assets-to-file-urls.js +2 -2
- package/dist/assets/download-and-map-assets-to-file.d.ts +16 -6
- package/dist/assets/download-and-map-assets-to-file.js +152 -45
- package/dist/assets/download-file.d.ts +10 -5
- package/dist/assets/download-file.js +20 -5
- package/dist/assets/download-map.d.ts +64 -0
- package/dist/assets/download-map.js +73 -0
- package/dist/assets/ffmpeg-volume-expression.d.ts +3 -3
- package/dist/assets/ffmpeg-volume-expression.js +16 -14
- package/dist/assets/flatten-volume-array.d.ts +1 -1
- package/dist/assets/get-audio-channels.d.ts +3 -4
- package/dist/assets/get-audio-channels.js +14 -4
- package/dist/assets/get-video-stream-duration.d.ts +4 -0
- package/dist/assets/get-video-stream-duration.js +59 -0
- package/dist/assets/read-file.js +4 -1
- package/dist/assets/types.d.ts +1 -1
- package/dist/browser/Browser.d.ts +60 -0
- package/dist/browser/Browser.js +218 -0
- package/dist/browser/BrowserConnector.d.ts +19 -0
- package/dist/browser/BrowserConnector.js +17 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +510 -0
- package/dist/browser/BrowserPage.d.ts +74 -0
- package/dist/browser/BrowserPage.js +283 -0
- package/dist/browser/BrowserRunner.d.ts +39 -0
- package/dist/browser/BrowserRunner.js +308 -0
- package/dist/browser/Connection.d.ts +42 -0
- package/dist/browser/Connection.js +242 -0
- package/dist/browser/ConsoleMessage.d.ts +31 -0
- package/dist/browser/ConsoleMessage.js +48 -0
- package/dist/browser/DOMWorld.d.ts +52 -0
- package/dist/browser/DOMWorld.js +272 -0
- package/dist/browser/Errors.d.ts +25 -0
- package/dist/browser/Errors.js +35 -0
- package/dist/browser/EvalTypes.d.ts +27 -0
- package/dist/browser/EvalTypes.js +17 -0
- package/dist/browser/EventEmitter.d.ts +23 -0
- package/dist/browser/EventEmitter.js +53 -0
- package/dist/browser/ExecutionContext.d.ts +34 -0
- package/dist/browser/ExecutionContext.js +174 -0
- package/dist/browser/FrameManager.d.ts +93 -0
- package/dist/browser/FrameManager.js +496 -0
- package/dist/browser/HTTPRequest.d.ts +28 -0
- package/dist/browser/HTTPRequest.js +37 -0
- package/dist/browser/HTTPResponse.d.ts +21 -0
- package/dist/browser/HTTPResponse.js +41 -0
- package/dist/browser/JSHandle.d.ts +35 -0
- package/dist/browser/JSHandle.js +90 -0
- package/dist/browser/LaunchOptions.d.ts +37 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +9 -0
- package/dist/browser/Launcher.js +504 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +180 -0
- package/dist/browser/NetworkEventManager.d.ts +33 -0
- package/dist/browser/NetworkEventManager.js +81 -0
- package/dist/browser/NetworkManager.d.ts +34 -0
- package/dist/browser/NetworkManager.js +231 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +17 -0
- package/dist/browser/NodeWebSocketTransport.js +87 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +40 -0
- package/dist/browser/PuppeteerNode.js +81 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/Target.d.ts +61 -0
- package/dist/browser/Target.js +146 -0
- package/dist/browser/TaskQueue.d.ts +20 -0
- package/dist/browser/TaskQueue.js +47 -0
- package/dist/browser/TimeoutSettings.d.ts +24 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/assert.d.ts +1 -0
- package/dist/browser/assert.js +9 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +119 -0
- package/dist/browser/devtools-commands.d.ts +270 -0
- package/dist/browser/devtools-commands.js +2 -0
- package/dist/browser/devtools-types.d.ts +1122 -0
- package/dist/browser/devtools-types.js +2 -0
- package/dist/browser/get-download-destination.d.ts +1 -0
- package/dist/browser/get-download-destination.js +38 -0
- package/dist/browser/mitt/index.d.ts +22 -0
- package/dist/browser/mitt/index.js +49 -0
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +9 -0
- package/dist/browser/revisions.d.ts +21 -0
- package/dist/browser/revisions.js +22 -0
- package/dist/browser/util.d.ts +47 -0
- package/dist/browser/util.js +169 -0
- package/dist/browser-executable.d.ts +1 -0
- package/dist/browser-executable.js +2 -0
- package/dist/browser-log.d.ts +1 -1
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +4 -0
- package/dist/calculate-ffmpeg-filters.d.ts +1 -1
- package/dist/calculate-ffmpeg-filters.js +2 -2
- package/dist/calculate-sar-dar-pixels.d.ts +9 -0
- package/dist/calculate-sar-dar-pixels.js +19 -0
- package/dist/can-use-parallel-encoding.d.ts +1 -1
- package/dist/can-use-parallel-encoding.js +2 -2
- package/dist/codec-supports-media.d.ts +8 -0
- package/dist/codec-supports-media.js +56 -0
- package/dist/codec.d.ts +4 -0
- package/dist/codec.js +16 -0
- package/dist/combine-videos.d.ts +4 -2
- package/dist/combine-videos.js +19 -5
- package/dist/compress-assets.d.ts +7 -0
- package/dist/compress-assets.js +25 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +1 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.js +17 -0
- package/dist/convert-to-pcm.d.ts +1 -1
- package/dist/create-ffmpeg-complex-filter.d.ts +2 -1
- package/dist/create-ffmpeg-complex-filter.js +2 -11
- package/dist/create-ffmpeg-merge-filter.js +3 -3
- package/dist/create-silent-audio.d.ts +1 -1
- package/dist/crf.d.ts +5 -0
- package/dist/crf.js +64 -0
- package/dist/cycle-browser-tabs.d.ts +3 -2
- package/dist/cycle-browser-tabs.js +14 -2
- package/dist/delay-render-embedded-stack.d.ts +1 -1
- package/dist/ensure-frames-in-order.d.ts +1 -1
- package/dist/ensure-frames-in-order.js +3 -2
- package/dist/ensure-presentation-timestamp.d.ts +2 -0
- package/dist/ensure-presentation-timestamp.js +69 -0
- package/dist/error-handling/handle-javascript-exception.d.ts +2 -2
- package/dist/error-handling/handle-javascript-exception.js +3 -4
- package/dist/error-handling/symbolicate-error.d.ts +1 -1
- package/dist/error-handling/symbolicateable-error.d.ts +1 -1
- package/dist/extract-frame-from-video.d.ts +16 -0
- package/dist/extract-frame-from-video.js +277 -0
- package/dist/ffmpeg-executable.d.ts +1 -0
- package/dist/ffmpeg-executable.js +2 -0
- package/dist/ffmpeg-filter-file.d.ts +2 -1
- package/dist/ffmpeg-filter-file.js +4 -6
- package/dist/frame-range.d.ts +2 -0
- package/dist/frame-range.js +49 -0
- package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
- package/dist/frame-to-ffmpeg-timestamp.js +8 -0
- package/dist/get-audio-codec-name.d.ts +1 -1
- package/dist/get-audio-codec-name.js +2 -2
- package/dist/get-browser-instance.d.ts +4 -3
- package/dist/get-browser-instance.js +2 -2
- package/dist/get-codec-name.d.ts +1 -1
- package/dist/get-codec-name.js +5 -2
- package/dist/get-compositions.d.ts +15 -5
- package/dist/get-compositions.js +35 -11
- package/dist/get-duration-from-frame-range.d.ts +1 -2
- package/dist/get-duration-from-frame-range.js +13 -9
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-extension-from-codec.js +5 -0
- package/dist/get-extension-of-filename.d.ts +1 -1
- package/dist/get-extension-of-filename.js +3 -0
- package/dist/get-frame-padded-index.d.ts +14 -0
- package/dist/get-frame-padded-index.js +33 -0
- package/dist/get-frame-to-render.d.ts +1 -1
- package/dist/get-local-browser-executable.d.ts +2 -1
- package/dist/get-local-browser-executable.js +7 -5
- package/dist/get-port.js +30 -37
- package/dist/get-prores-profile-name.d.ts +2 -1
- package/dist/get-video-info.d.ts +3 -0
- package/dist/get-video-info.js +49 -0
- package/dist/get-video-threads-flag.d.ts +1 -0
- package/dist/get-video-threads-flag.js +18 -0
- package/dist/guess-extension-for-media.d.ts +1 -0
- package/dist/guess-extension-for-media.js +27 -0
- package/dist/image-format.d.ts +6 -1
- package/dist/image-format.js +25 -1
- package/dist/index.d.ts +95 -20
- package/dist/index.js +93 -6
- package/dist/is-audio-codec.d.ts +2 -0
- package/dist/is-audio-codec.js +7 -0
- package/dist/is-beyond-last-frame.d.ts +3 -0
- package/dist/is-beyond-last-frame.js +12 -0
- package/dist/last-frame-from-video-cache.d.ts +17 -0
- package/dist/last-frame-from-video-cache.js +55 -0
- package/dist/log-level.d.ts +4 -0
- package/dist/log-level.js +15 -0
- package/dist/make-cancel-signal.d.ts +7 -0
- package/dist/make-cancel-signal.js +25 -0
- package/dist/merge-audio-track.d.ts +3 -1
- package/dist/merge-audio-track.js +14 -8
- package/dist/mime-db.d.ts +6 -0
- package/dist/mime-db.js +8636 -0
- package/dist/mime-types.d.ts +3 -0
- package/dist/mime-types.js +94 -0
- package/dist/offthread-video-server.d.ts +17 -0
- package/dist/offthread-video-server.js +86 -0
- package/dist/open-browser.d.ts +10 -7
- package/dist/open-browser.js +63 -20
- package/dist/overwrite.d.ts +1 -0
- package/dist/overwrite.js +4 -0
- package/dist/perf.d.ts +5 -0
- package/dist/perf.js +35 -0
- package/dist/pixel-format.d.ts +5 -0
- package/dist/pixel-format.js +26 -0
- package/dist/prepare-server.d.ts +14 -2
- package/dist/prepare-server.js +38 -5
- package/dist/preprocess-audio-track.d.ts +5 -2
- package/dist/preprocess-audio-track.js +3 -3
- package/dist/prespawn-ffmpeg.d.ts +7 -1
- package/dist/prespawn-ffmpeg.js +20 -16
- package/dist/prestitcher-memory-usage.d.ts +12 -0
- package/dist/prestitcher-memory-usage.js +30 -0
- package/dist/prores-profile.d.ts +5 -0
- package/dist/prores-profile.js +23 -0
- package/dist/provide-screenshot.d.ts +4 -4
- package/dist/provide-screenshot.js +1 -2
- package/dist/puppeteer-evaluate.d.ts +1 -1
- package/dist/puppeteer-evaluate.js +3 -4
- package/dist/puppeteer-screenshot.d.ts +3 -2
- package/dist/puppeteer-screenshot.js +7 -5
- package/dist/quality.d.ts +1 -0
- package/dist/quality.js +21 -0
- package/dist/render-frames.d.ts +24 -8
- package/dist/render-frames.js +153 -65
- package/dist/render-media.d.ts +36 -9
- package/dist/render-media.js +194 -70
- package/dist/render-still.d.ts +25 -7
- package/dist/render-still.js +91 -26
- package/dist/screenshot-dom-element.d.ts +6 -7
- package/dist/screenshot-dom-element.js +3 -6
- package/dist/screenshot-task.d.ts +3 -2
- package/dist/screenshot-task.js +36 -23
- package/dist/seek-to-frame.d.ts +2 -2
- package/dist/seek-to-frame.js +2 -2
- package/dist/serve-handler/index.d.ts +4 -0
- package/dist/serve-handler/index.js +204 -0
- package/dist/serve-handler/is-path-inside.d.ts +1 -0
- package/dist/serve-handler/is-path-inside.js +27 -0
- package/dist/serve-handler/range-parser.d.ts +13 -0
- package/dist/serve-handler/range-parser.js +57 -0
- package/dist/serve-static.d.ts +11 -3
- package/dist/serve-static.js +37 -7
- package/dist/set-props-and-env.d.ts +6 -2
- package/dist/set-props-and-env.js +65 -12
- package/dist/stitch-frames-to-video.d.ts +17 -5
- package/dist/stitch-frames-to-video.js +130 -46
- package/dist/stringify-ffmpeg-filter.d.ts +2 -2
- package/dist/stringify-ffmpeg-filter.js +12 -7
- package/dist/symbolicate-stacktrace.d.ts +1 -1
- package/dist/symbolicate-stacktrace.js +3 -3
- package/dist/tmp-dir.js +5 -1
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +7 -0
- package/dist/types.d.ts +1 -1
- package/dist/validate-concurrency.d.ts +1 -0
- package/dist/validate-concurrency.js +24 -0
- package/dist/validate-even-dimensions-with-codec.d.ts +1 -1
- package/dist/validate-even-dimensions-with-codec.js +2 -2
- package/dist/validate-every-nth-frame.d.ts +1 -0
- package/dist/validate-every-nth-frame.js +21 -0
- package/dist/validate-ffmpeg.js +2 -3
- package/dist/validate-frame.d.ts +1 -0
- package/dist/validate-frame.js +24 -0
- package/dist/validate-opengl-renderer.d.ts +5 -0
- package/dist/validate-opengl-renderer.js +15 -0
- package/dist/validate-output-filename.d.ts +1 -1
- package/dist/validate-output-filename.js +5 -0
- package/dist/wait-for-symbolication-error-to-be-done.d.ts +3 -0
- package/dist/wait-for-symbolication-error-to-be-done.js +34 -0
- package/dist/ws/ws-types.d.ts +14 -0
- package/dist/ws/ws-types.js +10 -0
- package/package.json +13 -16
- package/tsconfig.json +2 -2
- package/types/ws/index.d.ts +509 -0
- package/vitest.config.ts +8 -0
- package/dist/make-assets-download-dir.d.ts +0 -1
- package/dist/make-assets-download-dir.js +0 -8
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Since audio or video can be base64-encoded, those can be really long strings.
|
|
4
|
+
* Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.isAssetCompressed = exports.compressAsset = void 0;
|
|
8
|
+
const compressAsset = (previousAssets, newAsset) => {
|
|
9
|
+
if (newAsset.src.length < 400) {
|
|
10
|
+
return newAsset;
|
|
11
|
+
}
|
|
12
|
+
const assetWithSameSrc = previousAssets.find((a) => a.src === newAsset.src);
|
|
13
|
+
if (!assetWithSameSrc) {
|
|
14
|
+
return newAsset;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
...newAsset,
|
|
18
|
+
src: `same-as-${assetWithSameSrc.id}-${assetWithSameSrc.frame}`,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.compressAsset = compressAsset;
|
|
22
|
+
const isAssetCompressed = (src) => {
|
|
23
|
+
return src.startsWith('same-as');
|
|
24
|
+
};
|
|
25
|
+
exports.isAssetCompressed = isAssetCompressed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertNumberOfGifLoopsToFfmpegSyntax: (loops: number | null) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://superuser.com/questions/1607099/how-to-control-gif-loop-settings-in-ffmpeg
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.convertNumberOfGifLoopsToFfmpegSyntax = void 0;
|
|
5
|
+
const convertNumberOfGifLoopsToFfmpegSyntax = (loops) => {
|
|
6
|
+
// Infinite loop
|
|
7
|
+
if (loops === null) {
|
|
8
|
+
return '0';
|
|
9
|
+
}
|
|
10
|
+
// No loops
|
|
11
|
+
if (loops === 0) {
|
|
12
|
+
return '-1';
|
|
13
|
+
}
|
|
14
|
+
// N amount of loops
|
|
15
|
+
return String(loops);
|
|
16
|
+
};
|
|
17
|
+
exports.convertNumberOfGifLoopsToFfmpegSyntax = convertNumberOfGifLoopsToFfmpegSyntax;
|
package/dist/convert-to-pcm.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DownloadMap } from './assets/download-map';
|
|
2
|
+
export declare const createFfmpegComplexFilter: (filters: number, downloadMap: DownloadMap) => Promise<{
|
|
2
3
|
complexFilterFlag: [string, string] | null;
|
|
3
4
|
cleanup: () => void;
|
|
4
5
|
}>;
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createFfmpegComplexFilter = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
4
|
const create_ffmpeg_merge_filter_1 = require("./create-ffmpeg-merge-filter");
|
|
10
5
|
const ffmpeg_filter_file_1 = require("./ffmpeg-filter-file");
|
|
11
|
-
const
|
|
12
|
-
const createFfmpegComplexFilter = async (filters) => {
|
|
6
|
+
const createFfmpegComplexFilter = async (filters, downloadMap) => {
|
|
13
7
|
if (filters === 0) {
|
|
14
8
|
return { complexFilterFlag: null, cleanup: () => undefined };
|
|
15
9
|
}
|
|
16
10
|
const complexFilter = (0, create_ffmpeg_merge_filter_1.createFfmpegMergeFilter)(filters);
|
|
17
|
-
const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter);
|
|
18
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter-script');
|
|
19
|
-
const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
|
|
20
|
-
await fs_1.default.promises.writeFile(filterFile, complexFilter);
|
|
11
|
+
const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter, downloadMap);
|
|
21
12
|
return {
|
|
22
13
|
complexFilterFlag: ['-filter_complex_script', file],
|
|
23
14
|
cleanup,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFfmpegMergeFilter = void 0;
|
|
4
|
-
const
|
|
4
|
+
const truthy_1 = require("./truthy");
|
|
5
5
|
const createFfmpegMergeFilter = (inputs) => {
|
|
6
6
|
const leftChannel = new Array(inputs * 2)
|
|
7
7
|
.fill(true)
|
|
8
8
|
.map((_, i) => (i % 2 === 0 ? `c${i}` : null))
|
|
9
|
-
.filter(
|
|
9
|
+
.filter(truthy_1.truthy)
|
|
10
10
|
.join('+');
|
|
11
11
|
const rightChannel = new Array(inputs * 2)
|
|
12
12
|
.fill(true)
|
|
13
13
|
.map((_, i) => (i % 2 === 1 ? `c${i}` : null))
|
|
14
|
-
.filter(
|
|
14
|
+
.filter(truthy_1.truthy)
|
|
15
15
|
.join('+');
|
|
16
16
|
return `[0:a][1:a]amerge=inputs=${inputs},pan=stereo|c0=${leftChannel}|c1=${rightChannel}[a]`;
|
|
17
17
|
};
|
package/dist/crf.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Codec } from './codec';
|
|
2
|
+
export declare type Crf = number | undefined;
|
|
3
|
+
export declare const getDefaultCrfForCodec: (codec: Codec) => number;
|
|
4
|
+
export declare const getValidCrfRanges: (codec: Codec) => [number, number];
|
|
5
|
+
export declare const validateSelectedCrfAndCodecCombination: (crf: unknown, codec: Codec) => void;
|
package/dist/crf.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateSelectedCrfAndCodecCombination = exports.getValidCrfRanges = exports.getDefaultCrfForCodec = void 0;
|
|
4
|
+
const is_audio_codec_1 = require("./is-audio-codec");
|
|
5
|
+
const getDefaultCrfForCodec = (codec) => {
|
|
6
|
+
if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
if (codec === 'h264' || codec === 'h264-mkv') {
|
|
10
|
+
return 18; // FFMPEG default 23
|
|
11
|
+
}
|
|
12
|
+
if (codec === 'h265' || codec === 'gif') {
|
|
13
|
+
return 23; // FFMPEG default 28
|
|
14
|
+
}
|
|
15
|
+
if (codec === 'vp8') {
|
|
16
|
+
return 9; // FFMPEG default 10
|
|
17
|
+
}
|
|
18
|
+
if (codec === 'vp9') {
|
|
19
|
+
return 28; // FFMPEG recommendation 31
|
|
20
|
+
}
|
|
21
|
+
if (codec === 'prores') {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
throw new TypeError(`Got unexpected codec "${codec}"`);
|
|
25
|
+
};
|
|
26
|
+
exports.getDefaultCrfForCodec = getDefaultCrfForCodec;
|
|
27
|
+
const getValidCrfRanges = (codec) => {
|
|
28
|
+
if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
|
|
29
|
+
return [0, 0];
|
|
30
|
+
}
|
|
31
|
+
if (codec === 'prores') {
|
|
32
|
+
return [0, 0];
|
|
33
|
+
}
|
|
34
|
+
if (codec === 'h264' || codec === 'h264-mkv') {
|
|
35
|
+
return [1, 51];
|
|
36
|
+
}
|
|
37
|
+
if (codec === 'h265' || codec === 'gif') {
|
|
38
|
+
return [0, 51];
|
|
39
|
+
}
|
|
40
|
+
if (codec === 'vp8') {
|
|
41
|
+
return [4, 63];
|
|
42
|
+
}
|
|
43
|
+
if (codec === 'vp9') {
|
|
44
|
+
return [0, 63];
|
|
45
|
+
}
|
|
46
|
+
throw new TypeError(`Got unexpected codec "${codec}"`);
|
|
47
|
+
};
|
|
48
|
+
exports.getValidCrfRanges = getValidCrfRanges;
|
|
49
|
+
const validateSelectedCrfAndCodecCombination = (crf, codec) => {
|
|
50
|
+
if (crf === null) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof crf !== 'number') {
|
|
54
|
+
throw new TypeError('Expected CRF to be a number, but is ' + JSON.stringify(crf));
|
|
55
|
+
}
|
|
56
|
+
const range = (0, exports.getValidCrfRanges)(codec);
|
|
57
|
+
if (crf === 0 && (codec === 'h264' || codec === 'h264-mkv')) {
|
|
58
|
+
throw new TypeError("Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably want. Set CRF to a higher value to fix this error.");
|
|
59
|
+
}
|
|
60
|
+
if (crf < range[0] || crf > range[1]) {
|
|
61
|
+
throw new TypeError(`CRF must be between ${range[0]} and ${range[1]} for codec ${codec}. Passed: ${crf}`);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.validateSelectedCrfAndCodecCombination = validateSelectedCrfAndCodecCombination;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { openBrowser } from './open-browser';
|
|
1
|
+
import type { openBrowser } from './open-browser';
|
|
2
2
|
declare type Await<T> = T extends PromiseLike<infer U> ? U : T;
|
|
3
|
-
|
|
3
|
+
declare type Browser = Await<ReturnType<typeof openBrowser>>;
|
|
4
|
+
export declare const cycleBrowserTabs: (puppeteerInstance: Browser, concurrency: number) => {
|
|
4
5
|
stopCycling: () => void;
|
|
5
6
|
};
|
|
6
7
|
export {};
|
|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cycleBrowserTabs = void 0;
|
|
4
4
|
const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
|
|
5
|
+
if (concurrency <= 1) {
|
|
6
|
+
return {
|
|
7
|
+
stopCycling: () => undefined,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
5
10
|
let interval = null;
|
|
6
11
|
let i = 0;
|
|
12
|
+
let stopped = false;
|
|
7
13
|
const set = () => {
|
|
8
14
|
interval = setTimeout(() => {
|
|
9
15
|
puppeteerInstance
|
|
10
16
|
.pages()
|
|
11
17
|
.then((pages) => {
|
|
12
|
-
var _a
|
|
18
|
+
var _a;
|
|
19
|
+
if (pages.length === 0) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
13
22
|
const currentPage = pages[i % pages.length];
|
|
14
23
|
i++;
|
|
15
|
-
if (!((
|
|
24
|
+
if (!((_a = currentPage === null || currentPage === void 0 ? void 0 : currentPage.isClosed) === null || _a === void 0 ? void 0 : _a.call(currentPage)) &&
|
|
25
|
+
!stopped &&
|
|
26
|
+
(currentPage === null || currentPage === void 0 ? void 0 : currentPage.url()) !== 'about:blank') {
|
|
16
27
|
return currentPage.bringToFront();
|
|
17
28
|
}
|
|
18
29
|
})
|
|
@@ -28,6 +39,7 @@ const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
|
|
|
28
39
|
if (!interval) {
|
|
29
40
|
return;
|
|
30
41
|
}
|
|
42
|
+
stopped = true;
|
|
31
43
|
return clearInterval(interval);
|
|
32
44
|
},
|
|
33
45
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UnsymbolicatedStackFrame } from './parse-browser-error-stack';
|
|
1
|
+
import type { UnsymbolicatedStackFrame } from './parse-browser-error-stack';
|
|
2
2
|
export declare const parseDelayRenderEmbeddedStack: (message: string) => UnsymbolicatedStackFrame[] | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ensureFramesInOrder: (
|
|
1
|
+
export declare const ensureFramesInOrder: (framesToRender: number[]) => {
|
|
2
2
|
waitForRightTimeOfFrameToBeInserted: (frameToBe: number) => Promise<void>;
|
|
3
3
|
setFrameToStitch: (f: number) => void;
|
|
4
4
|
waitForFinish: () => Promise<void>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureFramesInOrder = void 0;
|
|
4
|
-
const ensureFramesInOrder = (
|
|
5
|
-
let [frameToStitch
|
|
4
|
+
const ensureFramesInOrder = (framesToRender) => {
|
|
5
|
+
let [frameToStitch] = framesToRender;
|
|
6
|
+
const finalFrame = framesToRender[framesToRender.length - 1];
|
|
6
7
|
let waiters = [];
|
|
7
8
|
const resolveWaiters = () => {
|
|
8
9
|
for (const waiter of waiters.slice(0)) {
|
|
@@ -0,0 +1,69 @@
|
|
|
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.ensurePresentationTimestamps = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const guess_extension_for_media_1 = require("./guess-extension-for-media");
|
|
10
|
+
const truthy_1 = require("./truthy");
|
|
11
|
+
let callbacks = [];
|
|
12
|
+
const getTemporaryOutputName = async (src) => {
|
|
13
|
+
const parts = src.split(path_1.default.sep);
|
|
14
|
+
// If there is no file extension for the video, then we need to temporarily add an extension
|
|
15
|
+
const lastPart = parts[parts.length - 1];
|
|
16
|
+
const extraExtension = lastPart.includes('.')
|
|
17
|
+
? null
|
|
18
|
+
: await (0, guess_extension_for_media_1.guessExtensionForVideo)(src);
|
|
19
|
+
return parts
|
|
20
|
+
.map((p, i) => {
|
|
21
|
+
if (i === parts.length - 1) {
|
|
22
|
+
return [`pts-${p}`, extraExtension].filter(truthy_1.truthy).join('.');
|
|
23
|
+
}
|
|
24
|
+
return p;
|
|
25
|
+
})
|
|
26
|
+
.join(path_1.default.sep);
|
|
27
|
+
};
|
|
28
|
+
const ensurePresentationTimestamps = async (downloadMap, src) => {
|
|
29
|
+
const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
|
|
30
|
+
if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
callbacks.push({
|
|
33
|
+
src,
|
|
34
|
+
fn: (newSrc) => resolve(newSrc),
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'done') {
|
|
39
|
+
return elem.src;
|
|
40
|
+
}
|
|
41
|
+
downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
|
|
42
|
+
// If there is no file extension for the video, then we need to tempoa
|
|
43
|
+
const output = await getTemporaryOutputName(src);
|
|
44
|
+
await (0, execa_1.default)('ffmpeg', [
|
|
45
|
+
'-i',
|
|
46
|
+
src,
|
|
47
|
+
'-fflags',
|
|
48
|
+
'+genpts+igndts',
|
|
49
|
+
'-vcodec',
|
|
50
|
+
'copy',
|
|
51
|
+
'-acodec',
|
|
52
|
+
'copy',
|
|
53
|
+
output,
|
|
54
|
+
'-y',
|
|
55
|
+
]);
|
|
56
|
+
callbacks = callbacks.filter((c) => {
|
|
57
|
+
if (c.src === src) {
|
|
58
|
+
c.fn(output);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
});
|
|
63
|
+
downloadMap.ensureFileHasPresentationTimestamp[src] = {
|
|
64
|
+
type: 'done',
|
|
65
|
+
src: output,
|
|
66
|
+
};
|
|
67
|
+
return output;
|
|
68
|
+
};
|
|
69
|
+
exports.ensurePresentationTimestamps = ensurePresentationTimestamps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Page } from '
|
|
2
|
-
import { SymbolicatedStackFrame } from '../symbolicate-stacktrace';
|
|
1
|
+
import type { Page } from '../browser/BrowserPage';
|
|
2
|
+
import type { SymbolicatedStackFrame } from '../symbolicate-stacktrace';
|
|
3
3
|
export declare class ErrorWithStackFrame extends Error {
|
|
4
4
|
symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
|
|
5
5
|
frame: number | null;
|
|
@@ -41,8 +41,8 @@ const callFrameToStackFrame = (callFrame) => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
const handleJavascriptException = ({ page, onError, frame, }) => {
|
|
44
|
-
const client = page._client;
|
|
45
|
-
const handler =
|
|
44
|
+
const client = page._client();
|
|
45
|
+
const handler = (exception) => {
|
|
46
46
|
var _a, _b, _c;
|
|
47
47
|
const rawErrorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
|
|
48
48
|
const cleanErrorMessage = cleanUpErrorMessage(exception);
|
|
@@ -55,8 +55,7 @@ const handleJavascriptException = ({ page, onError, frame, }) => {
|
|
|
55
55
|
const errorType = (_b = exception.exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className;
|
|
56
56
|
const symbolicatedErr = new symbolicateable_error_1.SymbolicateableError({
|
|
57
57
|
message: removeDelayRenderStack(cleanErrorMessage),
|
|
58
|
-
stackFrame: exception.exceptionDetails.stackTrace
|
|
59
|
-
.callFrames.map((f) => callFrameToStackFrame(f)),
|
|
58
|
+
stackFrame: exception.exceptionDetails.stackTrace.callFrames.map((f) => callFrameToStackFrame(f)),
|
|
60
59
|
frame,
|
|
61
60
|
name: errorType,
|
|
62
61
|
stack: (_c = exception.exceptionDetails.exception) === null || _c === void 0 ? void 0 : _c.description,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ErrorWithStackFrame } from './handle-javascript-exception';
|
|
2
|
-
import { SymbolicateableError } from './symbolicateable-error';
|
|
2
|
+
import type { SymbolicateableError } from './symbolicateable-error';
|
|
3
3
|
export declare const symbolicateError: (symbolicateableError: SymbolicateableError) => Promise<ErrorWithStackFrame>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A symbolicateable error is an error that can be symolicated by fetching the original sources. By throwing a symbolicateable error, Remotion CLI will attempt to symplicate it
|
|
3
3
|
*/
|
|
4
|
-
import { UnsymbolicatedStackFrame } from '../parse-browser-error-stack';
|
|
4
|
+
import type { UnsymbolicatedStackFrame } from '../parse-browser-error-stack';
|
|
5
5
|
export declare class SymbolicateableError extends Error {
|
|
6
6
|
stackFrame: UnsymbolicatedStackFrame[] | null;
|
|
7
7
|
delayRenderCall: UnsymbolicatedStackFrame[] | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
3
|
+
import type { DownloadMap } from './assets/download-map';
|
|
4
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
5
|
+
import type { LastFrameOptions } from './last-frame-from-video-cache';
|
|
6
|
+
export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
|
|
7
|
+
declare type Options = {
|
|
8
|
+
time: number;
|
|
9
|
+
src: string;
|
|
10
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
11
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
12
|
+
imageFormat: OffthreadVideoImageFormat;
|
|
13
|
+
downloadMap: DownloadMap;
|
|
14
|
+
};
|
|
15
|
+
export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
|
|
16
|
+
export {};
|