@remotion/renderer 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/download-file.d.ts +6 -4
- package/dist/assets/download-file.js +44 -5
- package/dist/browser/Browser.js +0 -1
- package/dist/extract-frame-from-video.d.ts +1 -0
- package/dist/ffmpeg-flags.js +1 -1
- package/dist/guess-extension-for-media.d.ts +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/last-frame-from-video-cache.d.ts +1 -0
- package/dist/provide-screenshot.d.ts +1 -0
- package/dist/puppeteer-screenshot.d.ts +1 -0
- package/dist/render-media.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.js +28 -4
- package/dist/validate-ffmpeg.js +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
declare type Response = {
|
|
2
|
+
sizeInBytes: number;
|
|
3
|
+
to: string;
|
|
4
|
+
};
|
|
1
5
|
export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
|
|
2
6
|
url: string;
|
|
3
7
|
to: (contentDisposition: string | null, contentType: string | null) => string;
|
|
@@ -6,7 +10,5 @@ export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
|
|
|
6
10
|
downloaded: number;
|
|
7
11
|
totalSize: number | null;
|
|
8
12
|
}) => void) | undefined;
|
|
9
|
-
}) => Promise<
|
|
10
|
-
|
|
11
|
-
to: string;
|
|
12
|
-
}>;
|
|
13
|
+
}) => Promise<Response>;
|
|
14
|
+
export {};
|
|
@@ -6,6 +6,35 @@ const ensure_output_directory_1 = require("../ensure-output-directory");
|
|
|
6
6
|
const read_file_1 = require("./read-file");
|
|
7
7
|
const downloadFile = ({ onProgress, url, to: toFn, }) => {
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
9
|
+
let rejected = false;
|
|
10
|
+
let resolved = false;
|
|
11
|
+
let timeout;
|
|
12
|
+
const resolveAndFlag = (val) => {
|
|
13
|
+
resolved = true;
|
|
14
|
+
resolve(val);
|
|
15
|
+
if (timeout) {
|
|
16
|
+
clearTimeout(timeout);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const rejectAndFlag = (err) => {
|
|
20
|
+
if (timeout) {
|
|
21
|
+
clearTimeout(timeout);
|
|
22
|
+
}
|
|
23
|
+
reject(err);
|
|
24
|
+
rejected = true;
|
|
25
|
+
};
|
|
26
|
+
const refreshTimeout = () => {
|
|
27
|
+
if (timeout) {
|
|
28
|
+
clearTimeout(timeout);
|
|
29
|
+
}
|
|
30
|
+
timeout = setTimeout(() => {
|
|
31
|
+
if (resolved) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
rejectAndFlag(new Error(`Tried to download file ${url}, but the server sent no data for 20 seconds`));
|
|
35
|
+
}, 20000);
|
|
36
|
+
};
|
|
37
|
+
refreshTimeout();
|
|
9
38
|
(0, read_file_1.readFile)(url)
|
|
10
39
|
.then((res) => {
|
|
11
40
|
var _a, _b;
|
|
@@ -21,16 +50,20 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
|
|
|
21
50
|
// concise method to avoid this problem
|
|
22
51
|
// https://github.com/remotion-dev/remotion/issues/384#issuecomment-844398183
|
|
23
52
|
writeStream.on('close', () => {
|
|
53
|
+
if (rejected) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
24
56
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
25
57
|
downloaded,
|
|
26
58
|
percent: 1,
|
|
27
59
|
totalSize: downloaded,
|
|
28
60
|
});
|
|
29
|
-
|
|
61
|
+
refreshTimeout();
|
|
62
|
+
return resolveAndFlag({ sizeInBytes: downloaded, to });
|
|
30
63
|
});
|
|
31
|
-
writeStream.on('error', (err) =>
|
|
32
|
-
res.on('error', (err) =>
|
|
33
|
-
res.pipe(writeStream).on('error', (err) =>
|
|
64
|
+
writeStream.on('error', (err) => rejectAndFlag(err));
|
|
65
|
+
res.on('error', (err) => rejectAndFlag(err));
|
|
66
|
+
res.pipe(writeStream).on('error', (err) => rejectAndFlag(err));
|
|
34
67
|
res.on('data', (d) => {
|
|
35
68
|
downloaded += d.length;
|
|
36
69
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
@@ -39,9 +72,15 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
|
|
|
39
72
|
totalSize,
|
|
40
73
|
});
|
|
41
74
|
});
|
|
75
|
+
res.on('close', () => {
|
|
76
|
+
if (totalSize !== null && downloaded !== totalSize) {
|
|
77
|
+
rejectAndFlag(new Error(`Download finished with ${downloaded} bytes, but expected ${totalSize} bytes from 'Content-Length'.`));
|
|
78
|
+
}
|
|
79
|
+
writeStream.close();
|
|
80
|
+
});
|
|
42
81
|
})
|
|
43
82
|
.catch((err) => {
|
|
44
|
-
|
|
83
|
+
rejectAndFlag(err);
|
|
45
84
|
});
|
|
46
85
|
});
|
|
47
86
|
};
|
package/dist/browser/Browser.js
CHANGED
|
@@ -135,7 +135,6 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
135
135
|
async close(silent) {
|
|
136
136
|
await __classPrivateFieldGet(this, _Browser_closeCallback, "f").call(null);
|
|
137
137
|
(await this.pages()).forEach((page) => {
|
|
138
|
-
console.log('disposing', page.id);
|
|
139
138
|
page.emit("disposed" /* PageEmittedEvents.Disposed */);
|
|
140
139
|
page.closed = true;
|
|
141
140
|
});
|
package/dist/ffmpeg-flags.js
CHANGED
|
@@ -105,7 +105,7 @@ const waitForFfmpegToBeDownloaded = (url) => {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
const onProgress = (downloadedBytes, totalBytesToDownload, binary) => {
|
|
108
|
-
console.log('Downloading ',
|
|
108
|
+
console.log('Downloading ', binary, `${toMegabytes(downloadedBytes)}/${toMegabytes(totalBytesToDownload)}`);
|
|
109
109
|
};
|
|
110
110
|
const downloadBinary = async (remotionRoot, url, binary) => {
|
|
111
111
|
const destinationPath = getFfmpegAbsolutePath(remotionRoot, binary);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import execa from 'execa';
|
|
3
2
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
4
3
|
import { mimeContentType, mimeLookup } from './mime-types';
|
|
@@ -114,8 +113,8 @@ export declare const RenderInternals: {
|
|
|
114
113
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
115
114
|
DEFAULT_BROWSER: import("./browser").Browser;
|
|
116
115
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
117
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
118
|
-
validateOpenGlRenderer: (option: "
|
|
116
|
+
DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
117
|
+
validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
119
118
|
validImageFormats: readonly ["png", "jpeg", "none"];
|
|
120
119
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
121
120
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
package/dist/render-media.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
7
30
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
-
const fs_1 =
|
|
9
|
-
const promises_1 = require("fs/promises");
|
|
31
|
+
const fs_1 = __importStar(require("fs"));
|
|
10
32
|
const path_1 = __importDefault(require("path"));
|
|
11
33
|
const remotion_1 = require("remotion");
|
|
12
34
|
const calculate_asset_positions_1 = require("./assets/calculate-asset-positions");
|
|
@@ -182,7 +204,8 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
182
204
|
}
|
|
183
205
|
const file = await new Promise((resolve, reject) => {
|
|
184
206
|
if (tempFile) {
|
|
185
|
-
|
|
207
|
+
fs_1.promises
|
|
208
|
+
.readFile(tempFile)
|
|
186
209
|
.then((f) => {
|
|
187
210
|
return resolve(f);
|
|
188
211
|
})
|
|
@@ -295,7 +318,8 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
295
318
|
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
296
319
|
return null;
|
|
297
320
|
}
|
|
298
|
-
return
|
|
321
|
+
return fs_1.promises
|
|
322
|
+
.readFile(tempFile)
|
|
299
323
|
.then((file) => {
|
|
300
324
|
return Promise.all([
|
|
301
325
|
file,
|
package/dist/validate-ffmpeg.js
CHANGED
|
@@ -69,7 +69,7 @@ const validateFfmpeg = async (customFfmpegBinary, remotionRoot, binary) => {
|
|
|
69
69
|
}
|
|
70
70
|
const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
|
|
71
71
|
if (binaryUrl) {
|
|
72
|
-
await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url,
|
|
72
|
+
await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
|
|
73
73
|
return (0, exports.validateFfmpeg)(customFfmpegBinary, remotionRoot, binary);
|
|
74
74
|
}
|
|
75
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.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"execa": "5.1.1",
|
|
24
24
|
"extract-zip": "2.0.1",
|
|
25
|
-
"remotion": "3.3.
|
|
25
|
+
"remotion": "3.3.1",
|
|
26
26
|
"source-map": "^0.8.0-beta.0",
|
|
27
27
|
"ws": "8.7.0"
|
|
28
28
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f56a29f8ab19e279e1a9950d3a3ccbb3c8ae42e0"
|
|
61
61
|
}
|