@remotion/renderer 4.0.0-alpha14 → 4.0.0-alpha16
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/compositor/compositor.js +18 -6
- package/dist/create-ffmpeg-complex-filter.d.ts +1 -4
- package/dist/index.d.ts +6 -5
- package/dist/logger.d.ts +1 -1
- package/dist/provide-screenshot.d.ts +1 -0
- package/dist/puppeteer-screenshot.d.ts +1 -0
- package/dist/screenshot-dom-element.d.ts +1 -0
- package/dist/screenshot-task.d.ts +1 -0
- package/dist/stitch-frames-to-video.d.ts +1 -0
- package/dist/take-frame-and-compose.d.ts +1 -0
- package/package.json +9 -9
- package/dist/assets/get-video-stream-duration.d.ts +0 -9
- package/dist/assets/get-video-stream-duration.js +0 -71
- package/dist/calculate-sar-dar-pixels.d.ts +0 -9
- package/dist/calculate-sar-dar-pixels.js +0 -19
- package/dist/determine-resize-params.d.ts +0 -1
- package/dist/determine-resize-params.js +0 -10
- package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
- package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
- package/dist/ensure-ffmpeg.d.ts +0 -18
- package/dist/ensure-ffmpeg.js +0 -58
- package/dist/ensure-presentation-timestamp.d.ts +0 -15
- package/dist/ensure-presentation-timestamp.js +0 -88
- package/dist/extract-frame-from-video.d.ts +0 -16
- package/dist/extract-frame-from-video.js +0 -191
- package/dist/ffmpeg-executable.d.ts +0 -1
- package/dist/ffmpeg-executable.js +0 -2
- package/dist/ffmpeg-flags.d.ts +0 -31
- package/dist/ffmpeg-flags.js +0 -245
- package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
- package/dist/frame-to-ffmpeg-timestamp.js +0 -8
- package/dist/get-can-extract-frames-fast.d.ts +0 -14
- package/dist/get-can-extract-frames-fast.js +0 -71
- package/dist/get-frame-of-video-slow.d.ts +0 -17
- package/dist/get-frame-of-video-slow.js +0 -72
- package/dist/get-video-info.d.ts +0 -8
- package/dist/get-video-info.js +0 -59
- package/dist/is-beyond-last-frame.d.ts +0 -3
- package/dist/is-beyond-last-frame.js +0 -12
- package/dist/last-frame-from-video-cache.d.ts +0 -17
- package/dist/last-frame-from-video-cache.js +0 -55
- package/dist/legacy-webpack-config.d.ts +0 -9
- package/dist/legacy-webpack-config.js +0 -13
- package/dist/quality.d.ts +0 -1
- package/dist/quality.js +0 -21
- package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -12
- package/dist/try-to-extract-frame-of-video-fast.js +0 -55
- package/dist/validate-ffmpeg.d.ts +0 -7
- package/dist/validate-ffmpeg.js +0 -77
- package/dist/warn-about-ffmpeg-version.d.ts +0 -5
- package/dist/warn-about-ffmpeg-version.js +0 -37
|
@@ -63,7 +63,7 @@ const startCompositor = (type, payload, indent) => {
|
|
|
63
63
|
waiters.delete(nonce);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
let
|
|
66
|
+
let runningStatus = { type: 'running' };
|
|
67
67
|
let missingData = null;
|
|
68
68
|
const processInput = () => {
|
|
69
69
|
let separatorIndex = outputBuffer.indexOf(separator);
|
|
@@ -145,9 +145,9 @@ const startCompositor = (type, payload, indent) => {
|
|
|
145
145
|
let resolve = null;
|
|
146
146
|
let reject = null;
|
|
147
147
|
child.on('close', (code) => {
|
|
148
|
-
quit = true;
|
|
149
148
|
const waitersToKill = Array.from(waiters.values());
|
|
150
149
|
if (code === 0) {
|
|
150
|
+
runningStatus = { type: 'quit-without-error' };
|
|
151
151
|
resolve === null || resolve === void 0 ? void 0 : resolve();
|
|
152
152
|
for (const waiter of waitersToKill) {
|
|
153
153
|
waiter.reject(new Error(`Compositor already quit`));
|
|
@@ -155,7 +155,9 @@ const startCompositor = (type, payload, indent) => {
|
|
|
155
155
|
waiters.clear();
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
|
-
const
|
|
158
|
+
const errorMessage = Buffer.concat(stderrChunks).toString('utf-8');
|
|
159
|
+
runningStatus = { type: 'quit-with-error', error: errorMessage };
|
|
160
|
+
const error = new Error(`Compositor panicked: ${errorMessage}`);
|
|
159
161
|
for (const waiter of waitersToKill) {
|
|
160
162
|
waiter.reject(error);
|
|
161
163
|
}
|
|
@@ -166,24 +168,34 @@ const startCompositor = (type, payload, indent) => {
|
|
|
166
168
|
return {
|
|
167
169
|
waitForDone: () => {
|
|
168
170
|
return new Promise((res, rej) => {
|
|
169
|
-
if (quit) {
|
|
171
|
+
if (runningStatus.type === 'quit-without-error') {
|
|
170
172
|
rej(new Error('Compositor already quit'));
|
|
171
173
|
return;
|
|
172
174
|
}
|
|
175
|
+
if (runningStatus.type === 'quit-with-error') {
|
|
176
|
+
rej(new Error(`Compositor already quit: ${runningStatus.error}`));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
173
179
|
resolve = res;
|
|
174
180
|
reject = rej;
|
|
175
181
|
});
|
|
176
182
|
},
|
|
177
183
|
finishCommands: () => {
|
|
178
|
-
if (quit) {
|
|
184
|
+
if (runningStatus.type === 'quit-with-error') {
|
|
185
|
+
throw new Error(`Compositor already quit: ${runningStatus.error}`);
|
|
186
|
+
}
|
|
187
|
+
if (runningStatus.type === 'quit-without-error') {
|
|
179
188
|
throw new Error('Compositor already quit');
|
|
180
189
|
}
|
|
181
190
|
child.stdin.write('EOF\n');
|
|
182
191
|
},
|
|
183
192
|
executeCommand: (command, params) => {
|
|
184
|
-
if (quit) {
|
|
193
|
+
if (runningStatus.type === 'quit-without-error') {
|
|
185
194
|
throw new Error('Compositor already quit');
|
|
186
195
|
}
|
|
196
|
+
if (runningStatus.type === 'quit-with-error') {
|
|
197
|
+
throw new Error(`Compositor quit: ${runningStatus.error}`);
|
|
198
|
+
}
|
|
187
199
|
return new Promise((_resolve, _reject) => {
|
|
188
200
|
const nonce = (0, make_nonce_1.makeNonce)();
|
|
189
201
|
const composed = {
|
|
@@ -4,9 +4,6 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
|
|
|
4
4
|
filters: PreprocessedAudioTrack[];
|
|
5
5
|
downloadMap: DownloadMap;
|
|
6
6
|
}) => Promise<{
|
|
7
|
-
complexFilterFlag: [
|
|
8
|
-
string,
|
|
9
|
-
string
|
|
10
|
-
] | null;
|
|
7
|
+
complexFilterFlag: [string, string] | null;
|
|
11
8
|
cleanup: () => void;
|
|
12
9
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import execa from 'execa';
|
|
2
3
|
import { HeadlessBrowser } from './browser/Browser';
|
|
3
4
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
@@ -113,8 +114,8 @@ export declare const RenderInternals: {
|
|
|
113
114
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
114
115
|
DEFAULT_BROWSER: import("./browser").Browser;
|
|
115
116
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
116
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
117
|
-
validateOpenGlRenderer: (option: "
|
|
117
|
+
DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
|
|
118
|
+
validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
|
|
118
119
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
119
120
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
120
121
|
validateJpegQuality: (q: number | undefined) => void;
|
|
@@ -299,8 +300,8 @@ export declare const RenderInternals: {
|
|
|
299
300
|
};
|
|
300
301
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
301
302
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
302
|
-
DEFAULT_STILL_IMAGE_FORMAT: "
|
|
303
|
-
DEFAULT_VIDEO_IMAGE_FORMAT: "
|
|
303
|
+
DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
|
|
304
|
+
DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
|
|
304
305
|
DEFAULT_JPEG_QUALITY: number;
|
|
305
306
|
chalk: {
|
|
306
307
|
enabled: boolean;
|
|
@@ -404,7 +405,7 @@ export declare const RenderInternals: {
|
|
|
404
405
|
output: string | null;
|
|
405
406
|
frame: number;
|
|
406
407
|
inputProps: Record<string, unknown>;
|
|
407
|
-
imageFormat: "
|
|
408
|
+
imageFormat: "jpeg" | "png" | "webp" | "pdf";
|
|
408
409
|
jpegQuality: number;
|
|
409
410
|
puppeteerInstance: HeadlessBrowser | null;
|
|
410
411
|
dumpBrowserLogs: boolean;
|
package/dist/logger.d.ts
CHANGED
|
@@ -19,6 +19,6 @@ export declare const Log: {
|
|
|
19
19
|
warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
|
|
20
20
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
21
21
|
};
|
|
22
|
-
export declare const getLogLevel: () => "
|
|
22
|
+
export declare const getLogLevel: () => "verbose" | "error" | "info" | "warn";
|
|
23
23
|
export declare const setLogLevel: (newLogLevel: LogLevel) => void;
|
|
24
24
|
export {};
|
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-alpha16",
|
|
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.0-
|
|
21
|
+
"remotion": "4.0.0-alpha16"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-
|
|
46
|
-
"@remotion/compositor-
|
|
47
|
-
"@remotion/compositor-linux-
|
|
48
|
-
"@remotion/compositor-darwin-
|
|
49
|
-
"@remotion/compositor-
|
|
50
|
-
"@remotion/compositor-linux-x64-
|
|
51
|
-
"@remotion/compositor-
|
|
45
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha16",
|
|
46
|
+
"@remotion/compositor-darwin-arm64": "4.0.0-alpha16",
|
|
47
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.0-alpha16",
|
|
48
|
+
"@remotion/compositor-darwin-x64": "4.0.0-alpha16",
|
|
49
|
+
"@remotion/compositor-linux-x64-musl": "4.0.0-alpha16",
|
|
50
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.0-alpha16",
|
|
51
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.0-alpha16"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"remotion",
|
|
@@ -1,9 +0,0 @@
|
|
|
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>;
|
|
@@ -1,71 +0,0 @@
|
|
|
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;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// https://superuser.com/questions/907933/correct-aspect-ratio-without-re-encoding-video-file
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.calculateDisplayVideoSize = void 0;
|
|
5
|
-
const calculateDisplayVideoSize = ({ darX, darY, x, y, }) => {
|
|
6
|
-
// We know two equations:
|
|
7
|
-
// newWidth / newHeight = darX / darY
|
|
8
|
-
// and:
|
|
9
|
-
// x * y = (newWidth * newHeight)
|
|
10
|
-
// I solved it then on pen and paper and simplified the formula:
|
|
11
|
-
const dimensions = x * y;
|
|
12
|
-
const newWidth = Math.sqrt(dimensions * (darX / darY));
|
|
13
|
-
const newHeight = dimensions / newWidth;
|
|
14
|
-
return {
|
|
15
|
-
height: Math.round(newHeight),
|
|
16
|
-
width: Math.round(newWidth),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.calculateDisplayVideoSize = calculateDisplayVideoSize;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const determineResizeParams: (needsResize: [number, number] | null) => string[];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determineResizeParams = void 0;
|
|
4
|
-
const determineResizeParams = (needsResize) => {
|
|
5
|
-
if (needsResize === null) {
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
8
|
-
return ['-s', `${needsResize[0]}x${needsResize[1]}`];
|
|
9
|
-
};
|
|
10
|
-
exports.determineResizeParams = determineResizeParams;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determineVcodecFfmpegFlags = void 0;
|
|
4
|
-
const truthy_1 = require("./truthy");
|
|
5
|
-
const determineVcodecFfmpegFlags = (vcodecFlag) => {
|
|
6
|
-
return [
|
|
7
|
-
vcodecFlag === 'vp9' ? '-vcodec' : null,
|
|
8
|
-
vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
|
|
9
|
-
vcodecFlag === 'vp8' ? '-vcodec' : null,
|
|
10
|
-
vcodecFlag === 'vp8' ? 'libvpx' : null,
|
|
11
|
-
].filter(truthy_1.truthy);
|
|
12
|
-
};
|
|
13
|
-
exports.determineVcodecFfmpegFlags = determineVcodecFfmpegFlags;
|
package/dist/ensure-ffmpeg.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare type EnsureFfmpegOptions = {
|
|
2
|
-
remotionRoot?: string;
|
|
3
|
-
};
|
|
4
|
-
declare type Result = {
|
|
5
|
-
result: 'found-in-path' | 'found-in-node-modules' | 'installed';
|
|
6
|
-
wasAlreadyInstalled: boolean;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
|
|
10
|
-
* @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
|
|
11
|
-
*/
|
|
12
|
-
export declare const ensureFfmpeg: (options?: EnsureFfmpegOptions) => Promise<Result>;
|
|
13
|
-
/**
|
|
14
|
-
* @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
|
|
15
|
-
* @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
|
|
16
|
-
*/
|
|
17
|
-
export declare const ensureFfprobe: (options?: EnsureFfmpegOptions) => Promise<Result>;
|
|
18
|
-
export {};
|
package/dist/ensure-ffmpeg.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ensureFfprobe = exports.ensureFfmpeg = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const os_1 = __importDefault(require("os"));
|
|
9
|
-
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
10
|
-
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
11
|
-
const ensureFfmpegOrFfprobe = async (binary, options) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const exists = (0, validate_ffmpeg_1.binaryExists)(binary);
|
|
14
|
-
const remotionRoot = (_a = options === null || options === void 0 ? void 0 : options.remotionRoot) !== null && _a !== void 0 ? _a : process.cwd();
|
|
15
|
-
if (exists) {
|
|
16
|
-
return {
|
|
17
|
-
wasAlreadyInstalled: true,
|
|
18
|
-
result: 'found-in-path',
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
if (process.platform === 'linux' && (0, fs_1.existsSync)(ffmpeg_flags_1.lambdaFfmpegPaths[binary])) {
|
|
22
|
-
return {
|
|
23
|
-
wasAlreadyInstalled: true,
|
|
24
|
-
result: 'found-in-path',
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
if ((0, ffmpeg_flags_1.ffmpegInNodeModules)(remotionRoot, binary)) {
|
|
28
|
-
return {
|
|
29
|
-
result: 'found-in-node-modules',
|
|
30
|
-
wasAlreadyInstalled: true,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
|
|
34
|
-
if (binaryUrl) {
|
|
35
|
-
await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
|
|
36
|
-
return {
|
|
37
|
-
result: 'installed',
|
|
38
|
-
wasAlreadyInstalled: false,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
|
|
45
|
-
* @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
|
|
46
|
-
*/
|
|
47
|
-
const ensureFfmpeg = (options) => {
|
|
48
|
-
return ensureFfmpegOrFfprobe('ffmpeg', options);
|
|
49
|
-
};
|
|
50
|
-
exports.ensureFfmpeg = ensureFfmpeg;
|
|
51
|
-
/**
|
|
52
|
-
* @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
|
|
53
|
-
* @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
|
|
54
|
-
*/
|
|
55
|
-
const ensureFfprobe = (options) => {
|
|
56
|
-
return ensureFfmpegOrFfprobe('ffprobe', options);
|
|
57
|
-
};
|
|
58
|
-
exports.ensureFfprobe = ensureFfprobe;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { DownloadMap } from './assets/download-map';
|
|
2
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
|
-
export declare const ensurePresentationTimestampWithoutCache: ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
|
|
4
|
-
src: string;
|
|
5
|
-
remotionRoot: string;
|
|
6
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
7
|
-
ffprobeExecutable: FfmpegExecutable;
|
|
8
|
-
}) => Promise<string>;
|
|
9
|
-
export declare const ensurePresentationTimestamps: ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
|
|
10
|
-
downloadMap: DownloadMap;
|
|
11
|
-
src: string;
|
|
12
|
-
remotionRoot: string;
|
|
13
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
14
|
-
ffprobeExecutable: FfmpegExecutable;
|
|
15
|
-
}) => Promise<string>;
|
|
@@ -1,88 +0,0 @@
|
|
|
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 = exports.ensurePresentationTimestampWithoutCache = void 0;
|
|
7
|
-
const execa_1 = __importDefault(require("execa"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
10
|
-
const guess_extension_for_media_1 = require("./guess-extension-for-media");
|
|
11
|
-
const truthy_1 = require("./truthy");
|
|
12
|
-
let callbacks = [];
|
|
13
|
-
const getTemporaryOutputName = async ({ src, remotionRoot, ffprobeBinary, }) => {
|
|
14
|
-
const parts = src.split(path_1.default.sep);
|
|
15
|
-
// If there is no file extension for the video, then we need to temporarily add an extension
|
|
16
|
-
const lastPart = parts[parts.length - 1];
|
|
17
|
-
const extraExtension = lastPart.includes('.')
|
|
18
|
-
? null
|
|
19
|
-
: await (0, guess_extension_for_media_1.guessExtensionForVideo)({
|
|
20
|
-
src,
|
|
21
|
-
remotionRoot,
|
|
22
|
-
ffprobeBinary,
|
|
23
|
-
});
|
|
24
|
-
return parts
|
|
25
|
-
.map((p, i) => {
|
|
26
|
-
if (i === parts.length - 1) {
|
|
27
|
-
return [`pts-${p}`, extraExtension].filter(truthy_1.truthy).join('.');
|
|
28
|
-
}
|
|
29
|
-
return p;
|
|
30
|
-
})
|
|
31
|
-
.join(path_1.default.sep);
|
|
32
|
-
};
|
|
33
|
-
const ensurePresentationTimestampWithoutCache = async ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
|
|
34
|
-
// If there is no file extension for the video, then we need to tempoa
|
|
35
|
-
const output = await getTemporaryOutputName({
|
|
36
|
-
src,
|
|
37
|
-
remotionRoot,
|
|
38
|
-
ffprobeBinary: ffprobeExecutable,
|
|
39
|
-
});
|
|
40
|
-
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
41
|
-
'-i',
|
|
42
|
-
src,
|
|
43
|
-
'-fflags',
|
|
44
|
-
'+genpts+igndts',
|
|
45
|
-
'-vcodec',
|
|
46
|
-
'copy',
|
|
47
|
-
'-acodec',
|
|
48
|
-
'copy',
|
|
49
|
-
output,
|
|
50
|
-
'-y',
|
|
51
|
-
]);
|
|
52
|
-
return output;
|
|
53
|
-
};
|
|
54
|
-
exports.ensurePresentationTimestampWithoutCache = ensurePresentationTimestampWithoutCache;
|
|
55
|
-
const ensurePresentationTimestamps = async ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
|
|
56
|
-
const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
|
|
57
|
-
if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
|
|
58
|
-
return new Promise((resolve) => {
|
|
59
|
-
callbacks.push({
|
|
60
|
-
src,
|
|
61
|
-
fn: (newSrc) => resolve(newSrc),
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'done') {
|
|
66
|
-
return elem.src;
|
|
67
|
-
}
|
|
68
|
-
downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
|
|
69
|
-
const output = await (0, exports.ensurePresentationTimestampWithoutCache)({
|
|
70
|
-
ffmpegExecutable,
|
|
71
|
-
ffprobeExecutable,
|
|
72
|
-
remotionRoot,
|
|
73
|
-
src,
|
|
74
|
-
});
|
|
75
|
-
callbacks = callbacks.filter((c) => {
|
|
76
|
-
if (c.src === src) {
|
|
77
|
-
c.fn(output);
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
});
|
|
82
|
-
downloadMap.ensureFileHasPresentationTimestamp[src] = {
|
|
83
|
-
type: 'done',
|
|
84
|
-
src: output,
|
|
85
|
-
};
|
|
86
|
-
return output;
|
|
87
|
-
};
|
|
88
|
-
exports.ensurePresentationTimestamps = ensurePresentationTimestamps;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
2
|
-
import type { DownloadMap } from './assets/download-map';
|
|
3
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
4
|
-
import type { LastFrameOptions } from './last-frame-from-video-cache';
|
|
5
|
-
export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
|
|
6
|
-
declare type Options = {
|
|
7
|
-
time: number;
|
|
8
|
-
src: string;
|
|
9
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
10
|
-
ffprobeExecutable: FfmpegExecutable;
|
|
11
|
-
imageFormat: OffthreadVideoImageFormat;
|
|
12
|
-
downloadMap: DownloadMap;
|
|
13
|
-
remotionRoot: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
|
|
16
|
-
export {};
|