Skip to content

🎥 Make videos programmatically with React

clues for people who don't know how to upgrade

Jonny Burger98bc36fc6235
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index 235da29945..3df8c8587f 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -236,6 +236,10 @@ declare global {
* @deprecated Renamed to `setJpegQuality`.
*/
readonly setQuality: (q: never) => void;
+ /**
+ * @deprecated Separated into `setStillImageFormat()` and `setVideoImageFormat()`.
+ */
+ readonly setImageFormat: (q: never) => void;
/**
* Set the JPEG quality for the frames.
* Must be between 0 and 100.
@@ -407,6 +411,11 @@ export const Config: FlatConfig = {
'setQuality() has been renamed - use setJpegQuality() instead.'
);
},
+ setImageFormat: () => {
+ throw new Error(
+ 'setImageFormat() has been renamed - use setVideoImageFormat() or setStillImageFormat() instead.'
+ );
+ },
setJpegQuality,
setStillImageFormat,
setVideoImageFormat,
@@ -428,7 +437,6 @@ export const Config: FlatConfig = {
overrideHeight,
overrideWidth,
overrideFfmpegCommand: setFfmpegOverrideFunction,
- // Options added after migration
setAudioCodec,
};
diff --git a/packages/docs/docs/4-0-migration.md b/packages/docs/docs/4-0-migration.md
index c2270b9404..579991e4e8 100644
--- a/packages/docs/docs/4-0-migration.md
+++ b/packages/docs/docs/4-0-migration.md
@@ -92,9 +92,15 @@ FFmpeg is now baked into the `@remotion/renderer` package. Therefore, the `ffmpe
In V3, `onSlowestFrames` has been a callback function that you could pass to `renderMedia()`.
In V4, this data has been moved to the [return value](/docs/renderer/render-media#return-value).
-## Config.setImageFormat() distinction
+## Separating `ImageFormat`
-`Config.setImageFormat` got replaced by `config.setVideoImageFormat`and `config.setStillImageFormat`. This distinction is made since it often makes sense to have the `VideoImageFormat` set to JPEG and the `StillImageFormat` to PNG.
+Previously, the `imageFormat` option would be used for both stills and videos. While for stills, PNG is often preferrable, for videos it is overall faster to use JPEG as a default. In Remotion 4.0, the image formats are being separated so you can set defaults for videos and stills separately.
+
+- `Config.setImageFormat` got replaced by [`Config.setVideoImageFormat`]() and `Config.setStillImageFormat`.
+- The CLI option is still `--image-format` for all commands.
+- The Node.JS API name is still `imageFormat`.
+- The TypeScript type `ImageFormat` has been separated into `StillImageFormat` and `VideoImageFormat`.
+- `StillImageFormat` now also supports `webp` and `pdf`!
## ImageFormat removed
diff --git a/packages/renderer/src/image-format.ts b/packages/renderer/src/image-format.ts
index 84288bb268..71fe686349 100644
--- a/packages/renderer/src/image-format.ts
+++ b/packages/renderer/src/image-format.ts
@@ -8,6 +8,11 @@ export const validStillImageFormats = ['png', 'jpeg', 'pdf', 'webp'] as const;
export type VideoImageFormat = typeof validVideoImageFormats[number];
export type StillImageFormat = typeof validStillImageFormats[number];
+/**
+ * @deprecated Use VideoImageFormat or StillImageFormat instead
+ */
+export type ImageFormat =
+ 'This type is deprecated, use VideoImageFormat or StillImageFormat instead';
export const DEFAULT_VIDEO_IMAGE_FORMAT: VideoImageFormat = 'jpeg';
export const DEFAULT_STILL_IMAGE_FORMAT: StillImageFormat = 'png';
diff --git a/packages/renderer/src/index.ts b/packages/renderer/src/index.ts
index 622933c507..ebe6cffe39 100644
--- a/packages/renderer/src/index.ts
+++ b/packages/renderer/src/index.ts
@@ -83,6 +83,7 @@ export {getCanExtractFramesFast} from './get-can-extract-frames-fast';
export {getCompositions} from './get-compositions';
export {getActualConcurrency} from './get-concurrency';
export {
+ ImageFormat,
StillImageFormat,
validateSelectedPixelFormatAndImageFormatCombination,
VideoImageFormat,