Skip to content

🎥 Make videos programmatically with React

documentation

Jonny Burgerd218fdc3a1c7
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index c9baa67674..30b445901a 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -7,6 +7,7 @@ import {
Internals,
LogLevel,
PixelFormat,
+ ProResProfile,
} from 'remotion';
import {Log} from './log';
@@ -14,6 +15,7 @@ export type CommandLineOptions = {
['browser-executable']: BrowserExecutable;
['pixel-format']: PixelFormat;
['image-format']: ImageFormat;
+ ['prores-profile']: ProResProfile;
['bundle-cache']: string;
['env-file']: string;
codec: Codec;
@@ -93,6 +95,10 @@ export const parseCommandLine = () => {
Config.Output.setCodec(parsedCli.codec);
}
+ if (parsedCli['prores-profile']) {
+ Config.Output.setProResProfile(parsedCli['prores-profile']);
+ }
+
if (typeof parsedCli.overwrite !== 'undefined') {
Config.Output.setOverwriteOutput(parsedCli.overwrite);
}
diff --git a/packages/core/src/config/index.ts b/packages/core/src/config/index.ts
index 5cf52d5aa3..a079d6ff1d 100644
--- a/packages/core/src/config/index.ts
+++ b/packages/core/src/config/index.ts
@@ -121,8 +121,9 @@ export const Config = {
setImageSequence,
/**
* Set the ProRes profile.
- * This method is only valid if the codec has been set to 'ProRes'.
- * Possible values: 4444-xq, 4444, hq, standard, light, proxy
+ * This method is only valid if the codec has been set to 'prores'.
+ * Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
+ * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
*/
setProResProfile,
},
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index 78251659ee..40cd39d92f 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -55,7 +55,11 @@ Specify a location for a dotenv file. Default `.env`. Available in v2.2 and late
### `--codec`
-[`h264` or `h265` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder. Available since v1.4.
+[`h264` or `h265` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav` or `prores`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder. Available since v1.4.
+
+### `--prores-profile`
+
+[Set the ProRes profile](/docs/config#setproresprofile). This option is only valid if the codec has been set to `prores`. Possible values: `4444-xq`, `4444`, `hq`, `standard`, `light`, `proxy`. See [here](https://avpres.net/FFmpeg/im_ProRes.html) for explanation of possible values. Default: `hq`. Available since v2.1.6.
### `--crf`
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index 545438a0b7..d51df59936 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -205,9 +205,20 @@ Choose one of the supported codecs: `h264` _(default)_, `h265`, `vp8`, `vp9`.
Config.Output.setCodec('h265');
```
-The [command line flag](/docs/cli#--codec) `--codec` will take precedence over this option.
+### setProResProfile()
-**See also**: [Encoding guide](/docs/encoding)
+_Available from Version 2.1.6._
+
+Set the ProRes profile. This option is only valid if the codec has been set to `prores`. Possible values: `4444-xq`, `4444`, `hq`, `standard`, `light`, `proxy`. See [here](https://avpres.net/FFmpeg/im_ProRes.html) for explanation of possible values.
+Default: `hq`
+
+```tsx
+Config.Output.setProResProfile('4444');
+```
+
+The [command line flag](/docs/cli#--prores-profile) `--prores-profile` will take precedence over this option.
+
+**See also**: [Encoding guide](/docs/encoding), [Transparent videos](/docs/transparent-videos)
### setImageSequence()
diff --git a/packages/docs/docs/transparent-videos.mdx b/packages/docs/docs/transparent-videos.mdx
index 3bf753faed..f6af2425bf 100644
--- a/packages/docs/docs/transparent-videos.mdx
+++ b/packages/docs/docs/transparent-videos.mdx
@@ -11,7 +11,7 @@ If you are lucky enough to visit the website in one of those supported web brows
<TransparentVideoDemo />
-## Creating a video with Alpha channel
+## Creating a WebM with Alpha channel
In order to create a transparent video, you need at least version 1.4 of Remotion. Make sure to not set any background (use the checkerboard button to ensure your video is transparent). In order to render your videos transparent, you need to change 3 settings:
@@ -35,6 +35,25 @@ You can also set the settings on the command line:
--image-format=png --pixel-format=yuva420p --codec=vp8
```
+## Creating a ProRes with Alpha channels
+
+If you want to export a transparent video for use in another video editing program, and you are using macOS, ProRes is a more suitable option.
+
+Supported since v2.1.6, you can set the codec to `prores` and choose a ProRes profile with alpha support: Either: `4444` or `4444-hq`.
+
+```tsx
+import {Config} from 'remotion';
+
+Config.Output.setCodec('prores');
+Config.Output.setProResProfile('4444');
+```
+
+You can also set the settings on the command line:
+
+```console
+--codec=prores --prores-profile=4444
+```
+
## Creating a fallback version
Given the poor browser support, consider making two versions of a video, one with alpha channel, and an opaque video as a fallback. You can achieve this in Remotion using standard React props:
diff --git a/packages/renderer/src/get-pro-res-profile-name.ts b/packages/renderer/src/get-prores-profile-name.ts
similarity index 73%
rename from packages/renderer/src/get-pro-res-profile-name.ts
rename to packages/renderer/src/get-prores-profile-name.ts
index 6801fa0a96..652d77663f 100644
--- a/packages/renderer/src/get-pro-res-profile-name.ts
+++ b/packages/renderer/src/get-prores-profile-name.ts
@@ -1,8 +1,13 @@
-import {ProResProfile} from 'remotion';
+import {Codec, ProResProfile} from 'remotion';
export const getProResProfileName = (
+ codec: Codec,
proResProfile: ProResProfile | undefined
): string | null => {
+ if (codec !== 'prores') {
+ return null;
+ }
+
switch (proResProfile) {
case '4444-xq':
return '5';
@@ -17,6 +22,6 @@ export const getProResProfileName = (
case 'proxy':
return '0';
default:
- return null;
+ return '3';
}
};
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.ts
index a925c9bd28..765a530037 100644
--- a/packages/renderer/src/stitcher.ts
+++ b/packages/renderer/src/stitcher.ts
@@ -16,7 +16,7 @@ import {createFfmpegComplexFilter} from './create-ffmpeg-complex-filter';
import {getAudioCodecName} from './get-audio-codec-name';
import {getCodecName} from './get-codec-name';
import {getFrameInfo} from './get-frame-number-length';
-import {getProResProfileName} from './get-pro-res-profile-name';
+import {getProResProfileName} from './get-prores-profile-name';
import {DEFAULT_IMAGE_FORMAT} from './image-format';
import {parseFfmpegProgress} from './parse-ffmpeg-progress';
import {resolveAssetSrc} from './resolve-asset-src';