Skip to content

🎥 Make videos programmatically with React

Updated docs for `--png` flag,changed png-sequence

Shankhadeep Dey1043bb2a7889
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index e9e97be306..c4c7149054 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -6,7 +6,7 @@ export const getFrameFormat = (format: OutputFormat): FrameFormat => {
if (format === 'mp4' || format === 'webm-v8' || format === 'webm-v9') {
return 'jpeg';
}
- if (format === 'png-sequence') {
+ if (format === 'png') {
return 'png';
}
throw new Error('Unrecognized render mode ' + format);
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index c3adfa7166..a4b1b392df 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -23,9 +23,10 @@ export const parseCommandLine = () => {
Config.Rendering.setConcurrency(parsedCli.concurrency);
}
if (parsedCli.png) {
- Config.Output.setOutputFormat('png-sequence');
+ Config.Output.setOutputFormat('png');
+ console.log('--png has been deprecated, use --format=png from now on');
}
- if (parsedCli.format && !parsedCli.png) {
+ if (parsedCli.format) {
Config.Output.setOutputFormat(parsedCli.format);
}
if (typeof parsedCli.overwrite !== 'undefined') {
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index d9c31a0a03..14443dba95 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -57,12 +57,12 @@ export const render = async () => {
) {
await validateFfmpeg();
}
- if (renderMode === 'png-sequence') {
+ if (renderMode === 'png') {
fs.mkdirSync(absoluteOutputFile, {
recursive: true,
});
}
- const steps = renderMode === 'png-sequence' ? 2 : 3;
+ const steps = renderMode === 'png' ? 2 : 3;
process.stdout.write(`📦 (1/${steps}) Bundling video...\n`);
const bundlingProgress = new cliProgress.Bar(
@@ -90,7 +90,7 @@ export const render = async () => {
const {durationInFrames: frames} = config;
const outputDir =
- renderMode === 'png-sequence'
+ renderMode === 'png'
? absoluteOutputFile
: await fs.promises.mkdtemp(
path.join(os.tmpdir(), 'react-motion-render')
@@ -152,5 +152,5 @@ export const render = async () => {
} else {
console.log('\n▶️ Your PNG sequence is ready!');
}
- console.log(absoluteOutputFile);
+ console.log(absoluteOutputFileWithExtension());
};
diff --git a/packages/core/src/config/index.ts b/packages/core/src/config/index.ts
index 54149e8572..8580a1e75d 100644
--- a/packages/core/src/config/index.ts
+++ b/packages/core/src/config/index.ts
@@ -45,7 +45,7 @@ export const Config = {
*/
setPixelFormat,
/**
- * Specify what kind of output you, want, either 'mp4' or 'png-sequence'.
+ * Specify what kind of output you, want, either 'mp4' or 'png'.
* Default: 'mp4'
*/
setOutputFormat,
diff --git a/packages/core/src/config/render-mode.ts b/packages/core/src/config/render-mode.ts
index e7f8784898..7cb924dd3d 100644
--- a/packages/core/src/config/render-mode.ts
+++ b/packages/core/src/config/render-mode.ts
@@ -1,4 +1,4 @@
-const validRenderModes = ['png-sequence', 'mp4', 'webm-v8', 'webm-v9'] as const;
+const validRenderModes = ['png', 'mp4', 'webm-v8', 'webm-v9'] as const;
export type OutputFormat = typeof validRenderModes[number];
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index c0f0c9d422..e56b243ceb 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -16,12 +16,20 @@ Besides choosing a video and output location with the command line arguments, th
- `--props`: React Props to pass to the root component of your video. Must be a serialized JSON string.
- `--concurrency`: [How many CPU threads to use.](config#setconcurrency) Minimum 1. The maximum is the amount of threads you have.
- `--png`: [Render a PNG sequence with transparency instead.](config#setoutputformat) If you use this option, the output location you pass must be a folder name. It will override `--format` flag.
+
+:::warning
+`--png` will be deprecated in thee upcoming major version release. Use `--format=png` instead of `--png` flag.
+:::
+
- `--pixel-format`: [Set a custom pixel format. See here for available values.](config#setpixelformat)
- `--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` or `png-sequence` or `webm-v8` or `webm-v9`](config#setoutputformat). You can use `--format png-sequence` instead of `--png` flag.
+- `--format`: [Either `mp4` or `png` or `webm-v8` or `webm-v9`](config#setoutputformat). If you don't supply `--format` flag `--format=mp4` is the default behaviour.
+:::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 b3ab37cbc2..62ff9234f6 100644
--- a/packages/docs/docs/config.md
+++ b/packages/docs/docs/config.md
@@ -67,10 +67,10 @@ The [command line flag](cli) `--pixel-format` will take precedene over this opti
### setOutputFormat()
-Either `'mp4'` or `'png-sequence'` or `'webm-v8'` or `'webm-v9'`. Use the PNG sequence option if you want transparency in your output.
+Either `'mp4'` or `'png'` or `'webm-v8'` or `'webm-v9'`. Use the PNG sequence option if you want transparency in your output.
```tsx
-Config.output.setOutputFormat('png-sequence');
+Config.output.setOutputFormat('png');
```
The [command line flag](cli) `--png` and `--format` will take precedence over this option.