@remotion/renderer 4.0.16 → 4.0.18
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/get-video-stream-duration.d.ts +9 -0
- package/dist/assets/get-video-stream-duration.js +71 -0
- package/dist/browser/BrowserFetcher.d.ts +2 -19
- package/dist/browser/BrowserFetcher.js +73 -263
- package/dist/browser/LaunchOptions.d.ts +0 -2
- package/dist/browser/Launcher.d.ts +0 -5
- package/dist/browser/Launcher.js +5 -14
- package/dist/browser/PuppeteerNode.d.ts +1 -8
- package/dist/browser/PuppeteerNode.js +10 -27
- package/dist/browser/node.js +1 -5
- 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/client.d.ts +48 -48
- package/dist/compositor/payloads.d.ts +18 -0
- package/dist/determine-resize-params.d.ts +4 -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/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/frame-to-ffmpeg-timestamp.d.ts +1 -0
- package/dist/frame-to-ffmpeg-timestamp.js +8 -0
- package/dist/get-can-extract-frames-fast.d.ts +14 -0
- package/dist/get-can-extract-frames-fast.js +71 -0
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-frame-of-video-slow.d.ts +17 -0
- package/dist/get-frame-of-video-slow.js +72 -0
- package/dist/get-local-browser-executable.d.ts +2 -3
- package/dist/get-local-browser-executable.js +45 -53
- package/dist/get-silent-parts.d.ts +8 -0
- package/dist/get-silent-parts.js +56 -0
- package/dist/get-video-info.d.ts +8 -0
- package/dist/get-video-info.js +59 -0
- package/dist/index.d.ts +45 -42
- package/dist/index.js +4 -1
- 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/legacy-webpack-config.d.ts +9 -0
- package/dist/legacy-webpack-config.js +13 -0
- package/dist/open-browser.js +3 -3
- package/dist/quality.d.ts +1 -0
- package/dist/quality.js +21 -0
- package/dist/render-media.js +5 -2
- package/dist/set-props-and-env.js +6 -3
- package/dist/stitch-frames-to-video.d.ts +1 -0
- 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/validate-ffmpeg.d.ts +7 -0
- package/dist/validate-ffmpeg.js +77 -0
- package/dist/validate-opengl-renderer.d.ts +2 -3
- package/dist/validate-opengl-renderer.js +9 -4
- package/dist/validate-output-filename.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 +9 -10
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markAsBeyondLastFrame = exports.isBeyondLastFrame = void 0;
|
|
4
|
+
const isBeyondLastFrame = (downloadMap, src, time) => {
|
|
5
|
+
return (downloadMap.isBeyondLastFrameMap[src] &&
|
|
6
|
+
time >= downloadMap.isBeyondLastFrameMap[src]);
|
|
7
|
+
};
|
|
8
|
+
exports.isBeyondLastFrame = isBeyondLastFrame;
|
|
9
|
+
const markAsBeyondLastFrame = (downloadMap, src, time) => {
|
|
10
|
+
downloadMap.isBeyondLastFrameMap[src] = time;
|
|
11
|
+
};
|
|
12
|
+
exports.markAsBeyondLastFrame = markAsBeyondLastFrame;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
2
|
+
import type { DownloadMap, SpecialVCodecForTransparency } from './assets/download-map';
|
|
3
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
4
|
+
export type LastFrameOptions = {
|
|
5
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
6
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
7
|
+
offset: number;
|
|
8
|
+
src: string;
|
|
9
|
+
specialVCodecForTransparency: SpecialVCodecForTransparency;
|
|
10
|
+
imageFormat: OffthreadVideoImageFormat;
|
|
11
|
+
needsResize: [number, number] | null;
|
|
12
|
+
downloadMap: DownloadMap;
|
|
13
|
+
remotionRoot: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const setLastFrameInCache: (options: LastFrameOptions, data: Buffer) => void;
|
|
16
|
+
export declare const getLastFrameFromCache: (options: LastFrameOptions) => Buffer | null;
|
|
17
|
+
export declare const clearLastFileCache: (downloadMap: DownloadMap) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// OffthreadVideo requires sometimes that the last frame of a video gets extracted, however, this can be slow. We allocate a cache for it but that can be garbage collected
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearLastFileCache = exports.getLastFrameFromCache = exports.setLastFrameInCache = void 0;
|
|
5
|
+
const MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
|
|
6
|
+
let bufferSize = 0;
|
|
7
|
+
const makeLastFrameCacheKey = (options) => {
|
|
8
|
+
return [
|
|
9
|
+
options.ffmpegExecutable,
|
|
10
|
+
options.offset,
|
|
11
|
+
options.src,
|
|
12
|
+
options.imageFormat,
|
|
13
|
+
options.downloadMap.id,
|
|
14
|
+
].join('-');
|
|
15
|
+
};
|
|
16
|
+
const setLastFrameInCache = (options, data) => {
|
|
17
|
+
const key = makeLastFrameCacheKey(options);
|
|
18
|
+
if (options.downloadMap.lastFrameMap[key]) {
|
|
19
|
+
bufferSize -= options.downloadMap.lastFrameMap[key].data.byteLength;
|
|
20
|
+
}
|
|
21
|
+
options.downloadMap.lastFrameMap[key] = { data, lastAccessed: Date.now() };
|
|
22
|
+
bufferSize += data.byteLength;
|
|
23
|
+
ensureMaxSize(options.downloadMap);
|
|
24
|
+
};
|
|
25
|
+
exports.setLastFrameInCache = setLastFrameInCache;
|
|
26
|
+
const getLastFrameFromCache = (options) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const key = makeLastFrameCacheKey(options);
|
|
29
|
+
if (!options.downloadMap.lastFrameMap[key]) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
options.downloadMap.lastFrameMap[key].lastAccessed = Date.now();
|
|
33
|
+
return (_a = options.downloadMap.lastFrameMap[key].data) !== null && _a !== void 0 ? _a : null;
|
|
34
|
+
};
|
|
35
|
+
exports.getLastFrameFromCache = getLastFrameFromCache;
|
|
36
|
+
const removedLastFrameFromCache = (key, downloadMap) => {
|
|
37
|
+
if (!downloadMap.lastFrameMap[key]) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
bufferSize -= downloadMap.lastFrameMap[key].data.byteLength;
|
|
41
|
+
delete downloadMap.lastFrameMap[key];
|
|
42
|
+
};
|
|
43
|
+
const ensureMaxSize = (downloadMap) => {
|
|
44
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
45
|
+
while (bufferSize > MAX_CACHE_SIZE) {
|
|
46
|
+
const earliest = Object.entries(downloadMap.lastFrameMap).sort((a, b) => {
|
|
47
|
+
return a[1].lastAccessed - b[1].lastAccessed;
|
|
48
|
+
})[0];
|
|
49
|
+
removedLastFrameFromCache(earliest[0], downloadMap);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const clearLastFileCache = (downloadMap) => {
|
|
53
|
+
downloadMap.lastFrameMap = {};
|
|
54
|
+
};
|
|
55
|
+
exports.clearLastFileCache = clearLastFileCache;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getServeUrlWithFallback = void 0;
|
|
4
|
+
const getServeUrlWithFallback = (serve) => {
|
|
5
|
+
if ('webpackBundle' in serve) {
|
|
6
|
+
return serve.webpackBundle;
|
|
7
|
+
}
|
|
8
|
+
if ('serveUrl' in serve) {
|
|
9
|
+
return serve.serveUrl;
|
|
10
|
+
}
|
|
11
|
+
throw new Error('You must pass the `serveUrl` parameter');
|
|
12
|
+
};
|
|
13
|
+
exports.getServeUrlWithFallback = getServeUrlWithFallback;
|
package/dist/open-browser.js
CHANGED
|
@@ -30,15 +30,15 @@ const killAllBrowsers = async () => {
|
|
|
30
30
|
exports.killAllBrowsers = killAllBrowsers;
|
|
31
31
|
const internalOpenBrowser = async ({ browser, browserExecutable, chromiumOptions, forceDeviceScaleFactor, indent, viewport, logLevel, }) => {
|
|
32
32
|
var _a, _b;
|
|
33
|
+
// @ts-expect-error Firefox
|
|
33
34
|
if (browser === 'firefox') {
|
|
34
35
|
throw new TypeError('Firefox supported is not yet turned on. Stay tuned for the future.');
|
|
35
36
|
}
|
|
36
|
-
await (0, get_local_browser_executable_1.ensureLocalBrowser)(
|
|
37
|
-
const executablePath = (0, get_local_browser_executable_1.getLocalBrowserExecutable)(
|
|
37
|
+
await (0, get_local_browser_executable_1.ensureLocalBrowser)(browserExecutable);
|
|
38
|
+
const executablePath = (0, get_local_browser_executable_1.getLocalBrowserExecutable)(browserExecutable);
|
|
38
39
|
const customGlRenderer = getOpenGlRenderer((_a = chromiumOptions.gl) !== null && _a !== void 0 ? _a : null);
|
|
39
40
|
const browserInstance = await node_1.puppeteer.launch({
|
|
40
41
|
executablePath,
|
|
41
|
-
product: browser,
|
|
42
42
|
dumpio: (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose'),
|
|
43
43
|
logLevel,
|
|
44
44
|
indent,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateQuality: (q: number | undefined) => void;
|
package/dist/quality.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateQuality = void 0;
|
|
4
|
+
const validateQuality = (q) => {
|
|
5
|
+
if (typeof q !== 'undefined' && typeof q !== 'number') {
|
|
6
|
+
throw new Error(`Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`);
|
|
7
|
+
}
|
|
8
|
+
if (typeof q === 'undefined') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!Number.isFinite(q)) {
|
|
12
|
+
throw new RangeError(`Quality must be a finite number, but is ${q}`);
|
|
13
|
+
}
|
|
14
|
+
if (Number.isNaN(q)) {
|
|
15
|
+
throw new RangeError(`Quality is NaN, but must be a real number`);
|
|
16
|
+
}
|
|
17
|
+
if (q > 100 || q < 0) {
|
|
18
|
+
throw new RangeError('Quality option must be between 0 and 100.');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateQuality = validateQuality;
|
package/dist/render-media.js
CHANGED
|
@@ -74,6 +74,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
|
|
|
74
74
|
let encodedFrames = 0;
|
|
75
75
|
let muxedFrames = 0;
|
|
76
76
|
let renderedFrames = 0;
|
|
77
|
+
let totalFramesToRender = 0;
|
|
77
78
|
let renderedDoneIn = null;
|
|
78
79
|
let encodedDoneIn = null;
|
|
79
80
|
let cancelled = false;
|
|
@@ -133,6 +134,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
|
|
|
133
134
|
scale,
|
|
134
135
|
width: composition.width,
|
|
135
136
|
});
|
|
137
|
+
const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange);
|
|
136
138
|
const callUpdate = () => {
|
|
137
139
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
138
140
|
encodedDoneIn,
|
|
@@ -141,10 +143,9 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
|
|
|
141
143
|
renderedFrames,
|
|
142
144
|
stitchStage,
|
|
143
145
|
progress: Math.round((70 * renderedFrames + 15 * encodedFrames + 15 * muxedFrames) /
|
|
144
|
-
|
|
146
|
+
totalFramesToRender) / 100,
|
|
145
147
|
});
|
|
146
148
|
};
|
|
147
|
-
const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange);
|
|
148
149
|
const cancelRenderFrames = (0, make_cancel_signal_1.makeCancelSignal)();
|
|
149
150
|
const cancelPrestitcher = (0, make_cancel_signal_1.makeCancelSignal)();
|
|
150
151
|
const cancelStitcher = (0, make_cancel_signal_1.makeCancelSignal)();
|
|
@@ -247,6 +248,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
|
|
|
247
248
|
outputDir: parallelEncoding ? null : workingDir,
|
|
248
249
|
onStart: (data) => {
|
|
249
250
|
renderedFrames = 0;
|
|
251
|
+
totalFramesToRender = data.frameCount;
|
|
250
252
|
callUpdate();
|
|
251
253
|
onStart === null || onStart === void 0 ? void 0 : onStart(data);
|
|
252
254
|
},
|
|
@@ -328,6 +330,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputP
|
|
|
328
330
|
muxedFrames = frame;
|
|
329
331
|
}
|
|
330
332
|
else {
|
|
333
|
+
muxedFrames = frame;
|
|
331
334
|
encodedFrames = frame;
|
|
332
335
|
}
|
|
333
336
|
callUpdate();
|
|
@@ -114,9 +114,12 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
|
|
|
114
114
|
if (siteVersion !== requiredVersion) {
|
|
115
115
|
throw new Error([
|
|
116
116
|
`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error:`,
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
'
|
|
117
|
+
'When using server-side rendering:',
|
|
118
|
+
` ▸ Use 'bundle()' with '@remotion/bundler' of version ${version_1.VERSION} to create a compatible bundle.`,
|
|
119
|
+
'When using the Remotion Lambda:',
|
|
120
|
+
' ▸ Use `npx remotion lambda sites create` to redeploy the site with the latest version.',
|
|
121
|
+
' ℹ Use --site-name with the same name as before to overwrite your site.',
|
|
122
|
+
' ▸ Use `deploySite()` if you are using the Node.JS APIs.',
|
|
120
123
|
].join('\n'));
|
|
121
124
|
}
|
|
122
125
|
if (remotionVersion !== version_1.VERSION && process.env.NODE_ENV !== 'test') {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
2
|
+
import type { NeedsResize, SpecialVCodecForTransparency } from './assets/download-map';
|
|
3
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
4
|
+
export declare const tryToExtractFrameOfVideoFast: ({ ffmpegExecutable, remotionRoot, specialVCodecForTransparency, imageFormat, needsResize, src, actualOffset, }: {
|
|
5
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
6
|
+
remotionRoot: string;
|
|
7
|
+
imageFormat: OffthreadVideoImageFormat;
|
|
8
|
+
needsResize: NeedsResize;
|
|
9
|
+
src: string;
|
|
10
|
+
specialVCodecForTransparency: SpecialVCodecForTransparency;
|
|
11
|
+
actualOffset: string;
|
|
12
|
+
}) => Promise<readonly [string, Buffer]>;
|
|
@@ -0,0 +1,55 @@
|
|
|
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.tryToExtractFrameOfVideoFast = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const determine_resize_params_1 = require("./determine-resize-params");
|
|
9
|
+
const determine_vcodec_ffmpeg_flags_1 = require("./determine-vcodec-ffmpeg-flags");
|
|
10
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
11
|
+
const truthy_1 = require("./truthy");
|
|
12
|
+
const tryToExtractFrameOfVideoFast = async ({ ffmpegExecutable, remotionRoot, specialVCodecForTransparency, imageFormat, needsResize, src, actualOffset, }) => {
|
|
13
|
+
const { stdout, stderr } = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
14
|
+
'-ss',
|
|
15
|
+
actualOffset,
|
|
16
|
+
...(0, determine_vcodec_ffmpeg_flags_1.determineVcodecFfmpegFlags)(specialVCodecForTransparency),
|
|
17
|
+
'-i',
|
|
18
|
+
src,
|
|
19
|
+
'-frames:v',
|
|
20
|
+
'1',
|
|
21
|
+
'-c:v',
|
|
22
|
+
imageFormat === 'jpeg' ? 'mjpeg' : 'png',
|
|
23
|
+
'-f',
|
|
24
|
+
'image2pipe',
|
|
25
|
+
...(0, determine_resize_params_1.determineResizeParams)(needsResize),
|
|
26
|
+
'-',
|
|
27
|
+
].filter(truthy_1.truthy));
|
|
28
|
+
if (!stderr) {
|
|
29
|
+
throw new Error('unexpectedly did not get stderr');
|
|
30
|
+
}
|
|
31
|
+
if (!stdout) {
|
|
32
|
+
throw new Error('unexpectedly did not get stdout');
|
|
33
|
+
}
|
|
34
|
+
const stderrChunks = [];
|
|
35
|
+
const stdoutChunks = [];
|
|
36
|
+
const stdErrString = new Promise((resolve, reject) => {
|
|
37
|
+
stderr.on('data', (d) => stderrChunks.push(d));
|
|
38
|
+
stderr.on('error', (err) => reject(err));
|
|
39
|
+
stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf-8')));
|
|
40
|
+
});
|
|
41
|
+
const stdoutChunk = new Promise((resolve, reject) => {
|
|
42
|
+
stdout.on('data', (d) => {
|
|
43
|
+
stdoutChunks.push(d);
|
|
44
|
+
});
|
|
45
|
+
stdout.on('error', (err) => {
|
|
46
|
+
reject(err);
|
|
47
|
+
});
|
|
48
|
+
stdout.on('end', () => {
|
|
49
|
+
resolve(Buffer.concat(stdoutChunks));
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
|
|
53
|
+
return [stdErr, stdoutBuffer];
|
|
54
|
+
};
|
|
55
|
+
exports.tryToExtractFrameOfVideoFast = tryToExtractFrameOfVideoFast;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const customExecutableExists: (localExecutable: string) => boolean;
|
|
2
|
+
export declare const binaryExists: (name: 'ffmpeg' | 'ffprobe') => boolean;
|
|
3
|
+
export declare const checkAndValidateFfmpegVersion: (options: {
|
|
4
|
+
ffmpegExecutable: string | null;
|
|
5
|
+
remotionRoot: string;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
export declare const validateFfmpeg: (customFfmpegBinary: string | null, remotionRoot: string, binary: 'ffmpeg' | 'ffprobe') => Promise<void>;
|
|
@@ -0,0 +1,77 @@
|
|
|
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.validateFfmpeg = exports.checkAndValidateFfmpegVersion = exports.binaryExists = exports.customExecutableExists = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
11
|
+
const warn_about_ffmpeg_version_1 = require("./warn-about-ffmpeg-version");
|
|
12
|
+
const existsMap = {};
|
|
13
|
+
const customExecutableExists = (localExecutable) => {
|
|
14
|
+
try {
|
|
15
|
+
(0, fs_1.statSync)(localExecutable);
|
|
16
|
+
existsMap[localExecutable] = true;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
existsMap[localExecutable] = false;
|
|
20
|
+
}
|
|
21
|
+
return existsMap[localExecutable];
|
|
22
|
+
};
|
|
23
|
+
exports.customExecutableExists = customExecutableExists;
|
|
24
|
+
const binaryExists = (name) => {
|
|
25
|
+
if (typeof existsMap[name] !== 'undefined') {
|
|
26
|
+
return existsMap[name];
|
|
27
|
+
}
|
|
28
|
+
const isWin = os_1.default.platform() === 'win32';
|
|
29
|
+
const where = isWin ? 'where' : 'which';
|
|
30
|
+
try {
|
|
31
|
+
execa_1.default.sync(where, [name]);
|
|
32
|
+
existsMap[name] = true;
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
existsMap[name] = false;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.binaryExists = binaryExists;
|
|
41
|
+
const checkAndValidateFfmpegVersion = async (options) => {
|
|
42
|
+
const ffmpegVersion = await (0, ffmpeg_flags_1.getFfmpegVersion)({
|
|
43
|
+
ffmpegExecutable: options.ffmpegExecutable,
|
|
44
|
+
remotionRoot: options.remotionRoot,
|
|
45
|
+
});
|
|
46
|
+
const buildConf = await (0, ffmpeg_flags_1.getFfmpegBuildInfo)({
|
|
47
|
+
ffmpegExecutable: options.ffmpegExecutable,
|
|
48
|
+
remotionRoot: options.remotionRoot,
|
|
49
|
+
});
|
|
50
|
+
(0, warn_about_ffmpeg_version_1.warnAboutFfmpegVersion)({ ffmpegVersion, buildConf });
|
|
51
|
+
};
|
|
52
|
+
exports.checkAndValidateFfmpegVersion = checkAndValidateFfmpegVersion;
|
|
53
|
+
const validateFfmpeg = async (customFfmpegBinary, remotionRoot, binary) => {
|
|
54
|
+
const ffmpegExists = (0, exports.binaryExists)(binary);
|
|
55
|
+
if (ffmpegExists) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (customFfmpegBinary) {
|
|
59
|
+
if (!(0, exports.customExecutableExists)(customFfmpegBinary)) {
|
|
60
|
+
throw new Error('Custom FFmpeg executable not found: ' + customFfmpegBinary);
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (process.platform === 'linux' && (0, fs_1.existsSync)(ffmpeg_flags_1.lambdaFfmpegPaths[binary])) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if ((0, ffmpeg_flags_1.ffmpegInNodeModules)(remotionRoot, binary)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
|
|
71
|
+
if (binaryUrl) {
|
|
72
|
+
await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
|
|
73
|
+
return (0, exports.validateFfmpeg)(customFfmpegBinary, remotionRoot, binary);
|
|
74
|
+
}
|
|
75
|
+
throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
|
|
76
|
+
};
|
|
77
|
+
exports.validateFfmpeg = validateFfmpeg;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export type OpenGlRenderer = typeof
|
|
1
|
+
export declare const validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader"];
|
|
2
|
+
export type OpenGlRenderer = typeof validOpenGlRenderers[number];
|
|
3
3
|
export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
|
|
4
4
|
export declare const validateOpenGlRenderer: (option: OpenGlRenderer | null) => OpenGlRenderer | null;
|
|
5
|
-
export {};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOpenGlRenderer = exports.DEFAULT_OPENGL_RENDERER = void 0;
|
|
4
|
-
|
|
3
|
+
exports.validateOpenGlRenderer = exports.DEFAULT_OPENGL_RENDERER = exports.validOpenGlRenderers = void 0;
|
|
4
|
+
exports.validOpenGlRenderers = [
|
|
5
|
+
'swangle',
|
|
6
|
+
'angle',
|
|
7
|
+
'egl',
|
|
8
|
+
'swiftshader',
|
|
9
|
+
];
|
|
5
10
|
exports.DEFAULT_OPENGL_RENDERER = null;
|
|
6
11
|
const validateOpenGlRenderer = (option) => {
|
|
7
12
|
if (option === null) {
|
|
8
13
|
return null;
|
|
9
14
|
}
|
|
10
|
-
if (!
|
|
11
|
-
throw new TypeError(`${option} is not a valid GL backend. Accepted values: ${
|
|
15
|
+
if (!exports.validOpenGlRenderers.includes(option)) {
|
|
16
|
+
throw new TypeError(`${option} is not a valid GL backend. Accepted values: ${exports.validOpenGlRenderers.join(', ')}`);
|
|
12
17
|
}
|
|
13
18
|
return option;
|
|
14
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AudioCodec } from './audio-codec';
|
|
2
|
-
export declare const validateOutputFilename: <T extends "
|
|
2
|
+
export declare const validateOutputFilename: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
|
|
3
3
|
codec: T;
|
|
4
4
|
audioCodec: AudioCodec | null;
|
|
5
5
|
extension: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.warnAboutFfmpegVersion = void 0;
|
|
4
|
+
const printMessage = (ffmpegVersion) => {
|
|
5
|
+
console.warn('⚠️Old FFMPEG version detected: ' + ffmpegVersion.join('.'));
|
|
6
|
+
console.warn(' For audio support, you need at least version 4.1.0.');
|
|
7
|
+
console.warn(' Upgrade FFMPEG to get rid of this warning.');
|
|
8
|
+
};
|
|
9
|
+
const printBuildConfMessage = () => {
|
|
10
|
+
console.error('⚠️ Unsupported FFMPEG version detected.');
|
|
11
|
+
console.error(" Your version doesn't support the -buildconf flag");
|
|
12
|
+
console.error(' Audio will not be supported and you may experience other issues.');
|
|
13
|
+
console.error(' Upgrade FFMPEG to at least v4.1.0 to get rid of this warning.');
|
|
14
|
+
};
|
|
15
|
+
const warnAboutFfmpegVersion = ({ ffmpegVersion, buildConf, }) => {
|
|
16
|
+
if (buildConf === null) {
|
|
17
|
+
printBuildConfMessage();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (ffmpegVersion === null) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const [major, minor] = ffmpegVersion;
|
|
24
|
+
// 3.x and below definitely is too old
|
|
25
|
+
if (major < 4) {
|
|
26
|
+
printMessage(ffmpegVersion);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// 5.x will be all good
|
|
30
|
+
if (major > 4) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (minor < 1) {
|
|
34
|
+
printMessage(ffmpegVersion);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.warnAboutFfmpegVersion = warnAboutFfmpegVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.18",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.7.0",
|
|
21
|
-
"remotion": "4.0.
|
|
21
|
+
"remotion": "4.0.18"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -37,18 +37,17 @@
|
|
|
37
37
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
38
38
|
"react": "18.0.0",
|
|
39
39
|
"react-dom": "18.0.0",
|
|
40
|
-
"typescript": "4.9.5",
|
|
41
40
|
"vitest": "0.31.1",
|
|
42
41
|
"zod": "^3.21.4"
|
|
43
42
|
},
|
|
44
43
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-darwin-
|
|
46
|
-
"@remotion/compositor-
|
|
47
|
-
"@remotion/compositor-
|
|
48
|
-
"@remotion/compositor-linux-arm64-musl": "4.0.
|
|
49
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.
|
|
50
|
-
"@remotion/compositor-linux-x64-musl": "4.0.
|
|
51
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
44
|
+
"@remotion/compositor-darwin-arm64": "4.0.18",
|
|
45
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.18",
|
|
46
|
+
"@remotion/compositor-darwin-x64": "4.0.18",
|
|
47
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.18",
|
|
48
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.18",
|
|
49
|
+
"@remotion/compositor-linux-x64-musl": "4.0.18",
|
|
50
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.18"
|
|
52
51
|
},
|
|
53
52
|
"keywords": [
|
|
54
53
|
"remotion",
|