@remotion/renderer 4.0.0-fastlambda.8 → 4.0.0-lambda.3
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/cleanup-assets.d.ts +2 -0
- package/dist/assets/cleanup-assets.js +2 -0
- package/dist/assets/download-and-map-assets-to-file.d.ts +6 -0
- package/dist/assets/download-and-map-assets-to-file.js +46 -19
- package/dist/assets/ffmpeg-volume-expression.d.ts +2 -1
- package/dist/assets/ffmpeg-volume-expression.js +15 -12
- package/dist/assets/get-audio-channels.d.ts +5 -2
- package/dist/assets/get-audio-channels.js +15 -4
- package/dist/browser/Accessibility.d.ts +175 -0
- package/dist/browser/Accessibility.js +423 -0
- package/dist/browser/AriaQueryHandler.d.ts +20 -0
- package/dist/browser/AriaQueryHandler.js +108 -0
- package/dist/browser/Browser.d.ts +209 -0
- package/dist/browser/Browser.js +402 -0
- package/dist/browser/BrowserConnector.d.ts +26 -0
- package/dist/browser/BrowserConnector.js +49 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +512 -0
- package/dist/browser/BrowserRunner.d.ts +39 -0
- package/dist/browser/BrowserRunner.js +308 -0
- package/dist/browser/Connection.d.ts +49 -0
- package/dist/browser/Connection.js +262 -0
- package/dist/browser/ConnectionTransport.d.ts +21 -0
- package/dist/browser/ConnectionTransport.js +17 -0
- package/dist/browser/ConsoleMessage.d.ts +55 -0
- package/dist/browser/ConsoleMessage.js +75 -0
- package/dist/browser/Coverage.d.ts +180 -0
- package/dist/browser/Coverage.js +371 -0
- package/dist/browser/DOMWorld.d.ts +50 -0
- package/dist/browser/DOMWorld.js +280 -0
- package/dist/browser/Debug.d.ts +19 -0
- package/dist/browser/Debug.js +42 -0
- package/dist/browser/DeviceDescriptors.d.ts +40 -0
- package/dist/browser/DeviceDescriptors.js +1407 -0
- package/dist/browser/EmulationManager.d.ts +7 -0
- package/dist/browser/EmulationManager.js +40 -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 +70 -0
- package/dist/browser/EventEmitter.js +102 -0
- package/dist/browser/ExecutionContext.d.ts +35 -0
- package/dist/browser/ExecutionContext.js +190 -0
- package/dist/browser/FileChooser.d.ts +56 -0
- package/dist/browser/FileChooser.js +86 -0
- package/dist/browser/FrameManager.d.ts +96 -0
- package/dist/browser/FrameManager.js +512 -0
- package/dist/browser/HTTPRequest.d.ts +42 -0
- package/dist/browser/HTTPRequest.js +82 -0
- package/dist/browser/HTTPResponse.d.ts +100 -0
- package/dist/browser/HTTPResponse.js +196 -0
- package/dist/browser/Input.d.ts +355 -0
- package/dist/browser/Input.js +592 -0
- package/dist/browser/JSHandle.d.ts +36 -0
- package/dist/browser/JSHandle.js +93 -0
- package/dist/browser/LaunchOptions.d.ts +117 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +9 -0
- package/dist/browser/Launcher.js +602 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +193 -0
- package/dist/browser/NetworkConditions.d.ts +26 -0
- package/dist/browser/NetworkConditions.js +33 -0
- package/dist/browser/NetworkEventManager.d.ts +35 -0
- package/dist/browser/NetworkEventManager.js +128 -0
- package/dist/browser/NetworkManager.d.ts +36 -0
- package/dist/browser/NetworkManager.js +284 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +11 -0
- package/dist/browser/NodeWebSocketTransport.js +90 -0
- package/dist/browser/PDFOptions.d.ts +165 -0
- package/dist/browser/PDFOptions.js +34 -0
- package/dist/browser/PipeTransport.d.ts +10 -0
- package/dist/browser/PipeTransport.js +86 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/Puppeteer.d.ts +35 -0
- package/dist/browser/Puppeteer.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +92 -0
- package/dist/browser/PuppeteerNode.js +143 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/QueryHandler.d.ts +64 -0
- package/dist/browser/QueryHandler.js +183 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/SecurityDetails.d.ts +55 -0
- package/dist/browser/SecurityDetails.js +95 -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 +23 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/Tracing.d.ts +45 -0
- package/dist/browser/Tracing.js +136 -0
- package/dist/browser/USKeyboardLayout.d.ts +39 -0
- package/dist/browser/USKeyboardLayout.js +406 -0
- package/dist/browser/WebWorker.d.ts +96 -0
- package/dist/browser/WebWorker.js +122 -0
- package/dist/browser/assert.d.ts +21 -0
- package/dist/browser/assert.js +29 -0
- package/dist/browser/compat.d.ts +2 -0
- package/dist/browser/compat.js +17 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +140 -0
- package/dist/browser/dialog.d.ts +70 -0
- package/dist/browser/dialog.js +114 -0
- package/dist/browser/environment.d.ts +16 -0
- package/dist/browser/environment.js +19 -0
- package/dist/browser/fetch.d.ts +16 -0
- package/dist/browser/fetch.js +46 -0
- package/dist/browser/find-up.d.ts +4 -0
- package/dist/browser/find-up.js +85 -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/page.d.ts +78 -0
- package/dist/browser/page.js +277 -0
- package/dist/browser/pkg-dir.d.ts +3 -0
- package/dist/browser/pkg-dir.js +13 -0
- package/dist/browser/revisions.d.ts +21 -0
- package/dist/browser/revisions.js +22 -0
- package/dist/browser/util.d.ts +46 -0
- package/dist/browser/util.js +161 -0
- package/dist/calculate-ffmpeg-filters.js +2 -2
- package/dist/combine-videos.d.ts +2 -1
- package/dist/combine-videos.js +8 -1
- package/dist/cycle-browser-tabs.d.ts +2 -1
- package/dist/cycle-browser-tabs.js +9 -2
- package/dist/ensure-presentation-timestamp.d.ts +1 -0
- package/dist/ensure-presentation-timestamp.js +57 -0
- package/dist/extract-frame-from-video.d.ts +11 -0
- package/dist/extract-frame-from-video.js +197 -0
- package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
- package/dist/frame-to-ffmpeg-timestamp.js +8 -0
- package/dist/get-compositions.d.ts +5 -2
- package/dist/get-compositions.js +23 -5
- package/dist/get-duration-of-asset.d.ts +7 -0
- package/dist/get-duration-of-asset.js +36 -0
- package/dist/get-port.js +26 -24
- package/dist/index.d.ts +33 -9
- package/dist/index.js +14 -5
- package/dist/is-beyond-last-frame.d.ts +2 -0
- package/dist/is-beyond-last-frame.js +12 -0
- package/dist/last-frame-from-video-cache.d.ts +10 -0
- package/dist/last-frame-from-video-cache.js +50 -0
- package/dist/make-assets-download-dir.js +6 -1
- package/dist/make-cancel-signal.d.ts +7 -0
- package/dist/make-cancel-signal.js +25 -0
- package/dist/merge-audio-track.js +2 -2
- package/dist/offthread-video-server.d.ts +14 -0
- package/dist/offthread-video-server.js +67 -0
- package/dist/open-browser.d.ts +6 -6
- package/dist/open-browser.js +24 -20
- package/dist/prepare-server.d.ts +13 -2
- package/dist/prepare-server.js +35 -5
- package/dist/preprocess-audio-track.d.ts +1 -0
- package/dist/preprocess-audio-track.js +2 -2
- package/dist/prespawn-ffmpeg.d.ts +2 -0
- package/dist/prespawn-ffmpeg.js +10 -9
- package/dist/provide-screenshot.js +1 -1
- package/dist/puppeteer-screenshot.js +5 -1
- package/dist/render-frames.d.ts +6 -1
- package/dist/render-frames.js +96 -37
- package/dist/render-media.d.ts +12 -2
- package/dist/render-media.js +127 -54
- package/dist/render-still.d.ts +14 -4
- package/dist/render-still.js +58 -19
- package/dist/serve-handler/glob-slash.d.ts +1 -0
- package/dist/serve-handler/glob-slash.js +12 -0
- package/dist/serve-handler/index.d.ts +4 -0
- package/dist/serve-handler/index.js +205 -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 +10 -3
- package/dist/serve-static.js +22 -4
- package/dist/set-props-and-env.d.ts +3 -1
- package/dist/set-props-and-env.js +28 -6
- package/dist/stitch-frames-to-video.d.ts +4 -1
- package/dist/stitch-frames-to-video.js +36 -15
- package/dist/stringify-ffmpeg-filter.js +3 -0
- package/dist/tmp-dir.js +5 -1
- package/dist/validate-fps-for-gif.d.ts +2 -0
- package/dist/validate-fps-for-gif.js +9 -0
- package/package.json +6 -7
|
@@ -0,0 +1,27 @@
|
|
|
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.isPathInside = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const isPathInside = function (thePath, potentialParent) {
|
|
9
|
+
// For inside-directory checking, we want to allow trailing slashes, so normalize.
|
|
10
|
+
thePath = stripTrailingSep(thePath);
|
|
11
|
+
potentialParent = stripTrailingSep(potentialParent);
|
|
12
|
+
// Node treats only Windows as case-insensitive in its path module; we follow those conventions.
|
|
13
|
+
if (process.platform === 'win32') {
|
|
14
|
+
thePath = thePath.toLowerCase();
|
|
15
|
+
potentialParent = potentialParent.toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
return (thePath.lastIndexOf(potentialParent, 0) === 0 &&
|
|
18
|
+
(thePath[potentialParent.length] === path_1.default.sep ||
|
|
19
|
+
thePath[potentialParent.length] === undefined));
|
|
20
|
+
};
|
|
21
|
+
exports.isPathInside = isPathInside;
|
|
22
|
+
function stripTrailingSep(thePath) {
|
|
23
|
+
if (thePath[thePath.length - 1] === path_1.default.sep) {
|
|
24
|
+
return thePath.slice(0, -1);
|
|
25
|
+
}
|
|
26
|
+
return thePath;
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* range-parser
|
|
3
|
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
4
|
+
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
export declare const rangeParser: (size: number, str: string) => -1 | {
|
|
8
|
+
type: string;
|
|
9
|
+
ranges: {
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
}[];
|
|
13
|
+
} | -2;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* range-parser
|
|
4
|
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
5
|
+
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.rangeParser = void 0;
|
|
10
|
+
const rangeParser = (size, str) => {
|
|
11
|
+
if (typeof str !== 'string') {
|
|
12
|
+
throw new TypeError('argument str must be a string');
|
|
13
|
+
}
|
|
14
|
+
const index = str.indexOf('=');
|
|
15
|
+
if (index === -1) {
|
|
16
|
+
return -2;
|
|
17
|
+
}
|
|
18
|
+
// split the range string
|
|
19
|
+
const arr = str.slice(index + 1).split(',');
|
|
20
|
+
const ranges = [];
|
|
21
|
+
// add ranges type
|
|
22
|
+
const type = str.slice(0, index);
|
|
23
|
+
// parse all ranges
|
|
24
|
+
for (let i = 0; i < arr.length; i++) {
|
|
25
|
+
const range = arr[i].split('-');
|
|
26
|
+
let start = parseInt(range[0], 10);
|
|
27
|
+
let end = parseInt(range[1], 10);
|
|
28
|
+
// -nnn
|
|
29
|
+
if (isNaN(start)) {
|
|
30
|
+
start = size - end;
|
|
31
|
+
end = size - 1;
|
|
32
|
+
// nnn-
|
|
33
|
+
}
|
|
34
|
+
else if (isNaN(end)) {
|
|
35
|
+
end = size - 1;
|
|
36
|
+
}
|
|
37
|
+
// limit last-byte-pos to current length
|
|
38
|
+
if (end > size - 1) {
|
|
39
|
+
end = size - 1;
|
|
40
|
+
}
|
|
41
|
+
// invalid or unsatisifiable
|
|
42
|
+
if (isNaN(start) || isNaN(end) || start > end || start < 0) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
// add range
|
|
46
|
+
ranges.push({
|
|
47
|
+
start,
|
|
48
|
+
end,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (ranges.length < 1) {
|
|
52
|
+
// unsatisifiable
|
|
53
|
+
return -1;
|
|
54
|
+
}
|
|
55
|
+
return { ranges, type };
|
|
56
|
+
};
|
|
57
|
+
exports.rangeParser = rangeParser;
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { FfmpegExecutable } from 'remotion';
|
|
2
|
+
import { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
|
+
export declare const serveStatic: (path: string | null, options: {
|
|
4
|
+
port: number | null;
|
|
5
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
6
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
7
|
+
downloadDir: string;
|
|
8
|
+
onDownload: RenderMediaOnDownload;
|
|
9
|
+
onError: (err: Error) => void;
|
|
10
|
+
}) => Promise<{
|
|
4
11
|
port: number;
|
|
5
12
|
close: () => Promise<void>;
|
|
6
13
|
}>;
|
package/dist/serve-static.js
CHANGED
|
@@ -6,18 +6,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.serveStatic = void 0;
|
|
7
7
|
const http_1 = __importDefault(require("http"));
|
|
8
8
|
const remotion_1 = require("remotion");
|
|
9
|
-
const serve_handler_1 = __importDefault(require("serve-handler"));
|
|
10
9
|
const get_port_1 = require("./get-port");
|
|
10
|
+
const offthread_video_server_1 = require("./offthread-video-server");
|
|
11
|
+
const serve_handler_1 = require("./serve-handler");
|
|
11
12
|
const serveStatic = async (path, options) => {
|
|
12
13
|
var _a, _b;
|
|
13
14
|
const port = await (0, get_port_1.getDesiredPort)((_b = (_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : remotion_1.Internals.getServerPort()) !== null && _b !== void 0 ? _b : undefined, 3000, 3100);
|
|
15
|
+
const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
16
|
+
ffmpegExecutable: options.ffmpegExecutable,
|
|
17
|
+
ffprobeExecutable: options.ffprobeExecutable,
|
|
18
|
+
downloadDir: options.downloadDir,
|
|
19
|
+
onDownload: options.onDownload,
|
|
20
|
+
onError: options.onError,
|
|
21
|
+
});
|
|
14
22
|
try {
|
|
15
23
|
const server = http_1.default
|
|
16
24
|
.createServer((request, response) => {
|
|
17
|
-
|
|
25
|
+
var _a;
|
|
26
|
+
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('/proxy')) {
|
|
27
|
+
return offthreadRequest(request, response);
|
|
28
|
+
}
|
|
29
|
+
if (path === null) {
|
|
30
|
+
response.writeHead(404);
|
|
31
|
+
response.end('Server only supports /proxy');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
(0, serve_handler_1.serveHandler)(request, response, {
|
|
18
35
|
public: path,
|
|
19
|
-
directoryListing: false,
|
|
20
|
-
cleanUrls: false,
|
|
21
36
|
}).catch(() => {
|
|
22
37
|
response.statusCode = 500;
|
|
23
38
|
response.end('Error serving file');
|
|
@@ -28,6 +43,9 @@ const serveStatic = async (path, options) => {
|
|
|
28
43
|
return new Promise((resolve, reject) => {
|
|
29
44
|
server.close((err) => {
|
|
30
45
|
if (err) {
|
|
46
|
+
if (err.code === 'ERR_SERVER_NOT_RUNNING') {
|
|
47
|
+
return resolve();
|
|
48
|
+
}
|
|
31
49
|
reject(err);
|
|
32
50
|
}
|
|
33
51
|
else {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Page } from 'puppeteer-core';
|
|
2
|
-
export declare const setPropsAndEnv: ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, }: {
|
|
2
|
+
export declare const setPropsAndEnv: ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, }: {
|
|
3
3
|
inputProps: unknown;
|
|
4
4
|
envVariables: Record<string, string> | undefined;
|
|
5
5
|
page: Page;
|
|
6
6
|
serveUrl: string;
|
|
7
7
|
initialFrame: number;
|
|
8
8
|
timeoutInMilliseconds: number | undefined;
|
|
9
|
+
proxyPort: number;
|
|
10
|
+
retriesRemaining: number;
|
|
9
11
|
}) => Promise<void>;
|
|
@@ -5,7 +5,7 @@ const remotion_1 = require("remotion");
|
|
|
5
5
|
const normalize_serve_url_1 = require("./normalize-serve-url");
|
|
6
6
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
7
7
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
8
|
-
const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, }) => {
|
|
8
|
+
const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, }) => {
|
|
9
9
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
10
10
|
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : remotion_1.Internals.DEFAULT_PUPPETEER_TIMEOUT;
|
|
11
11
|
page.setDefaultTimeout(actualTimeout);
|
|
@@ -24,11 +24,33 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
|
|
|
24
24
|
window.remotion_envVariables = input;
|
|
25
25
|
}, [JSON.stringify(envVariables)]);
|
|
26
26
|
}
|
|
27
|
-
await page.evaluateOnNewDocument((key
|
|
28
|
-
window.
|
|
29
|
-
}, [
|
|
27
|
+
await page.evaluateOnNewDocument((key) => {
|
|
28
|
+
window.remotion_initialFrame = key;
|
|
29
|
+
}, [initialFrame]);
|
|
30
|
+
await page.evaluateOnNewDocument((port) => {
|
|
31
|
+
window.remotion_proxyPort = port;
|
|
32
|
+
}, [proxyPort]);
|
|
30
33
|
const pageRes = await page.goto(urlToVisit);
|
|
31
34
|
const status = pageRes.status();
|
|
35
|
+
// S3 in rare occasions returns a 500 or 503 error code for GET operations.
|
|
36
|
+
// Usually it is fixed by retrying.
|
|
37
|
+
if (status >= 500 && status <= 504 && retriesRemaining > 0) {
|
|
38
|
+
await new Promise((resolve) => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
resolve();
|
|
41
|
+
}, 2000);
|
|
42
|
+
});
|
|
43
|
+
return (0, exports.setPropsAndEnv)({
|
|
44
|
+
envVariables,
|
|
45
|
+
initialFrame,
|
|
46
|
+
inputProps,
|
|
47
|
+
page,
|
|
48
|
+
proxyPort,
|
|
49
|
+
retriesRemaining: retriesRemaining - 1,
|
|
50
|
+
serveUrl,
|
|
51
|
+
timeoutInMilliseconds,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
32
54
|
if (status !== 200 &&
|
|
33
55
|
status !== 301 &&
|
|
34
56
|
status !== 302 &&
|
|
@@ -55,8 +77,8 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
|
|
|
55
77
|
frame: null,
|
|
56
78
|
page,
|
|
57
79
|
});
|
|
58
|
-
if (siteVersion !== '
|
|
59
|
-
throw new Error(`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. The bundle format changed in
|
|
80
|
+
if (siteVersion !== '3') {
|
|
81
|
+
throw new Error(`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. The bundle format changed in version 3.0.11. To resolve this error, please bundle and deploy again.`);
|
|
60
82
|
}
|
|
61
83
|
};
|
|
62
84
|
exports.setPropsAndEnv = setPropsAndEnv;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Codec, FfmpegExecutable, ImageFormat, PixelFormat, ProResProfile, RenderAssetInfo } from 'remotion';
|
|
2
2
|
import { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
|
+
import { CancelSignal } from './make-cancel-signal';
|
|
3
4
|
export declare type StitcherOptions = {
|
|
4
5
|
fps: number;
|
|
5
6
|
width: number;
|
|
@@ -15,14 +16,16 @@ export declare type StitcherOptions = {
|
|
|
15
16
|
proResProfile?: ProResProfile;
|
|
16
17
|
verbose?: boolean;
|
|
17
18
|
ffmpegExecutable?: FfmpegExecutable;
|
|
19
|
+
ffprobeExecutable?: FfmpegExecutable;
|
|
18
20
|
dir?: string;
|
|
21
|
+
cancelSignal?: CancelSignal;
|
|
19
22
|
internalOptions?: {
|
|
20
23
|
preEncodedFileLocation: string | null;
|
|
21
24
|
imageFormat: ImageFormat;
|
|
22
25
|
};
|
|
23
26
|
};
|
|
24
27
|
declare type ReturnType = {
|
|
25
|
-
task: Promise<
|
|
28
|
+
task: Promise<void>;
|
|
26
29
|
getLogs: () => string;
|
|
27
30
|
};
|
|
28
31
|
export declare const spawnFfmpeg: (options: StitcherOptions) => Promise<ReturnType>;
|
|
@@ -25,7 +25,7 @@ const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
|
|
|
25
25
|
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
26
26
|
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
27
27
|
: null;
|
|
28
|
-
const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFrames, verbose, ffmpegExecutable, onProgress, }) => {
|
|
28
|
+
const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFrames, verbose, ffmpegExecutable, ffprobeExecutable, onProgress, }) => {
|
|
29
29
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
30
30
|
assets,
|
|
31
31
|
downloadDir,
|
|
@@ -45,6 +45,7 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
|
|
|
45
45
|
const filterFile = path_1.default.join(tempPath, `${index}.wav`);
|
|
46
46
|
const result = await (0, preprocess_audio_track_1.preprocessAudioTrack)({
|
|
47
47
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
48
|
+
ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
|
|
48
49
|
outName: filterFile,
|
|
49
50
|
asset,
|
|
50
51
|
expectedFrames,
|
|
@@ -68,7 +69,7 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
|
|
|
68
69
|
return outName;
|
|
69
70
|
};
|
|
70
71
|
const spawnFfmpeg = async (options) => {
|
|
71
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
72
73
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
73
74
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
74
75
|
remotion_1.Internals.validateFps(options.fps, 'passed to `stitchFramesToVideo()`');
|
|
@@ -115,21 +116,29 @@ const spawnFfmpeg = async (options) => {
|
|
|
115
116
|
expectedFrames,
|
|
116
117
|
verbose: (_f = options.verbose) !== null && _f !== void 0 ? _f : false,
|
|
117
118
|
ffmpegExecutable: (_g = options.ffmpegExecutable) !== null && _g !== void 0 ? _g : null,
|
|
119
|
+
ffprobeExecutable: (_h = options.ffprobeExecutable) !== null && _h !== void 0 ? _h : null,
|
|
118
120
|
onProgress: (prog) => updateProgress(prog, 0),
|
|
119
121
|
});
|
|
120
122
|
if (isAudioOnly) {
|
|
121
123
|
if (!audioCodecName) {
|
|
122
124
|
throw new TypeError('exporting audio but has no audio codec name. Report this in the Remotion repo.');
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
const ffmpegTask = (0, execa_1.default)('ffmpeg', [
|
|
125
127
|
'-i',
|
|
126
128
|
audio,
|
|
127
129
|
'-c:a',
|
|
128
130
|
audioCodecName,
|
|
131
|
+
// Set bitrate up to 320k, for aac it might effectively be lower
|
|
132
|
+
'-b:a',
|
|
133
|
+
'320k',
|
|
129
134
|
options.force ? '-y' : null,
|
|
130
135
|
options.outputLocation,
|
|
131
136
|
].filter(remotion_1.Internals.truthy));
|
|
132
|
-
(
|
|
137
|
+
(_j = options.cancelSignal) === null || _j === void 0 ? void 0 : _j.call(options, () => {
|
|
138
|
+
ffmpegTask.kill();
|
|
139
|
+
});
|
|
140
|
+
await ffmpegTask;
|
|
141
|
+
(_k = options.onProgress) === null || _k === void 0 ? void 0 : _k.call(options, expectedFrames);
|
|
133
142
|
return {
|
|
134
143
|
getLogs: () => '',
|
|
135
144
|
task: Promise.resolve(),
|
|
@@ -137,8 +146,8 @@ const spawnFfmpeg = async (options) => {
|
|
|
137
146
|
}
|
|
138
147
|
const ffmpegArgs = [
|
|
139
148
|
['-r', String(options.fps)],
|
|
140
|
-
...(((
|
|
141
|
-
? [['-i', (
|
|
149
|
+
...(((_l = options.internalOptions) === null || _l === void 0 ? void 0 : _l.preEncodedFileLocation)
|
|
150
|
+
? [['-i', (_m = options.internalOptions) === null || _m === void 0 ? void 0 : _m.preEncodedFileLocation]]
|
|
142
151
|
: [
|
|
143
152
|
['-f', 'image2'],
|
|
144
153
|
['-s', `${options.width}x${options.height}`],
|
|
@@ -149,7 +158,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
149
158
|
// -c:v is the same as -vcodec as -codec:video
|
|
150
159
|
// and specified the video codec.
|
|
151
160
|
['-c:v', encoderName],
|
|
152
|
-
...(((
|
|
161
|
+
...(((_o = options.internalOptions) === null || _o === void 0 ? void 0 : _o.preEncodedFileLocation)
|
|
153
162
|
? []
|
|
154
163
|
: [
|
|
155
164
|
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
@@ -160,7 +169,10 @@ const spawnFfmpeg = async (options) => {
|
|
|
160
169
|
pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
|
|
161
170
|
['-b:v', '1M'],
|
|
162
171
|
]),
|
|
172
|
+
codec === 'h264' ? ['-movflags', 'faststart'] : null,
|
|
163
173
|
audioCodecName ? ['-c:a', audioCodecName] : null,
|
|
174
|
+
// Set max bitrate up to 1024kbps, will choose lower if that's too much
|
|
175
|
+
audioCodecName ? ['-b:a', '512K'] : null,
|
|
164
176
|
// Ignore metadata that may come from remote media
|
|
165
177
|
['-map_metadata', '-1'],
|
|
166
178
|
[
|
|
@@ -176,12 +188,15 @@ const spawnFfmpeg = async (options) => {
|
|
|
176
188
|
console.log(ffmpegArgs);
|
|
177
189
|
}
|
|
178
190
|
const ffmpegString = ffmpegArgs.flat(2).filter(Boolean);
|
|
179
|
-
const task = (0, execa_1.default)((
|
|
191
|
+
const task = (0, execa_1.default)((_p = options.ffmpegExecutable) !== null && _p !== void 0 ? _p : 'ffmpeg', ffmpegString, {
|
|
180
192
|
cwd: options.dir,
|
|
181
193
|
});
|
|
194
|
+
(_q = options.cancelSignal) === null || _q === void 0 ? void 0 : _q.call(options, () => {
|
|
195
|
+
task.kill();
|
|
196
|
+
});
|
|
182
197
|
let ffmpegOutput = '';
|
|
183
198
|
let isFinished = false;
|
|
184
|
-
(
|
|
199
|
+
(_r = task.stderr) === null || _r === void 0 ? void 0 : _r.on('data', (data) => {
|
|
185
200
|
var _a;
|
|
186
201
|
const str = data.toString();
|
|
187
202
|
ffmpegOutput += str;
|
|
@@ -203,16 +218,22 @@ const spawnFfmpeg = async (options) => {
|
|
|
203
218
|
}
|
|
204
219
|
}
|
|
205
220
|
});
|
|
206
|
-
return { task, getLogs: () => ffmpegOutput };
|
|
221
|
+
return { task: task.then(() => undefined), getLogs: () => ffmpegOutput };
|
|
207
222
|
};
|
|
208
223
|
exports.spawnFfmpeg = spawnFfmpeg;
|
|
209
224
|
const stitchFramesToVideo = async (options) => {
|
|
210
225
|
const { task, getLogs } = await (0, exports.spawnFfmpeg)(options);
|
|
211
|
-
|
|
212
|
-
await task;
|
|
213
|
-
}
|
|
214
|
-
catch (err) {
|
|
226
|
+
const happyPath = task.catch(() => {
|
|
215
227
|
throw new Error(getLogs());
|
|
216
|
-
}
|
|
228
|
+
});
|
|
229
|
+
return Promise.race([
|
|
230
|
+
happyPath,
|
|
231
|
+
new Promise((_resolve, reject) => {
|
|
232
|
+
var _a;
|
|
233
|
+
(_a = options.cancelSignal) === null || _a === void 0 ? void 0 : _a.call(options, () => {
|
|
234
|
+
reject(new Error('stitchFramesToVideo() got cancelled'));
|
|
235
|
+
});
|
|
236
|
+
}),
|
|
237
|
+
]);
|
|
217
238
|
};
|
|
218
239
|
exports.stitchFramesToVideo = stitchFramesToVideo;
|
|
@@ -11,6 +11,7 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
|
|
|
11
11
|
volume,
|
|
12
12
|
startInVideo,
|
|
13
13
|
fps,
|
|
14
|
+
trimLeft,
|
|
14
15
|
});
|
|
15
16
|
// Avoid setting filters if possible, as combining them can create noise
|
|
16
17
|
const chunkLength = durationInFrames / fps;
|
|
@@ -37,6 +38,8 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
|
|
|
37
38
|
.fill((startInVideoSeconds * 1000).toFixed(0))
|
|
38
39
|
.join('|')}`,
|
|
39
40
|
// set the volume if needed
|
|
41
|
+
// The timings for volume must include whatever is in atrim, unless the volume
|
|
42
|
+
// filter gets applied before atrim
|
|
40
43
|
volumeFilter.value === '1'
|
|
41
44
|
? null
|
|
42
45
|
: `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
|
package/dist/tmp-dir.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFpsForGif = void 0;
|
|
4
|
+
const validateFpsForGif = (codec, fps) => {
|
|
5
|
+
if (codec === 'gif' && (fps > 50 || fps < 1)) {
|
|
6
|
+
throw new Error(`To render a GIF, the FPS must be less than or equal to 50 and greater than 0 but got ${fps} instead`);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
exports.validateFpsForGif = validateFpsForGif;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-lambda.3+32da0b782",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,11 +20,10 @@
|
|
|
20
20
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@remotion/bundler": "4.0.0-fastlambda.8+64cb75673",
|
|
24
23
|
"execa": "5.1.1",
|
|
24
|
+
"mime-types": "2.1.35",
|
|
25
25
|
"puppeteer-core": "13.5.1",
|
|
26
|
-
"remotion": "4.0.0-
|
|
27
|
-
"serve-handler": "6.1.3",
|
|
26
|
+
"remotion": "4.0.0-lambda.3+32da0b782",
|
|
28
27
|
"source-map": "^0.8.0-beta.0"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
@@ -36,10 +35,10 @@
|
|
|
36
35
|
"@testing-library/dom": "^8.7.2",
|
|
37
36
|
"@testing-library/react": "13.1.1",
|
|
38
37
|
"@types/jest": "^27.4.0",
|
|
38
|
+
"@types/mime-types": "2.1.1",
|
|
39
39
|
"@types/node": "^16.7.5",
|
|
40
40
|
"@types/react": "18.0.1",
|
|
41
41
|
"@types/react-dom": "18.0.0",
|
|
42
|
-
"@types/serve-handler": "^6.1.0",
|
|
43
42
|
"eslint": "8.13.0",
|
|
44
43
|
"jest": "^27.2.4",
|
|
45
44
|
"prettier": "^2.0.5",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"react": "18.0.0",
|
|
48
47
|
"react-dom": "18.0.0",
|
|
49
48
|
"ts-jest": "^27.0.5",
|
|
50
|
-
"typescript": "^4.
|
|
49
|
+
"typescript": "^4.7.0"
|
|
51
50
|
},
|
|
52
51
|
"keywords": [
|
|
53
52
|
"remotion",
|
|
@@ -60,5 +59,5 @@
|
|
|
60
59
|
"publishConfig": {
|
|
61
60
|
"access": "public"
|
|
62
61
|
},
|
|
63
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "32da0b782094e5eac82cdc1b1469a80bb763b392"
|
|
64
63
|
}
|