@remotion/renderer 4.0.0-offthread.6 → 4.0.0-offthread.7
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/extract-frame-from-video.js +20 -3
- package/dist/is-beyond-last-frame.d.ts +2 -0
- package/dist/is-beyond-last-frame.js +12 -0
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/provide-screenshot.js +1 -1
- package/dist/render-frames.js +2 -0
- package/dist/render-media.js +2 -0
- package/package.json +3 -3
|
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.extractFrameFromVideo = exports.extractFrameFromVideoFn = exports.streamToString = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const remotion_1 = require("remotion");
|
|
8
9
|
const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
|
|
10
|
+
const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
|
|
9
11
|
const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
|
|
10
12
|
const p_limit_1 = require("./p-limit");
|
|
11
13
|
function streamToString(stream) {
|
|
@@ -64,7 +66,11 @@ const getLastFrameOfVideoUnlimited = async ({ ffmpegExecutable, offset, src, })
|
|
|
64
66
|
const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
|
|
65
67
|
const isEmpty = stdErr.includes('Output file is empty');
|
|
66
68
|
if (isEmpty) {
|
|
67
|
-
return
|
|
69
|
+
return getLastFrameOfVideoUnlimited({
|
|
70
|
+
ffmpegExecutable,
|
|
71
|
+
offset: offset + 10,
|
|
72
|
+
src,
|
|
73
|
+
});
|
|
68
74
|
}
|
|
69
75
|
return stdoutBuffer;
|
|
70
76
|
};
|
|
@@ -78,6 +84,13 @@ const getLastFrameOfVideo = async (options) => {
|
|
|
78
84
|
return result;
|
|
79
85
|
};
|
|
80
86
|
const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, }) => {
|
|
87
|
+
if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(src, time)) {
|
|
88
|
+
return getLastFrameOfVideo({
|
|
89
|
+
ffmpegExecutable,
|
|
90
|
+
offset: 0,
|
|
91
|
+
src,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
81
94
|
const ffmpegTimestamp = (0, frame_to_ffmpeg_timestamp_1.frameToFfmpegTimestamp)(time);
|
|
82
95
|
const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
|
|
83
96
|
'-ss',
|
|
@@ -127,6 +140,7 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, }) => {
|
|
|
127
140
|
stdoutBuffer,
|
|
128
141
|
]);
|
|
129
142
|
if (stderrStr.includes('Output file is empty')) {
|
|
143
|
+
(0, is_beyond_last_frame_1.markAsBeyondLastFrame)(src, time);
|
|
130
144
|
return getLastFrameOfVideo({
|
|
131
145
|
ffmpegExecutable,
|
|
132
146
|
offset: 0,
|
|
@@ -136,7 +150,10 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, }) => {
|
|
|
136
150
|
return stdOut;
|
|
137
151
|
};
|
|
138
152
|
exports.extractFrameFromVideoFn = extractFrameFromVideoFn;
|
|
139
|
-
const extractFrameFromVideo = (options) => {
|
|
140
|
-
|
|
153
|
+
const extractFrameFromVideo = async (options) => {
|
|
154
|
+
const perf = remotion_1.Internals.perf.startPerfMeasure('extract-frame');
|
|
155
|
+
const res = await mainLimit(exports.extractFrameFromVideoFn, options);
|
|
156
|
+
remotion_1.Internals.perf.stopPerfMeasure(perf);
|
|
157
|
+
return res;
|
|
141
158
|
};
|
|
142
159
|
exports.extractFrameFromVideo = extractFrameFromVideo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markAsBeyondLastFrame = exports.isBeyondLastFrame = void 0;
|
|
4
|
+
const map = {};
|
|
5
|
+
const isBeyondLastFrame = (src, time) => {
|
|
6
|
+
return map[src] && time >= map[src];
|
|
7
|
+
};
|
|
8
|
+
exports.isBeyondLastFrame = isBeyondLastFrame;
|
|
9
|
+
const markAsBeyondLastFrame = (src, time) => {
|
|
10
|
+
map[src] = time;
|
|
11
|
+
};
|
|
12
|
+
exports.markAsBeyondLastFrame = markAsBeyondLastFrame;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.provideScreenshot = void 0;
|
|
4
4
|
const screenshot_dom_element_1 = require("./screenshot-dom-element");
|
|
5
|
-
const provideScreenshot =
|
|
5
|
+
const provideScreenshot = ({ page, imageFormat, options, quality, }) => {
|
|
6
6
|
return (0, screenshot_dom_element_1.screenshotDOMElement)({
|
|
7
7
|
page,
|
|
8
8
|
opts: {
|
package/dist/render-frames.js
CHANGED
|
@@ -135,6 +135,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
135
135
|
await (0, seek_to_frame_1.seekToFrame)({ frame, page: freePage });
|
|
136
136
|
if (imageFormat !== 'none') {
|
|
137
137
|
if (onFrameBuffer) {
|
|
138
|
+
const id = remotion_1.Internals.perf.startPerfMeasure('save');
|
|
138
139
|
const buffer = await (0, provide_screenshot_1.provideScreenshot)({
|
|
139
140
|
page: freePage,
|
|
140
141
|
imageFormat,
|
|
@@ -144,6 +145,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
144
145
|
output: undefined,
|
|
145
146
|
},
|
|
146
147
|
});
|
|
148
|
+
remotion_1.Internals.perf.stopPerfMeasure(id);
|
|
147
149
|
onFrameBuffer(buffer, frame);
|
|
148
150
|
}
|
|
149
151
|
else {
|
package/dist/render-media.js
CHANGED
|
@@ -137,7 +137,9 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
137
137
|
if (cancelled) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
+
const id = remotion_1.Internals.perf.startPerfMeasure('piping');
|
|
140
141
|
(_a = stitcherFfmpeg === null || stitcherFfmpeg === void 0 ? void 0 : stitcherFfmpeg.stdin) === null || _a === void 0 ? void 0 : _a.write(buffer);
|
|
142
|
+
remotion_1.Internals.perf.stopPerfMeasure(id);
|
|
141
143
|
setFrameToStitch(frame + 1);
|
|
142
144
|
}
|
|
143
145
|
: undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.0-offthread.
|
|
3
|
+
"version": "4.0.0-offthread.7+be13ba29c",
|
|
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
|
"puppeteer-core": "13.5.1",
|
|
25
|
-
"remotion": "4.0.0-offthread.
|
|
25
|
+
"remotion": "4.0.0-offthread.7+be13ba29c",
|
|
26
26
|
"serve-handler": "6.1.3",
|
|
27
27
|
"source-map": "^0.8.0-beta.0"
|
|
28
28
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "be13ba29c9d92cf58319a616e7e824b285480528"
|
|
63
63
|
}
|