🎥 Make videos programmatically with React
finish
Jonny Burger7135e7e55f1d
diff --git a/packages/docs/docs/miscellaneous/cloud-gpu-docker.md b/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdnew file mode 100644index 0000000000..ddeee1326f--- /dev/null+++ b/packages/docs/docs/miscellaneous/cloud-gpu-docker.md@@ -0,0 +1,102 @@+---+image: /generated/articles-docs-miscellaneous-cloud-gpu-docker.png+title: Setup EC2 for Docker with GPU+sidebar_label: GPU in the cloud (Docker)+crumb: "FAQ"+---++Follow these steps to render videos on EC2 in a Docker container.+These steps are opinionated, but specify a reference that works.++## Setup EC2 for Docker with GPU++<Step>1</Step> Follow the instructions for <a href="/docs/miscellaneous/cloud-gpu">GPUs on EC2</a>. You can skip installing Chrome, Node.js and cloning the repo to render a video.<br />++<Step>2</Step> Install NVIDIA Container toolkit:<br /><br />++```bash title="Add keyring"+curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg+curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list+sudo apt-get update+```++```bash title="Install toolkit"+sudo apt-get install -y nvidia-container-toolkit+```++<Step>3</Step>Install Docker: <br /><br />++```bash title="Add Docker's official GPG key"+sudo apt-get update+sudo apt-get install ca-certificates curl gnupg+sudo install -m 0755 -d /etc/apt/keyrings+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg+sudo chmod a+r /etc/apt/keyrings/docker.gpg+```++```bash title="Add keyring"+echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null+sudo apt-get update+```++```bash title="Install Docker"+sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin+```++<Step>4</Step>Configure Docker to use the NVIDIA runtime <br /><br />++```bash title="Configure the NVIDIA container runtime"+sudo nvidia-ctk runtime configure --runtime=docker+sudo systemctl restart docker+```++<Step>5</Step> Create two files, <code>Dockerfile</code> and <code>entrypoint.sh</code>. You can for example create them using the <code>nano ./file-to-create</code> command. Use <kbd>Ctrl</kbd><kbd>X</kbd> to save and quit. <br/><br/>++```bash title="Dockerfile"+FROM node:20-bookworm+RUN apt-get update+RUN apt-get install -y curl gnupg git chromium+RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg+RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" > /etc/apt/sources.list.d/nodesource.list+RUN apt-get clean+RUN rm -rf /var/lib/apt/lists/*++# Clone the repo+RUN git clone https://github.com/remotion-dev/gpu-scene.git+WORKDIR /gpu-scene+RUN npm install++# Copy the entrypoint script into the image+COPY entrypoint.sh .++CMD ["sh", "./entrypoint.sh"]+```++```bash title="entrypoint.sh"+#!/bin/bash++npx remotion render --gl=angle-egl Scene out/video.mp4+```++<Step>6</Step> Build the container and run a sample render: <br/><br/>++```bash+sudo docker build . -t remotion-docker-gpu+sudo docker run --gpus all --runtime=nvidia -e "NVIDIA_DRIVER_CAPABILITIES=all" remotion-docker-gpu+```++## See also++- [GPUs on EC2](/docs/miscellaneous/cloud-gpu)+- [Using the GPU](/docs/gpu)++<Credits contributors={[+{+username: "UmungoBungo",+contribution: "Workflow author"+},+{+username: "kaf-lamed-beyt",+contribution: "Writeup"+},+]} />diff --git a/packages/docs/docs/miscellaneous/cloud-gpu.md b/packages/docs/docs/miscellaneous/cloud-gpu.mdindex 52f84a9095..f2f01ad0c8 100644--- a/packages/docs/docs/miscellaneous/cloud-gpu.md+++ b/packages/docs/docs/miscellaneous/cloud-gpu.md@@ -1,6 +1,6 @@---image: /generated/articles-docs-miscellaneous-cloud-gpu.png-sidebar_label: GPU in the cloud+sidebar_label: GPU in the cloud (bare)title: Using the GPU in the cloudcrumb: "FAQ"---diff --git a/packages/docs/docs/miscellaneous/ec2-docker-gpu.md b/packages/docs/docs/miscellaneous/ec2-docker-gpu.mddeleted file mode 100644index 68f3a9deec..0000000000--- a/packages/docs/docs/miscellaneous/ec2-docker-gpu.md+++ /dev/null@@ -1,104 +0,0 @@-----image: /generated/articles-docs-miscellaneous-ec2-docker-gpu.png-title: Setup EC2 for Docker with GPU-sidebar_label: EC2 GPU with Docker-crumb: "FAQ"------Follow these Steps to setup EC2 GPU with Docker. Start with the instructions [here](https://www.remotion.dev/docs/miscellaneous/cloud-gpu), first.--## Setup EC2 for Docker with GPU--<Step>1</Step> Install NVIDIA container toolkit<br />--```bash-curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \- && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \- sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \- sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \- && \- sudo apt-get update-```--```bash-sudo apt-get install -y nvidia-container-toolkit-```--<Step>2</Step>Install Docker <br />--```bash-# Add Docker's official GPG key:-sudo apt-get update-sudo apt-get install ca-certificates curl gnupg-sudo install -m 0755 -d /etc/apt/keyrings-curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg-sudo chmod a+r /etc/apt/keyrings/docker.gpg--# Add the repository to Apt sources:-echo \- "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \- "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \- sudo tee /etc/apt/sources.list.d/docker.list > /dev/null-sudo apt-get update-```--```bash-sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin-```--<Step>3</Step> Configure container runtime <br />--```bash-sudo nvidia-ctk runtime configure --runtime=docker-```--```bash-sudo systemctl restart docker-```--## Files--This makes use of https://github.com/UmungoBungo/remotion-gpu-test.git--It includes `entrypoint.sh`, which will run the render command and upload the output file to [transfer.sh](https://transfer.sh/). `entrypoint.sh` will need to co-located with the dockerfile on the instance.--## Dockerfile.example--```bash-FROM node:20-bookworm-RUN apt-get update-RUN apt-get install -y curl gnupg git chromium-RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg-RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" > /etc/apt/sources.list.d/nodesource.list-RUN apt-get clean-RUN rm -rf /var/lib/apt/lists/*--# Clone the repo-RUN git clone https://github.com/remotion-dev/gpu-scene.git-WORKDIR /gpu-scene-RUN npm install--# Copy the entrypoint script into the image-COPY entrypoint.sh .--CMD ["sh", "./entrypoint.sh"]-```--## entrypoint.sh--```bash-#!/bin/bash--# Run the render-angle command-npx remotion render --gl=angle-egl Scene out/video.mp4--# Upload the file once rendering is finished-curl --upload-file ./out/video.mp4 https://transfer.sh/angle.mp4-```--## Run dockerfile--```bash-sudo docker build . -t remotion-docker-gpu-sudo docker run --gpus all --runtime=nvidia -e "NVIDIA_DRIVER_CAPABILITIES=all" remotion-docker-gpu-```diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex cb57696fff..7ce2e3b4f6 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -541,7 +541,7 @@ module.exports = {"miscellaneous/linux-single-process","gpu","miscellaneous/cloud-gpu",- "miscellaneous/ec2-docker-gpu",+ "miscellaneous/cloud-gpu-docker",],},{diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex db39bf7f53..00046fbadc 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -1511,6 +1511,13 @@ export const articles = [compId: "articles-docs-miscellaneous-changing-temp-dir",crumb: "Advanced configuration",},+ {+ id: "miscellaneous/cloud-gpu-docker",+ title: "Setup EC2 for Docker with GPU",+ relativePath: "docs/miscellaneous/cloud-gpu-docker.md",+ compId: "articles-docs-miscellaneous-cloud-gpu-docker",+ crumb: "FAQ",+ },{id: "miscellaneous/cloud-gpu",title: "Using the GPU in the cloud",@@ -1518,13 +1525,6 @@ export const articles = [compId: "articles-docs-miscellaneous-cloud-gpu",crumb: "FAQ",},- {- id: "miscellaneous/ec2-docker-gpu",- title: "Setup EC2 for Docker with GPU",- relativePath: "docs/miscellaneous/ec2-docker-gpu.md",- compId: "articles-docs-miscellaneous-ec2-docker-gpu",- crumb: "FAQ",- },{id: "embed-studio",title: "Can I embed the Remotion Studio?",diff --git a/packages/docs/static/generated/articles-docs-miscellaneous-cloud-gpu-docker.png b/packages/docs/static/generated/articles-docs-miscellaneous-cloud-gpu-docker.pngnew file mode 100644index 0000000000..853ac3add1Binary files /dev/null and b/packages/docs/static/generated/articles-docs-miscellaneous-cloud-gpu-docker.png differdiff --git a/packages/docs/static/generated/articles-docs-miscellaneous-ec2-docker-gpu.png b/packages/docs/static/generated/articles-docs-miscellaneous-ec2-docker-gpu.pngdeleted file mode 100644index ec13f11bbe..0000000000Binary files a/packages/docs/static/generated/articles-docs-miscellaneous-ec2-docker-gpu.png and /dev/null differ