@remotion/renderer 4.0.225 → 4.0.227

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/Cargo.toml DELETED
@@ -1,26 +0,0 @@
1
- # Putting this file into packages/ because VSCode Rust extension
2
- # only searches 1 level for Cargofiles
3
-
4
- [package]
5
- name = "remotion-renderer"
6
- version = "0.1.0"
7
- authors = ["Jonny Burger <jonny@remotion.dev>"]
8
- edition = "2021"
9
-
10
- [dependencies]
11
- png = "0.17.13"
12
- serde = {version = "1.0.151", features = ["derive"]}
13
- serde_json = "1.0.89"
14
- jpeg-decoder = "0.3"
15
- jpeg-encoder = "0.5.1"
16
- lazy_static = "1.4"
17
- rayon = "1.7.0"
18
- image = "0.24.7"
19
- sysinfo = "0.30.7"
20
- mp4 = {git = "https://github.com/jonnyburger/mp4-rust", rev = "92ba375738cc2f05a4d754e1f968cf2e97d06641"}
21
- ffmpeg-next = {git = "https://github.com/remotion-dev/rust-ffmpeg", rev ="b3878a087fc5be3985974cec9627072bc94b8f52"}
22
-
23
- [[bin]]
24
- name = "remotion"
25
- path = "rust/main.rs"
26
-
package/build.ts DELETED
@@ -1,311 +0,0 @@
1
- import {execSync} from 'node:child_process';
2
- import {
3
- copyFileSync,
4
- existsSync,
5
- lstatSync,
6
- mkdirSync,
7
- readdirSync,
8
- renameSync,
9
- rmdirSync,
10
- rmSync,
11
- statSync,
12
- unlinkSync,
13
- } from 'node:fs';
14
- import os from 'node:os';
15
- import path from 'node:path';
16
- import {toolchains} from './toolchains.mjs';
17
-
18
- const isWin = os.platform() === 'win32';
19
- const where = isWin ? 'where' : 'which';
20
-
21
- if (os.platform() === 'win32') {
22
- console.log('Windows CI is broken - needs to be cross-compiled');
23
- process.exit(0);
24
- }
25
-
26
- function isMusl() {
27
- // @ts-expect-error
28
- const {glibcVersionRuntime} = process.report.getReport().header;
29
- return !glibcVersionRuntime;
30
- }
31
-
32
- const targets = [
33
- 'x86_64-pc-windows-gnu',
34
- 'x86_64-unknown-linux-musl',
35
- 'aarch64-unknown-linux-gnu',
36
- 'x86_64-unknown-linux-gnu',
37
- 'aarch64-apple-darwin',
38
- 'x86_64-apple-darwin',
39
- 'aarch64-unknown-linux-musl',
40
- ];
41
-
42
- export const getTarget = () => {
43
- switch (process.platform) {
44
- case 'win32':
45
- switch (process.arch) {
46
- case 'x64':
47
- return 'x86_64-pc-windows-gnu';
48
- default:
49
- throw new Error(
50
- `Unsupported architecture on Windows: ${process.arch}`,
51
- );
52
- }
53
-
54
- case 'darwin':
55
- switch (process.arch) {
56
- case 'x64':
57
- return 'x86_64-apple-darwin';
58
- case 'arm64':
59
- return 'aarch64-apple-darwin';
60
- default:
61
- throw new Error(`Unsupported architecture on macOS: ${process.arch}`);
62
- }
63
-
64
- case 'linux':
65
- switch (process.arch) {
66
- case 'x64':
67
- if (isMusl()) {
68
- return 'x86_64-unknown-linux-musl';
69
- }
70
-
71
- return 'x86_64-unknown-linux-gnu';
72
- case 'arm64':
73
- if (isMusl()) {
74
- return 'aarch64-unknown-linux-musl';
75
- }
76
-
77
- return 'aarch64-unknown-linux-gnu';
78
-
79
- default:
80
- throw new Error(`Unsupported architecture on Linux: ${process.arch}`);
81
- }
82
-
83
- default:
84
- throw new Error(
85
- `Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
86
- );
87
- }
88
- };
89
-
90
- const hasCargo = () => {
91
- try {
92
- execSync(`${where} cargo`);
93
- return true;
94
- } catch (err) {
95
- return false;
96
- }
97
- };
98
-
99
- const debug = process.argv.includes('--debug');
100
- const mode = debug ? 'debug' : 'release';
101
-
102
- const copyDestinations = {
103
- 'aarch64-unknown-linux-gnu': {
104
- from: `target/aarch64-unknown-linux-gnu/${mode}/remotion`,
105
- to: '../compositor-linux-arm64-gnu/remotion',
106
- dir: '../compositor-linux-arm64-gnu',
107
- },
108
- 'aarch64-unknown-linux-musl': {
109
- from: `target/aarch64-unknown-linux-musl/${mode}/remotion`,
110
- to: '../compositor-linux-arm64-musl/remotion',
111
- dir: '../compositor-linux-arm64-musl',
112
- },
113
- 'x86_64-unknown-linux-gnu': {
114
- from: `target/x86_64-unknown-linux-gnu/${mode}/remotion`,
115
- to: '../compositor-linux-x64-gnu/remotion',
116
- dir: '../compositor-linux-x64-gnu',
117
- },
118
- 'x86_64-unknown-linux-musl': {
119
- from: `target/x86_64-unknown-linux-musl/${mode}/remotion`,
120
- to: '../compositor-linux-x64-musl/remotion',
121
- dir: '../compositor-linux-x64-musl',
122
- },
123
- 'x86_64-apple-darwin': {
124
- from: `target/x86_64-apple-darwin/${mode}/remotion`,
125
- to: '../compositor-darwin-x64/remotion',
126
- dir: '../compositor-darwin-x64',
127
- },
128
- 'aarch64-apple-darwin': {
129
- from: `target/aarch64-apple-darwin/${mode}/remotion`,
130
- to: '../compositor-darwin-arm64/remotion',
131
- dir: '../compositor-darwin-arm64',
132
- },
133
- 'x86_64-pc-windows-gnu': {
134
- from: `target/x86_64-pc-windows-gnu/${mode}/remotion.exe`,
135
- to: '../compositor-win32-x64-msvc/remotion.exe',
136
- dir: '../compositor-win32-x64-msvc',
137
- },
138
- };
139
-
140
- if (!hasCargo()) {
141
- console.log('Environment has no cargo. Skipping Rust builds.');
142
- process.exit(0);
143
- }
144
-
145
- const nativeArch = getTarget();
146
-
147
- const all = process.argv.includes('--all');
148
- const cloudrun = process.argv.includes('--cloudrun');
149
- const lambda = process.argv.includes('--lambda');
150
- if (!existsSync('toolchains') && all) {
151
- throw new Error(
152
- 'Run "node install-toolchain.mjs" if you want to build all platforms',
153
- );
154
- }
155
-
156
- for (const toolchain of toolchains) {
157
- if (!existsSync(path.join('toolchains', toolchain)) && all) {
158
- throw new Error(
159
- `Toolchain for ${toolchain} not found. Run "node install-toolchain.mjs" if you want to build all platforms`,
160
- );
161
- }
162
- }
163
-
164
- const stdout = execSync('cargo metadata --format-version=1');
165
- const {packages} = JSON.parse(stdout as unknown as string);
166
-
167
- const rustFfmpegSys = packages.find((p) => p.name === 'ffmpeg-sys-next');
168
-
169
- if (!rustFfmpegSys) {
170
- console.error(
171
- 'Could not find ffmpeg-sys-next when running cargo metadata --format-version=1',
172
- );
173
- process.exit(1);
174
- }
175
-
176
- const manifest = rustFfmpegSys.manifest_path;
177
- const binariesDirectory = path.join(path.dirname(manifest), 'zips');
178
- const archs = all
179
- ? targets
180
- : lambda
181
- ? ['aarch64-unknown-linux-gnu']
182
- : cloudrun
183
- ? ['x86_64-unknown-linux-gnu']
184
- : [nativeArch];
185
-
186
- for (const arch of archs) {
187
- const ffmpegFolder = path.join(copyDestinations[arch].dir, 'ffmpeg');
188
- if (existsSync(ffmpegFolder)) {
189
- rmSync(ffmpegFolder, {recursive: true});
190
- }
191
-
192
- mkdirSync(ffmpegFolder);
193
-
194
- // strip-components: extract in a flat folder structure
195
- execSync(
196
- `tar xf ${binariesDirectory}/${arch}.gz -C ${ffmpegFolder} --strip-components 2`,
197
- {
198
- stdio: 'inherit',
199
- },
200
- );
201
- const filesInFfmpegFolder = readdirSync(ffmpegFolder);
202
- const filesToDelete = filesInFfmpegFolder.filter((file) => {
203
- return (
204
- file.endsWith('.h') ||
205
- file.endsWith('.a') ||
206
- file.endsWith('.la') ||
207
- file.endsWith('.hpp') ||
208
- statSync(path.join(ffmpegFolder, file)).isDirectory()
209
- );
210
- });
211
- for (const file of filesToDelete) {
212
- rmSync(path.join(ffmpegFolder, file), {recursive: true});
213
- }
214
-
215
- const filesInFfmpegFolder2 = readdirSync(ffmpegFolder);
216
- for (const file of filesInFfmpegFolder2) {
217
- if (file === 'ffmpeg') {
218
- renameSync(
219
- path.join(ffmpegFolder, file),
220
- path.join(ffmpegFolder, '..', 'ffmpeg_'),
221
- );
222
- continue;
223
- }
224
-
225
- renameSync(
226
- path.join(ffmpegFolder, file),
227
- path.join(ffmpegFolder, '..', file),
228
- );
229
- }
230
-
231
- rmdirSync(path.join(ffmpegFolder, '..', 'ffmpeg'));
232
- if (existsSync(path.join(ffmpegFolder, '..', 'bin'))) {
233
- rmSync(path.join(ffmpegFolder, '..', 'bin'), {recursive: true});
234
- }
235
-
236
- if (existsSync(path.join(ffmpegFolder, '..', 'ffmpeg_'))) {
237
- renameSync(
238
- path.join(ffmpegFolder, '..', 'ffmpeg_'),
239
- path.join(ffmpegFolder, '..', 'ffmpeg'),
240
- );
241
- }
242
-
243
- const command = `cargo build ${debug ? '' : '--release'} --target=${arch}`;
244
- console.log(command);
245
-
246
- // debuginfo will keep symbols, which are used for backtrace.
247
- // symbols makes it a tiny bit smaller, but error messages will be hard to debug.
248
-
249
- const rPathOrigin = arch.includes('linux')
250
- ? `-C link-args=-Wl,-rpath,'$ORIGIN'`
251
- : '';
252
-
253
- const optimizations = all
254
- ? `-C opt-level=3 -C lto=fat -C strip=debuginfo -C embed-bitcode=yes ${rPathOrigin}`
255
- : '';
256
-
257
- execSync(command, {
258
- stdio: 'inherit',
259
- env: {
260
- ...process.env,
261
- RUSTFLAGS: optimizations,
262
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER:
263
- nativeArch === 'aarch64-unknown-linux-gnu'
264
- ? undefined
265
- : 'toolchains/aarch64_gnu_toolchain/bin/aarch64-unknown-linux-gnu-gcc',
266
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER:
267
- nativeArch === 'aarch64-unknown-linux-musl'
268
- ? undefined
269
- : 'toolchains/aarch64_musl_toolchain/bin/aarch64-unknown-linux-musl-gcc',
270
- CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER:
271
- nativeArch === 'x86_64-unknown-linux-gnu'
272
- ? undefined
273
- : path.join(
274
- process.cwd(),
275
- 'toolchains/x86_64_gnu_toolchain/bin/x86_64-unknown-linux-gnu-gcc',
276
- ),
277
- CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER:
278
- nativeArch === 'x86_64-unknown-linux-musl'
279
- ? undefined
280
- : 'toolchains/x86_64_musl_toolchain/bin/x86_64-unknown-linux-musl-gcc',
281
- },
282
- });
283
- const copyInstructions = copyDestinations[arch];
284
-
285
- copyFileSync(copyInstructions.from, copyInstructions.to);
286
-
287
- const output = execSync('npm pack --json', {
288
- cwd: copyDestinations[arch].dir,
289
- stdio: 'pipe',
290
- });
291
-
292
- const filename = JSON.parse(output.toString('utf-8'))[0].filename.replace(
293
- /^@remotion\//,
294
- 'remotion-',
295
- );
296
- const tgzPath = path.join(
297
- process.cwd(),
298
- copyDestinations[arch].dir,
299
- filename,
300
- );
301
-
302
- if (arch.includes('linux')) {
303
- execSync(
304
- `patchelf --force-rpath --set-rpath '$ORIGIN' ${copyDestinations[arch].dir}/remotion`,
305
- );
306
- }
307
-
308
- const filesize = lstatSync(tgzPath).size;
309
- console.log('Zipped size:', (filesize / 1000000).toFixed(2) + 'MB');
310
- unlinkSync(tgzPath);
311
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright 2020 Google Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { Viewport } from './PuppeteerViewport';
17
- export interface BrowserConnectOptions {
18
- defaultViewport: Viewport;
19
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2020 Google Inc. All rights reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright 2020 Google Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { HeadlessBrowser } from './Browser';
17
- import type { BrowserConnectOptions } from './BrowserConnector';
18
- import type { ProductLauncher } from './Launcher';
19
- import type { BrowserLaunchArgumentOptions, LaunchOptions } from './LaunchOptions';
20
- interface PuppeteerLaunchOptions extends LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions {
21
- extraPrefsFirefox?: Record<string, unknown>;
22
- }
23
- export declare class PuppeteerNode {
24
- #private;
25
- constructor();
26
- launch(options: PuppeteerLaunchOptions): Promise<HeadlessBrowser>;
27
- executablePath(channel?: string): string;
28
- get _launcher(): ProductLauncher;
29
- }
30
- export {};
@@ -1,52 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2020 Google Inc. All rights reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
- };
22
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
23
- if (kind === "m") throw new TypeError("Private method is not writable");
24
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
25
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
26
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
27
- };
28
- var _PuppeteerNode_lazyLauncher;
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.PuppeteerNode = void 0;
31
- const Launcher_1 = require("./Launcher");
32
- class PuppeteerNode {
33
- constructor() {
34
- _PuppeteerNode_lazyLauncher.set(this, void 0);
35
- this.launch = this.launch.bind(this);
36
- this.executablePath = this.executablePath.bind(this);
37
- }
38
- launch(options) {
39
- return this._launcher.launch(options);
40
- }
41
- executablePath(channel) {
42
- return this._launcher.executablePath(channel);
43
- }
44
- get _launcher() {
45
- if (!__classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f")) {
46
- __classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, new Launcher_1.ChromeLauncher(), "f");
47
- }
48
- return __classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f");
49
- }
50
- }
51
- exports.PuppeteerNode = PuppeteerNode;
52
- _PuppeteerNode_lazyLauncher = new WeakMap();
@@ -1,2 +0,0 @@
1
- import { PuppeteerNode } from './PuppeteerNode';
2
- export declare const puppeteer: PuppeteerNode;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.puppeteer = void 0;
4
- const PuppeteerNode_1 = require("./PuppeteerNode");
5
- exports.puppeteer = new PuppeteerNode_1.PuppeteerNode();
@@ -1,2 +0,0 @@
1
- import type { LogLevel } from './log-level';
2
- export declare const copyImageToClipboard: (src: string, logLevel: LogLevel, binariesDirectory: string | null) => Promise<void>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyImageToClipboard = void 0;
4
- const compositor_1 = require("./compositor/compositor");
5
- const copyImageToClipboard = async (src, logLevel, binariesDirectory) => {
6
- const compositor = (0, compositor_1.startLongRunningCompositor)({
7
- maximumFrameCacheItemsInBytes: null,
8
- logLevel,
9
- indent: false,
10
- binariesDirectory,
11
- });
12
- await compositor.executeCommand('CopyImageToClipboard', {
13
- src,
14
- });
15
- await compositor.finishCommands();
16
- await compositor.waitForDone();
17
- };
18
- exports.copyImageToClipboard = copyImageToClipboard;