🎥 Make videos programmatically with React
document install
Jonny Burgera98a6e98135b
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsxindex a3ac976e15..dcaa8470c5 100644--- a/packages/cli/src/index.tsx+++ b/packages/cli/src/index.tsx@@ -4,7 +4,6 @@ import {benchmarkCommand} from './benchmark';import {chalk} from './chalk';import {listCompositionsCommand} from './compositions';import {overrideRemotion} from './config/index';-import {installCommand, INSTALL_COMMAND} from './deps';import {determineFinalImageFormat} from './determine-image-format';import {getFileSizeDownloadBar} from './download-progress';import {findEntryPoint} from './entry-point';@@ -14,6 +13,7 @@ import {loadConfig} from './get-config-file-name';import {handleCommonError} from './handle-common-errors';import {getImageFormat} from './image-formats';import {initializeCli} from './initialize-cli';+import {installCommand, INSTALL_COMMAND} from './install';import {lambdaCommand} from './lambda-command';import {Log} from './log';import {makeProgressBar} from './make-progress-bar';diff --git a/packages/cli/src/deps.ts b/packages/cli/src/install.tssimilarity index 100%rename from packages/cli/src/deps.tsrename to packages/cli/src/install.tsdiff --git a/packages/cli/src/print-help.ts b/packages/cli/src/print-help.tsindex 97720484bd..1ebf256830 100644--- a/packages/cli/src/print-help.ts+++ b/packages/cli/src/print-help.ts@@ -1,5 +1,5 @@import {chalk} from './chalk';-import {INSTALL_COMMAND} from './deps';+import {INSTALL_COMMAND} from './install';import {Log} from './log';import {VERSIONS_COMMAND} from './versions';diff --git a/packages/docs/docs/cli/install.md b/packages/docs/docs/cli/install.mdnew file mode 100644index 0000000000..46517a6c47--- /dev/null+++ b/packages/docs/docs/cli/install.md@@ -0,0 +1,26 @@+---+title: npx remotion install+sidebar_label: install+---++_available from v3.3_++Ensures that `ffmpeg` or `ffprobe` are installed by downloading them from the internet if they cannot be found.++```bash+npx remotion install ffmpeg+```++```bash+npx remotion install ffprobe+```++You might not need to call this function. Remotion will automatically download `ffmpeg` and `ffprobe` if a render is attempted, and no binary was found.++These commands are useful if you need `ffmpeg` and `ffprobe` to be ready before the first render is started.++## See also++- [Node.JS equivalent: `ensureFfmpeg()`](/docs/renderer/ensure-ffmpeg)+- [Node.JS equivalent: `ensureFfprobe()`](/docs/renderer/ensure-ffprobe)+- [Installing FFmpeg](/docs/ffmpeg)diff --git a/packages/docs/docs/ffmpeg.md b/packages/docs/docs/ffmpeg.mdnew file mode 100644index 0000000000..f0ad6a5eff--- /dev/null+++ b/packages/docs/docs/ffmpeg.md@@ -0,0 +1,44 @@+---+title: Installing FFmpeg+sidebar_label: Installing FFmpeg+---++Remotion requires FFmpeg to encode videos. Since v3.3, you do not need to install FFmpeg manually. This page documents the behavior of Remotion for developers needing advanced control.++## `ffmpeg` and `ffprobe`++Two binaries are required for Remotion: `ffmpeg` and `ffprobe`. When talking about FFmpeg in the documentation, it may also refer to FFprobe.++## Auto-install++When rendering a video and binaries are not found, Remotion will download them from the internet and put it inside your `node_modules` folder. The binary will not get added to your `PATH`, so if you type in `ffmpeg` into your Terminal, it may not be found. However, Remotion will be able to use it++### Supported architectures++Auto-install is supported on the following platforms:++- Linux, x86_64,+- macOS, Intel+- macOS, Apple Silicon+- Windows, x86_64++For other platforms, you need to supply your own binaries.++### Triggering auto-install++By rendering a video, the download of FFmpeg will be triggered automatically.++On servers, it might be of use to install the binaries before the first render, so no time is wasted once the first render begins.++- Using the CLI, you can run [`npx remotion install ffmpeg`](/docs/cli/install) and `npx remotion install ffprobe` to trigger auto-install of binaries. If the binaries exist, the command will do nothing. This requires `@remotion/cli` to be installed.+- The [`@remotion/renderer`](/docs/renderer) package exposes [`ensureFfmpeg()`](/docs/renderer/ensure-ffmpeg) and [`ensureFfprobe()`](/docs/renderer/ensure-ffprobe) functions++## Order of priority++In case of multiple binaries being supplied, they priority order is the following:++- If a binary was supplied using the `ffmpegExecutable` or `ffprobeExecutable` option, it will be used.+- If `ffmpeg` or `ffprobe` is in the `PATH`, it will be used.+- If a binary was previously installed by Remotion into `node_modules`, it will be used.+- If a binary can be downloaded from the internet, Remotion will do so and use it.+- Failure if no binary was found using the logic above.diff --git a/packages/docs/docs/getting-started.md b/packages/docs/docs/getting-started.mdindex 9a07b7e438..764e79db19 100644--- a/packages/docs/docs/getting-started.md+++ b/packages/docs/docs/getting-started.md@@ -88,7 +88,7 @@ Got instructions for more Linux distributions? [Add them to this page](https://g## FFmpeg requirementRemotion requires `ffmpeg` and `ffprobe` binaries (minimum version 4.1) to render videos.-If you don't have them, Remotion will try to install FFmpeg for you.+If you don't have them, [Remotion will try to install FFmpeg for you](/docs/ffmpeg).## Installation in existing projectsdiff --git a/packages/docs/docs/renderer/ensure-ffmpeg.md b/packages/docs/docs/renderer/ensure-ffmpeg.mdnew file mode 100644index 0000000000..975234d594--- /dev/null+++ b/packages/docs/docs/renderer/ensure-ffmpeg.md@@ -0,0 +1,49 @@+---+id: ensure-ffmpeg+title: ensureFfmpeg()+---++_Available from v3.3_++Checks if the `ffmpeg` binary is installed and if it is not, [downloads it and puts it into your `node_modules` folder](/docs/ffmpeg).++```ts twoslash title="ensure.mjs"+// @module: esnext+// @target: es2018+import { ensureFfmpeg } from "@remotion/renderer";++await ensureFfmpeg();+```++You might not need to call this function. Remotion will automatically download `ffmpeg` if a render is attempted, and no binary was found.++This function is useful if you need FFmpeg to be ready before the first render is started.++Also call [`ensureFfprobe()`](/docs/renderer/ensure-ffprobe) to get both binaries that Remotion requires.++## Options++Optionally, you can pass an object and pass the following options:++### `remotionRoot`++_string_++The directory in which your `node_modules` is locted.++## Return value++A promise which resolves an object with the following properties:++- `wasAlreadyInstalled`: Boolean whether the binary was downloaded because of this function call.+- `result`: A string, either `found-in-path`, `found-in-node-modules` or `installed`.++## Exceptions++This function throws if no binary was found, the download fails or no binaries are available for your platform.++## See also++- CLI equivalent: [`npx remotion install ffmpeg`](/docs/cli/install)+- [`ensureFfprobe()`](/docs/renderer/ensure-ffprobe)+- [Installing FFmpeg](/docs/ffmpeg)diff --git a/packages/docs/docs/renderer/ensure-ffprobe.md b/packages/docs/docs/renderer/ensure-ffprobe.mdnew file mode 100644index 0000000000..789ec83d4f--- /dev/null+++ b/packages/docs/docs/renderer/ensure-ffprobe.md@@ -0,0 +1,49 @@+---+id: ensure-ffprobe+title: ensureFfprobe()+---++_Available from v3.3_++Checks if the `ffprobe` binary is installed and if it is not, [downloads it and puts it into your `node_modules` folder](/docs/ffmpeg).++```ts twoslash title="ensure.mjs"+// @module: esnext+// @target: es2018+import { ensureFfprobe } from "@remotion/renderer";++await ensureFfprobe();+```++You might not need to call this function. Remotion will automatically download `ffprobe` if a render is attempted, and no binary was found.++This function is useful if you need `ffprobe` to be ready before the first render is started.++Also call [`ensureFfmpeg()`](/docs/renderer/ensure-ffmpeg) to get both binaries that Remotion requires.++## Options++Optionally, you can pass an object and pass the following options:++### `remotionRoot`++_string_++The directory in which your `node_modules` is locted.++## Return value++A promise which resolves an object with the following properties:++- `wasAlreadyInstalled`: Boolean whether the binary was downloaded because of this function call.+- `result`: A string, either `found-in-path`, `found-in-node-modules` or `installed`.++## Exceptions++This function throws if no binary was found, the download fails or no binaries are available for your platform.++## See also++- CLI equivalent: [`npx remotion install ffprobe`](/docs/cli/install)+- [`ensureFfmpeg()`](/docs/renderer/ensure-ffmpeg)+- [Installing FFmpeg](/docs/ffmpeg)diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex a18baa130e..cecaec42ca 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -32,6 +32,7 @@ module.exports = {],},"cli/benchmark",+ "cli/install","cli/versions","cli/upgrade","cli/help",@@ -105,6 +106,8 @@ module.exports = {"renderer/stitch-frames-to-video","renderer/open-browser","renderer/make-cancel-signal",+ "renderer/ensure-ffmpeg",+ "renderer/ensure-ffprobe",],},{@@ -431,6 +434,7 @@ module.exports = {label: "Miscellaneous",items: ["brownfield",+ "ffmpeg","chromium-flags","video-vs-offthreadvideo","prereleases",