Skip to content

🎥 Make videos programmatically with React

update docs

Jonny Burger034cc248ad84
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 9b41ba1a3c..fc73b0ee74 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -10,7 +10,7 @@ export type CommandLineOptions = {
png: boolean;
quality: number | undefined;
force: boolean;
- format: CodecOrUndefined;
+ codec: CodecOrUndefined;
props: string;
};
@@ -24,11 +24,12 @@ export const parseCommandLine = () => {
Config.Rendering.setConcurrency(parsedCli.concurrency);
}
if (parsedCli.png) {
+ // TODO: Make this a separate flag
Config.Output.setOutputFormat('png');
- console.warn('--png has been deprecated. Use --format=png instead.');
+ console.warn('--png has been deprecated. Use --codec=png instead.');
}
- if (parsedCli.format) {
- Config.Output.setOutputFormat(parsedCli.format);
+ if (parsedCli.codec) {
+ Config.Output.setOutputFormat(parsedCli.codec);
}
if (typeof parsedCli.overwrite !== 'undefined') {
Config.Output.setOverwriteOutput(parsedCli.overwrite);
diff --git a/packages/core/src/config/codec.ts b/packages/core/src/config/codec.ts
index fc8a79e11b..3e2acb21a7 100644
--- a/packages/core/src/config/codec.ts
+++ b/packages/core/src/config/codec.ts
@@ -3,14 +3,14 @@ const validRenderModes = ['png', 'h264', 'h265', 'vp8', 'vp9'] as const;
export type Codec = typeof validRenderModes[number];
export type CodecOrUndefined = Codec | undefined;
-let format: CodecOrUndefined = undefined;
+let codec: CodecOrUndefined = undefined;
export const getOutputCodecOrUndefined = (): CodecOrUndefined => {
- return format;
+ return codec;
};
export const getFinalOutputCodec = ({
- codec,
+ codec: inputCodec,
fileExtension,
emitWarning,
}: {
@@ -18,7 +18,7 @@ export const getFinalOutputCodec = ({
fileExtension: string | null;
emitWarning: boolean;
}): Codec => {
- if (codec === undefined && fileExtension === 'webm') {
+ if (inputCodec === undefined && fileExtension === 'webm') {
if (emitWarning) {
console.info(
'You have specified a .webm extension, using the VP8 encoder. Use --codec=vp9 to use the Vp9 encoder.'
@@ -26,7 +26,7 @@ export const getFinalOutputCodec = ({
}
return 'vp8';
}
- if (codec === undefined && fileExtension === 'hevc') {
+ if (inputCodec === undefined && fileExtension === 'hevc') {
if (emitWarning) {
console.info(
'You have specified a .hevc extension, using it using H265 encoder.'
@@ -34,12 +34,12 @@ export const getFinalOutputCodec = ({
}
return 'h265';
}
- return codec ?? 'h264';
+ return inputCodec ?? 'h264';
};
export const setOutputFormat = (newRenderMode: CodecOrUndefined) => {
if (newRenderMode === undefined) {
- format = undefined;
+ codec = undefined;
return;
}
if (!validRenderModes.includes(newRenderMode)) {
@@ -49,5 +49,5 @@ export const setOutputFormat = (newRenderMode: CodecOrUndefined) => {
)}, but got ${newRenderMode}`
);
}
- format = newRenderMode;
+ codec = newRenderMode;
};
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index 9f85e56710..e27a988b25 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -19,11 +19,8 @@ Besides choosing a video and output location with the command line arguments, th
- `--config`: Specify a location for the Remotion config file.
- `--quality`: [Value between 0 and 100 for JPEG rendering quality](config#setquality). Doesn't work when `--png` is set.
- `--overwrite`: [Write to output even if file already exists.](config#setoverwriteoutput)
-- `--format`: [Either `mp4`(is an alias for 'h264') or 'h264' or 'h265' or `png` or `vp8` or `vp9`](config#setoutputformat). If you don't supply `--format` flag `--format=mp4` is the default behaviour which uses the default h264 codec.
+- `--codec`: ['h264' or 'h265' or `png` or `vp8` or `vp9`](config#setoutputformat). If you don't supply `--codec`, it will use the H.264 encoder.
-:::info
-If you supply `--png` and `--format` flag both, `--format` flag will take precedence over `--png` flag.
-:::
:::info
If you don't feel like passing command line flags every time, consider creating a `remotion.config.ts` [config file](config).
:::
diff --git a/packages/docs/docs/config.md b/packages/docs/docs/config.md
index 9368a033f1..a15ae0adca 100644
--- a/packages/docs/docs/config.md
+++ b/packages/docs/docs/config.md
@@ -67,13 +67,13 @@ The [command line flag](cli) `--pixel-format` will take precedene over this opti
### setOutputFormat()
-Either `'mp4'` or `'h264'` or `'h265'` or `'png'` or `'vp8'` or `'vp9'`. Use the PNG sequence option if you want transparency in your output.
+Either `'h264'` or `'h265'` `or` 'vp8'`or`'vp9'`.
```tsx
-Config.output.setOutputFormat('png');
+Config.output.setOutputFormat('h265');
```
-The [command line flag](cli) `--png` and `--format` will take precedence over this option.
+The [command line flag](cli) `--png` and `--codec` will take precedence over this option.
### setQuality()