@remotion/renderer 4.0.0-offthread.42 → 4.0.0-offthread.5
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-and-map-assets-to-file.d.ts +1 -1
- package/dist/assets/download-and-map-assets-to-file.js +30 -13
- package/dist/combine-videos.d.ts +2 -1
- package/dist/combine-videos.js +3 -1
- package/dist/create-ffmpeg-complex-filter.d.ts +1 -4
- package/dist/cycle-browser-tabs.d.ts +2 -1
- package/dist/cycle-browser-tabs.js +9 -2
- package/dist/extract-frame-from-video.d.ts +0 -5
- package/dist/extract-frame-from-video.js +15 -6
- package/dist/get-compositions.d.ts +1 -1
- package/dist/get-compositions.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/last-frame-from-video-cache.d.ts +11 -0
- package/dist/last-frame-from-video-cache.js +52 -0
- 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 +6 -1
- package/dist/offthread-video-server.js +5 -4
- package/dist/open-browser.d.ts +5 -5
- package/dist/open-browser.js +2 -1
- package/dist/prepare-server.js +1 -1
- package/dist/prespawn-ffmpeg.d.ts +2 -0
- package/dist/prespawn-ffmpeg.js +3 -0
- package/dist/puppeteer-screenshot.js +5 -1
- package/dist/render-frames.d.ts +2 -0
- package/dist/render-frames.js +75 -37
- package/dist/render-media.d.ts +3 -1
- package/dist/render-media.js +115 -54
- package/dist/render-still.d.ts +4 -2
- package/dist/render-still.js +28 -11
- package/dist/serve-static.js +9 -1
- package/dist/set-props-and-env.d.ts +2 -1
- package/dist/set-props-and-env.js +22 -3
- package/dist/stitch-frames-to-video.d.ts +3 -1
- package/dist/stitch-frames-to-video.js +27 -14
- package/package.json +4 -4
|
@@ -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;
|
|
@@ -16,13 +17,14 @@ export declare type StitcherOptions = {
|
|
|
16
17
|
verbose?: boolean;
|
|
17
18
|
ffmpegExecutable?: FfmpegExecutable;
|
|
18
19
|
dir?: string;
|
|
20
|
+
cancelSignal?: CancelSignal;
|
|
19
21
|
internalOptions?: {
|
|
20
22
|
preEncodedFileLocation: string | null;
|
|
21
23
|
imageFormat: ImageFormat;
|
|
22
24
|
};
|
|
23
25
|
};
|
|
24
26
|
declare type ReturnType = {
|
|
25
|
-
task: Promise<
|
|
27
|
+
task: Promise<void>;
|
|
26
28
|
getLogs: () => string;
|
|
27
29
|
};
|
|
28
30
|
export declare const spawnFfmpeg: (options: StitcherOptions) => Promise<ReturnType>;
|
|
@@ -68,7 +68,7 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
|
|
|
68
68
|
return outName;
|
|
69
69
|
};
|
|
70
70
|
const spawnFfmpeg = async (options) => {
|
|
71
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
72
72
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
73
73
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
74
74
|
remotion_1.Internals.validateFps(options.fps, 'passed to `stitchFramesToVideo()`');
|
|
@@ -121,7 +121,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
121
121
|
if (!audioCodecName) {
|
|
122
122
|
throw new TypeError('exporting audio but has no audio codec name. Report this in the Remotion repo.');
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
const ffmpegTask = (0, execa_1.default)('ffmpeg', [
|
|
125
125
|
'-i',
|
|
126
126
|
audio,
|
|
127
127
|
'-c:a',
|
|
@@ -129,7 +129,11 @@ const spawnFfmpeg = async (options) => {
|
|
|
129
129
|
options.force ? '-y' : null,
|
|
130
130
|
options.outputLocation,
|
|
131
131
|
].filter(remotion_1.Internals.truthy));
|
|
132
|
-
(_h = options.
|
|
132
|
+
(_h = options.cancelSignal) === null || _h === void 0 ? void 0 : _h.call(options, () => {
|
|
133
|
+
ffmpegTask.kill();
|
|
134
|
+
});
|
|
135
|
+
await ffmpegTask;
|
|
136
|
+
(_j = options.onProgress) === null || _j === void 0 ? void 0 : _j.call(options, expectedFrames);
|
|
133
137
|
return {
|
|
134
138
|
getLogs: () => '',
|
|
135
139
|
task: Promise.resolve(),
|
|
@@ -137,8 +141,8 @@ const spawnFfmpeg = async (options) => {
|
|
|
137
141
|
}
|
|
138
142
|
const ffmpegArgs = [
|
|
139
143
|
['-r', String(options.fps)],
|
|
140
|
-
...(((
|
|
141
|
-
? [['-i', (
|
|
144
|
+
...(((_k = options.internalOptions) === null || _k === void 0 ? void 0 : _k.preEncodedFileLocation)
|
|
145
|
+
? [['-i', (_l = options.internalOptions) === null || _l === void 0 ? void 0 : _l.preEncodedFileLocation]]
|
|
142
146
|
: [
|
|
143
147
|
['-f', 'image2'],
|
|
144
148
|
['-s', `${options.width}x${options.height}`],
|
|
@@ -149,7 +153,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
149
153
|
// -c:v is the same as -vcodec as -codec:video
|
|
150
154
|
// and specified the video codec.
|
|
151
155
|
['-c:v', encoderName],
|
|
152
|
-
...(((
|
|
156
|
+
...(((_m = options.internalOptions) === null || _m === void 0 ? void 0 : _m.preEncodedFileLocation)
|
|
153
157
|
? []
|
|
154
158
|
: [
|
|
155
159
|
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
@@ -177,12 +181,15 @@ const spawnFfmpeg = async (options) => {
|
|
|
177
181
|
console.log(ffmpegArgs);
|
|
178
182
|
}
|
|
179
183
|
const ffmpegString = ffmpegArgs.flat(2).filter(Boolean);
|
|
180
|
-
const task = (0, execa_1.default)((
|
|
184
|
+
const task = (0, execa_1.default)((_o = options.ffmpegExecutable) !== null && _o !== void 0 ? _o : 'ffmpeg', ffmpegString, {
|
|
181
185
|
cwd: options.dir,
|
|
182
186
|
});
|
|
187
|
+
(_p = options.cancelSignal) === null || _p === void 0 ? void 0 : _p.call(options, () => {
|
|
188
|
+
task.kill();
|
|
189
|
+
});
|
|
183
190
|
let ffmpegOutput = '';
|
|
184
191
|
let isFinished = false;
|
|
185
|
-
(
|
|
192
|
+
(_q = task.stderr) === null || _q === void 0 ? void 0 : _q.on('data', (data) => {
|
|
186
193
|
var _a;
|
|
187
194
|
const str = data.toString();
|
|
188
195
|
ffmpegOutput += str;
|
|
@@ -204,16 +211,22 @@ const spawnFfmpeg = async (options) => {
|
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
});
|
|
207
|
-
return { task, getLogs: () => ffmpegOutput };
|
|
214
|
+
return { task: task.then(() => undefined), getLogs: () => ffmpegOutput };
|
|
208
215
|
};
|
|
209
216
|
exports.spawnFfmpeg = spawnFfmpeg;
|
|
210
217
|
const stitchFramesToVideo = async (options) => {
|
|
211
218
|
const { task, getLogs } = await (0, exports.spawnFfmpeg)(options);
|
|
212
|
-
|
|
213
|
-
await task;
|
|
214
|
-
}
|
|
215
|
-
catch (err) {
|
|
219
|
+
const happyPath = task.catch(() => {
|
|
216
220
|
throw new Error(getLogs());
|
|
217
|
-
}
|
|
221
|
+
});
|
|
222
|
+
return Promise.race([
|
|
223
|
+
happyPath,
|
|
224
|
+
new Promise((_resolve, reject) => {
|
|
225
|
+
var _a;
|
|
226
|
+
(_a = options.cancelSignal) === null || _a === void 0 ? void 0 : _a.call(options, () => {
|
|
227
|
+
reject(new Error('stitchFramesToVideo() got cancelled'));
|
|
228
|
+
});
|
|
229
|
+
}),
|
|
230
|
+
]);
|
|
218
231
|
};
|
|
219
232
|
exports.stitchFramesToVideo = stitchFramesToVideo;
|
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.5+74268d3f1",
|
|
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.5+74268d3f1",
|
|
26
26
|
"serve-handler": "6.1.3",
|
|
27
27
|
"source-map": "^0.8.0-beta.0"
|
|
28
28
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react": "18.0.0",
|
|
47
47
|
"react-dom": "18.0.0",
|
|
48
48
|
"ts-jest": "^27.0.5",
|
|
49
|
-
"typescript": "^4.
|
|
49
|
+
"typescript": "^4.7.0"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"remotion",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "74268d3f1bd53f919fdef44575596b9005e112ab"
|
|
63
63
|
}
|