Skip to content

🎥 Make videos programmatically with React

improve image format, keep png-sequence behavior

Jonny Burger2e362c17341b
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index 5150d301bb..3076d66dfe 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -1,6 +1,8 @@
-import {Codec, ImageFormat, Internals} from 'remotion';
+import {ImageFormat, Internals} from 'remotion';
-export const getImageFormat = (codec: Codec): ImageFormat => {
+export const getImageFormat = (
+ codec: ReturnType<typeof Internals.getOutputCodecOrUndefined>
+): ImageFormat => {
const userPreferred = Internals.getUserPreferredImageFormat();
if (typeof userPreferred !== 'undefined') {
@@ -14,7 +16,7 @@ export const getImageFormat = (codec: Codec): ImageFormat => {
) {
return 'jpeg';
}
- if (codec === 'png') {
+ if (codec === undefined) {
return 'png';
}
throw new Error('Unrecognized codec ' + codec);
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index e56a8012d0..8790164bd8 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -93,7 +93,9 @@ export const render = async () => {
Internals.validateSelectedCrfAndCodecCombination(crf, codec);
}
const pixelFormat = Internals.getPixelFormat();
- const imageFormat = getImageFormat(codec);
+ const imageFormat = getImageFormat(
+ shouldOutputImageSequence ? undefined : codec
+ );
Internals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
Internals.validateSelectedPixelFormatAndImageFormatCombination(