Skip to content

🎥 Make videos programmatically with React

finish

Jonny Burgerb88035c94036
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index e9ee3646bb..413ee6b01c 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -11,6 +11,8 @@ import {
PixelFormat,
ProResProfile,
} from 'remotion';
+import {OpenGlRenderer} from 'remotion/src/validation/validate-opengl-renderer';
+import {ContextReplacementPlugin} from 'webpack';
import {Log} from './log';
export type CommandLineOptions = {
@@ -39,6 +41,8 @@ export type CommandLineOptions = {
help: boolean;
port: number;
frame: string | number;
+ headless: boolean;
+ gl: OpenGlRenderer;
};
export const parsedCli = minimist<CommandLineOptions>(process.argv.slice(2), {
@@ -49,6 +53,7 @@ export const parsedCli = minimist<CommandLineOptions>(process.argv.slice(2), {
'help',
'disable-web-security',
'ignore-certificate-errors',
+ 'headless',
],
});
@@ -83,6 +88,14 @@ export const parseCommandLine = (type: 'still' | 'sequence' | 'versions') => {
Config.Puppeteer.setChromiumIgnoreCertificateErrors(true);
}
+ if (parsedCli.headless === false) {
+ Config.Puppeteer.setChromiumHeadlessMode(false);
+ }
+
+ if (parsedCli.gl) {
+ Config.Puppeteer.setChromiumOpenGlRenderer(parsedCli.gl);
+ }
+
if (parsedCli.log) {
if (!Internals.Logging.isValidLogLevel(parsedCli.log)) {
Log.error('Invalid `--log` value passed.');
diff --git a/packages/docs/docs/chromium-flags.md b/packages/docs/docs/chromium-flags.md
index fec9f5d1ff..16ac50642a 100644
--- a/packages/docs/docs/chromium-flags.md
+++ b/packages/docs/docs/chromium-flags.md
@@ -15,6 +15,8 @@ Remotion will automatically append the `--user-data-dir` flag.
### Enabling in Node.JS APIs
+<!-- TODO: Adapt for lambda -->
+
In [`getCompositions()`](/docs/get-compositions), [`renderStill()`](/docs/render-still) and [`renderFrames()`](/docs/render-frames), you can pass [`chromiumOptions.disableWebSecurity`](/docs/render-still#disablewebsecurity).
### Enabling via CLI
@@ -61,15 +63,15 @@ Config.Puppeteer.setChromiumIgnoreCertificateErrors(true);
By default `true`. Disabling it will open an actual Chrome window where you can see the render happen.
-## Enabling in Node.JS APIs
+### Enabling in Node.JS APIs
In [`getCompositions()`](/docs/get-compositions), [`renderStill()`](/docs/render-still) and [`renderFrames()`](/docs/render-frames), you can pass [`chromiumOptions.headless`](/docs/render-still#headless).
-## Enabling via CLI
+### Enabling via CLI
Pass [`--headless=false`](/docs/cli#headless) in a `remotion render` or `remotion still` command.
-## Enabling via config file
+### Enabling via config file
Use [setChromiumHeadlessMode()](/docs/config#setchromiumheadlessmode).
@@ -80,3 +82,27 @@ import { Config } from "remotion";
Config.Puppeteer.setChromiumHeadlessMode(false);
```
+
+## `--gl`
+
+<!-- TODO: Update for lambda -->
+
+Select the OpenGL renderer backend for Chromium. Accepted values: `angle`, `egl`, `swiftshader`. Default: `angle`.
+
+### Enabling in Node.JS APIs
+
+In [`getCompositions()`](/docs/get-compositions), [`renderStill()`](/docs/render-still) and [`renderFrames()`](/docs/render-frames), you can pass [`chromiumOptions.gl`](/docs/render-still#gl).
+
+### Enabling via CLI
+
+Pass [`--gl=swiftshader`](/docs/cli#gl) in a `remotion render` or `remotion still` command.
+
+### Enabling via config file
+
+```tsx twoslash
+import { Config } from "remotion";
+
+// ---cut---
+
+Config.Puppeteer.setChromiumOpenGlRenderer("swiftshader");
+```
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index 17648ee0a8..06d61ca2f1 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -198,6 +198,12 @@ _available for `still`, `render` command_
Enabled by default. Pass `--headless=false` to open an actual browser during rendering to observe the render.
Available since v2.6.5.
+### `--gl`
+
+_available for `still`, `render` command_
+
+Select the OpenGL renderer backend for Chromium. Accepted values: `angle`, `egl`, `swiftshader`. Default: `angle`. Available since v2.6.5.
+
### `--help`
Print the list of available CLI commands and flags.
diff --git a/packages/docs/docs/get-compositions.md b/packages/docs/docs/get-compositions.md
index 2ba4bb79bd..d4a2e6d7ee 100644
--- a/packages/docs/docs/get-compositions.md
+++ b/packages/docs/docs/get-compositions.md
@@ -53,6 +53,38 @@ _optional, available from v2.6.3_
A number describing how long one frame may take to resolve all `delayRender()` calls before the render times out and fails. Default: `30000`
+### `chromiumOptions?`
+
+_optional, available from v2.6.5_
+
+Allows you to set certain Chromium / Google Chrome flags. See: [Chromium flags](/docs/chromium-flags).
+
+#### `disableWebSecurity`
+
+_boolean - default `false`_
+
+This will most notably disable CORS among other security features.
+
+#### `ignoreCertificateErrors`
+
+_boolean - default `false`_
+
+Results in invalid SSL certificates, such as self-signed ones being ignored.
+
+#### `headless`
+
+_boolean - default `true`_
+
+If disabled, the render will open an actual Chrome window where you can see the render happen.
+
+#### `gl`
+
+_string_
+
+<!-- TODO: Update for lambda -->
+
+Select the OpenGL renderer backend for Chromium. Accepted values: `angle`, `egl`, `swiftshader`. Default: `angle`.
+
## Return value
Returns a promise that resolves to an array of available compositions. Example value:
diff --git a/packages/docs/docs/render-frames.md b/packages/docs/docs/render-frames.md
index 3aa36c76ac..21901558a9 100644
--- a/packages/docs/docs/render-frames.md
+++ b/packages/docs/docs/render-frames.md
@@ -186,6 +186,14 @@ _boolean - default `true`_
If disabled, the render will open an actual Chrome window where you can see the render happen.
+#### `gl`
+
+_string_
+
+<!-- TODO: Update for lambda -->
+
+Select the OpenGL renderer backend for Chromium. Accepted values: `angle`, `egl`, `swiftshader`. Default: `angle`.
+
## Return value
A promise resolving to an object containing the following properties:
diff --git a/packages/docs/docs/render-still.md b/packages/docs/docs/render-still.md
index ae121cced6..9beb2bae28 100644
--- a/packages/docs/docs/render-still.md
+++ b/packages/docs/docs/render-still.md
@@ -170,6 +170,14 @@ _boolean - default `true`_
If disabled, the render will open an actual Chrome window where you can see the render happen.
+#### `gl`
+
+_string_
+
+<!-- TODO: Update for lambda -->
+
+Select the OpenGL renderer backend for Chromium. Accepted values: `angle`, `egl`, `swiftshader`. Default: `angle`.
+
## Return value
A promise with no value. If the render succeeded, the still has been saved to `output`. If the render failed, the promise rejects.