Skip to content

🎥 Make videos programmatically with React

update docker

Jonny Burger56c07215f50f
diff --git a/packages/docs/blog/2021-02-13-remotion-1-2.md b/packages/docs/blog/2021-02-13-remotion-1-2.md
index 4dbebff317..3cd621772a 100644
--- a/packages/docs/blog/2021-02-13-remotion-1-2.md
+++ b/packages/docs/blog/2021-02-13-remotion-1-2.md
@@ -13,7 +13,7 @@ You have tested Remotion and provided an enormous amount of feedback! Thanks to
It turns out rendering each frame as JPEG is much faster than rendering them in PNG and results in no visible quality difference. Using this trick, the time of the 'Rendering Frames...' of an example video went down from 14 seconds to 6.5 seconds! That's more than twice as fast.
-Now that the rendering process is JPEG-based, [a new flag `--quality`](/docs/cli#flags) was added to command line. [For server-side rendering, you may pass in a new `imageFormat`](/docs/ssr#render-a-video-programmatically) option.
+Now that the rendering process is JPEG-based, [a new flag `--quality`](/docs/cli#flags) was added to command line. [For server-side rendering, you may pass in a new `imageFormat`](/docs/ssr) option.
If you [render a PNG sequence](/docs/cli#flags), Remotion will of course still deliver PNGs.
The goal is to make rendering even faster, finding further optimizations is going to be a very interesting task!
diff --git a/packages/docs/docs/docker.md b/packages/docs/docs/docker.md
index 3a7284df07..282e6fbf47 100644
--- a/packages/docs/docs/docker.md
+++ b/packages/docs/docs/docker.md
@@ -11,17 +11,15 @@ We recommend the following structure for your Dockerfile. Read below about the i
FROM debian:bookworm-20230411
RUN apt-get update
-RUN apt-get install -y nodejs npm ffmpeg chromium
+RUN apt-get install -y nodejs npm chromium
# Copy everything from your project to the Docker image. Adjust if needed.
COPY package.json package*.json yarn.lock* pnpm-lock.yaml* tsconfig.json* remotion.config.* ./
COPY src ./src
+
# If you have a public folder:
COPY public ./public
-# Specify the location of the Chromium browser
-ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
-
# Install the right package manager and dependencies - see below for Yarn/PNPM
RUN npm i
@@ -76,19 +74,7 @@ COPY public ./public
```
<p>
-<Step>5</Step> Tell Remotion where the Chromium executable is located.
-</p>
-
-```docker
-ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
-```
-
-:::note
-If you are on Remotion `v3.3.81` or higher, you don't need this line.
-:::
-
-<p>
-<Step>6</Step> Install the right package manager and dependencies.
+<Step>5</Step> Install the right package manager and dependencies.
</p>
- If you use NPM, put the following in your Dockerfile:
@@ -110,7 +96,7 @@ If you are on Remotion `v3.3.81` or higher, you don't need this line.
```
<p>
-<Step>7</Step> Run your code. It can be a CLI command or a Node.JS app.
+<Step>6</Step> Run your code. It can be a CLI command or a Node.JS app.
</p>
```docker
@@ -120,9 +106,13 @@ CMD ["node", "render.mjs"]
## Example render script
-```js title="render.mjs"
+Assuming you want to render the composition `MyComp`:
+
+```tsx twoslash title="render.mjs"
+// @module: ESNext
+// @target: ESNext
import { bundle } from "@remotion/bundler";
-import { getCompositions, renderMedia } from "@remotion/renderer";
+import { renderMedia, selectComposition } from "@remotion/renderer";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
@@ -133,10 +123,12 @@ const bundled = await bundle({
webpackOverride: (config) => config,
});
-const compositions = await getCompositions(bundled);
-const composition = compositions[0];
+const composition = await selectComposition({
+ serveUrl: bundled,
+ id: "MyComp",
+});
-console.log("Starting to render composition", composition.id);
+console.log("Starting to render composition");
await renderMedia({
codec: "h264",
@@ -144,6 +136,7 @@ await renderMedia({
serveUrl: bundled,
outputLocation: `out/${composition.id}.mp4`,
});
+
console.log(`Rendered composition ${composition.id}.`);
```
@@ -166,8 +159,31 @@ docker run remotion-app
In Debian (and also Alpine), old packages are removed from the repositories once new versions are released. This means that pinning the versions will actually cause the Dockerfiles to break in the future. We choose Debian as the distribution because the packages get well tested before they get released into the repository.
+## Notes for older versions
+
+- If you are on Remotion `v4.0.0` or lower, add `ffmpeg` to the list of packages to install:
+
+ ```docker
+ RUN apt-get install -y nodejs ffmpeg npm chromium
+ ```
+
+- If you are on Remotion `v3.3.80` or lower, tell Remotion where Chrome is installed:
+
+ ```docker
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
+ ```
+
+## Recommendation: Don't use Alpine Linux
+
+Alpine Linux is a lightweight distribution often used in Docker. There are two drawbacks for using it in Remotion:
+
+- The launch of the Rust parts of Remotion may be very slow (>10sec slowdown per render)
+- If a new version of Chrome gets released in the registry, you might be unable to downgrade because old versions are not kept and breaking changes can not be ruled out.
+
## Changelog
+**May 30th, 2023**: Update document for Remotion 4.0.
+
**April 15th, 2023**: Unpinning the versions in Debian since it would cause breakage.
**April 3rd, 2023**: Changed the Alpine Docker image to a Debian one, since the versions of Alpine packages cannot be pinned. This makes the Debian one less likely to break.
diff --git a/packages/docs/docs/get-input-props.md b/packages/docs/docs/get-input-props.md
index 309383fbe3..d3bd2a14d1 100644
--- a/packages/docs/docs/get-input-props.md
+++ b/packages/docs/docs/get-input-props.md
@@ -7,7 +7,7 @@ crumb: "API"
_Available from v2.0_.
-Using this method, you can retrieve inputs that you pass in from the command line using [`--props`](/docs/cli), or the [`inputProps`](/docs/ssr#render-a-video-programmatically) parameter if you are using the Node.JS API.
+Using this method, you can retrieve inputs that you pass in from the command line using [`--props`](/docs/cli), or the [`inputProps`](/docs/ssr) parameter if you are using the Node.JS API.
You should whenever possible prefer to retrieve props directly in your composition, like you would read props from a component if you were to code a React application, but this method is useful if you want to retrieve the input props outside of a composition.
diff --git a/packages/docs/docs/renderer/render-media.md b/packages/docs/docs/renderer/render-media.md
index 797fba7a5d..c779e9679c 100644
--- a/packages/docs/docs/renderer/render-media.md
+++ b/packages/docs/docs/renderer/render-media.md
@@ -11,7 +11,7 @@ Render a video or an audio programmatically.
## Example
-See an example of `renderMedia()` together with [`bundle()`](/docs/bundle) and [`getCompositions()`](/docs/renderer/get-compositions) on the [server-side rendering page](/docs/ssr#render-a-video-using-nodejs-apis).
+See an example of `renderMedia()` together with [`bundle()`](/docs/bundle) and [`getCompositions()`](/docs/renderer/get-compositions) on the [server-side rendering page](/docs/ssr).
## Arguments
diff --git a/packages/docs/docs/renderer/render-still.md b/packages/docs/docs/renderer/render-still.md
index 3785bd8c56..c4b43aeb76 100644
--- a/packages/docs/docs/renderer/render-still.md
+++ b/packages/docs/docs/renderer/render-still.md
@@ -15,7 +15,7 @@ If you want to render a video, use [renderMedia()](/docs/renderer/render-media)
## Example usage
-You first need to bundle the project and fetch the compositions. Read [the code snippet on the site for server-side rendering](/docs/ssr/#render-a-video-programmatically) for an example how to come up with the `bundleLocation` and `composition` variables.
+You first need to bundle the project and fetch the compositions. Read [the code snippet on the site for server-side rendering](/docs/ssr) for an example how to come up with the `bundleLocation` and `composition` variables.
```ts twoslash
// @module: ESNext