Skip to content

🎥 Make videos programmatically with React

imageformats

Jonny Burger2130c8afd320
diff --git a/packages/cli/src/get-filename.ts b/packages/cli/src/get-filename.ts
index f04b205e11..d1c1e4ea28 100644
--- a/packages/cli/src/get-filename.ts
+++ b/packages/cli/src/get-filename.ts
@@ -17,7 +17,7 @@ export const getOutputFilename = (
extension = 'mp4';
}
if (codec === 'vp8' || codec === 'vp9') {
- console.info('No file extension specified, adding .webm automatically');
+ console.info('No file extension specified, adding .webm automatically.');
filename += '.webm';
extension = 'webm';
}
@@ -30,7 +30,7 @@ export const getOutputFilename = (
}
if (codec === 'h265') {
if (extension !== 'mp4' && extension !== 'hevc') {
- console.error('The output filename must end in .mp4 or .hevc');
+ console.error('The output filename must end in .mp4 or .hevc.');
process.exit(1);
}
}
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index 535b7cc580..8c538f59d2 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -1,8 +1,8 @@
import {Codec} from 'remotion';
-export type FrameFormat = 'png' | 'jpeg';
+export type ImageFormat = 'png' | 'jpeg';
-export const getFrameFormat = (format: Codec): FrameFormat => {
+export const getImageFormat = (format: Codec): ImageFormat => {
if (
format === 'h264' ||
format === 'h265' ||
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 47bbfd005c..f7449bd919 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -1,6 +1,5 @@
import minimist from 'minimist';
-import {Config, PixelFormat} from 'remotion';
-import {CodecOrUndefined} from 'remotion/dist/config/codec';
+import {Codec, Config, PixelFormat} from 'remotion';
export type CommandLineOptions = {
pixelFormat: PixelFormat;
@@ -9,9 +8,9 @@ export type CommandLineOptions = {
config: string;
png: boolean;
sequence: boolean;
- quality: number | undefined;
+ quality: number;
force: boolean;
- codec: CodecOrUndefined;
+ codec: Codec;
props: string;
};
@@ -26,10 +25,10 @@ export const parseCommandLine = () => {
}
if (parsedCli.png) {
console.warn('The --png flag has been renamed to --sequence.');
- Config.Output.setImageSequence(parsedCli.png);
+ Config.Output.setImageSequence(true);
}
if (parsedCli.sequence) {
- Config.Output.setImageSequence(parsedCli.sequence);
+ Config.Output.setImageSequence(true);
}
if (parsedCli.codec) {
Config.Output.setCodec(parsedCli.codec);
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 9eeffca490..1b296cf9f1 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -16,7 +16,7 @@ import {getCompositionId} from './get-composition-id';
import {getConfigFileName} from './get-config-file-name';
import {getOutputFilename} from './get-filename';
import {getUserProps} from './get-user-props';
-import {getFrameFormat} from './image-formats';
+import {getImageFormat} from './image-formats';
import {loadConfigFile} from './load-config';
import {parseCommandLine} from './parse-command-line';
import {getUserPassedFileExtension} from './user-passed-output-location';
@@ -100,6 +100,7 @@ export const render = async () => {
},
cliProgress.Presets.shades_grey
);
+ const imageFormat = getImageFormat(codec);
await renderFrames({
config,
onFrameUpdate: (f) => renderProgress.update(f),
@@ -116,7 +117,7 @@ export const render = async () => {
},
userProps,
webpackBundle: bundled,
- imageFormat: getFrameFormat(codec),
+ imageFormat,
quality,
});
renderProgress.stop();
@@ -132,7 +133,7 @@ export const render = async () => {
fps: config.fps,
outputLocation: absoluteOutputFile,
force: overwrite,
- imageFormat: getFrameFormat(codec),
+ imageFormat,
pixelFormat: Internals.getPixelFormat(),
outputFormat: codec,
});