Skip to content

🎥 Make videos programmatically with React

Add `defaultProResFornat` as an option

JonnyBurgerd4906225b09f
diff --git a/packages/core/src/Composition.tsx b/packages/core/src/Composition.tsx
index cec45780cb..aa133d0931 100644
--- a/packages/core/src/Composition.tsx
+++ b/packages/core/src/Composition.tsx
@@ -19,6 +19,7 @@ import {Loading} from './loading-indicator.js';
import {useNonce} from './nonce.js';
import {portalNode} from './portal-node.js';
import type {InferProps, PropsIfHasProps} from './props-if-has-props.js';
+import type {ProResProfile} from './prores-profile.js';
import type {PixelFormat, VideoImageFormat} from './render-types.js';
import {useDelayRender} from './use-delay-render.js';
import {useLazyComponent} from './use-lazy-component.js';
@@ -47,6 +48,7 @@ export type CalcMetadataReturnType<T extends Record<string, unknown>> = {
defaultOutName?: string;
defaultVideoImageFormat?: VideoImageFormat;
defaultPixelFormat?: PixelFormat;
+ defaultProResProfile?: ProResProfile;
};
export type CalculateMetadataFunction<T extends Record<string, unknown>> =
diff --git a/packages/core/src/CompositionManagerContext.tsx b/packages/core/src/CompositionManagerContext.tsx
index ae962b0abd..b33c980c38 100644
--- a/packages/core/src/CompositionManagerContext.tsx
+++ b/packages/core/src/CompositionManagerContext.tsx
@@ -16,6 +16,7 @@ export type BaseMetadata = Pick<
| 'defaultOutName'
| 'defaultVideoImageFormat'
| 'defaultPixelFormat'
+ | 'defaultProResProfile'
>;
export type CanvasContent =
diff --git a/packages/core/src/ResolveCompositionConfig.tsx b/packages/core/src/ResolveCompositionConfig.tsx
index e861772565..e7262b6658 100644
--- a/packages/core/src/ResolveCompositionConfig.tsx
+++ b/packages/core/src/ResolveCompositionConfig.tsx
@@ -489,6 +489,7 @@ export const useResolvedVideoConfig = (
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
};
}
diff --git a/packages/core/src/resolve-video-config.ts b/packages/core/src/resolve-video-config.ts
index bee946c12e..d5fc043c4f 100644
--- a/packages/core/src/resolve-video-config.ts
+++ b/packages/core/src/resolve-video-config.ts
@@ -68,6 +68,7 @@ const validateCalculated = ({
const defaultOutName = calculated?.defaultOutName;
const defaultVideoImageFormat = calculated?.defaultVideoImageFormat;
const defaultPixelFormat = calculated?.defaultPixelFormat;
+ const defaultProResProfile = calculated?.defaultProResProfile;
return {
width,
@@ -78,6 +79,7 @@ const validateCalculated = ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
};
};
@@ -131,6 +133,7 @@ export const resolveVideoConfig = ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
} = validateCalculated({
calculated: c,
compositionDurationInFrames,
@@ -151,6 +154,7 @@ export const resolveVideoConfig = ({
defaultOutName: defaultOutName ?? null,
defaultVideoImageFormat: defaultVideoImageFormat ?? null,
defaultPixelFormat: defaultPixelFormat ?? null,
+ defaultProResProfile: defaultProResProfile ?? null,
};
});
}
@@ -174,6 +178,7 @@ export const resolveVideoConfig = ({
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
};
}
@@ -188,6 +193,7 @@ export const resolveVideoConfig = ({
defaultOutName: calculatedProm.defaultOutName ?? null,
defaultVideoImageFormat: calculatedProm.defaultVideoImageFormat ?? null,
defaultPixelFormat: calculatedProm.defaultPixelFormat ?? null,
+ defaultProResProfile: calculatedProm.defaultProResProfile ?? null,
};
};
diff --git a/packages/core/src/test/use-media-in-timeline.test.tsx b/packages/core/src/test/use-media-in-timeline.test.tsx
index a3acf592c2..9bf12446b8 100644
--- a/packages/core/src/test/use-media-in-timeline.test.tsx
+++ b/packages/core/src/test/use-media-in-timeline.test.tsx
@@ -33,6 +33,7 @@ beforeAll(() => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
}));
});
afterAll(() => {
diff --git a/packages/core/src/use-unsafe-video-config.ts b/packages/core/src/use-unsafe-video-config.ts
index edc86d8135..5d8287301b 100644
--- a/packages/core/src/use-unsafe-video-config.ts
+++ b/packages/core/src/use-unsafe-video-config.ts
@@ -27,6 +27,7 @@ export const useUnsafeVideoConfig = (): VideoConfig | null => {
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
} = video;
return {
@@ -41,6 +42,7 @@ export const useUnsafeVideoConfig = (): VideoConfig | null => {
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
};
}, [ctxDuration, ctxHeight, ctxWidth, video]);
};
diff --git a/packages/core/src/video-config.ts b/packages/core/src/video-config.ts
index 3eb2848157..1a0a9bed67 100644
--- a/packages/core/src/video-config.ts
+++ b/packages/core/src/video-config.ts
@@ -1,4 +1,5 @@
import type {Codec} from './codec';
+import type {ProResProfile} from './prores-profile';
import type {PixelFormat, VideoImageFormat} from './render-types';
export type VideoConfig = {
@@ -13,4 +14,5 @@ export type VideoConfig = {
defaultOutName: string | null;
defaultVideoImageFormat: VideoImageFormat | null;
defaultPixelFormat: PixelFormat | null;
+ defaultProResProfile: ProResProfile | null;
};
diff --git a/packages/docs/docs/4-0-migration.mdx b/packages/docs/docs/4-0-migration.mdx
index fd35183d33..12dd7bb198 100644
--- a/packages/docs/docs/4-0-migration.mdx
+++ b/packages/docs/docs/4-0-migration.mdx
@@ -329,6 +329,7 @@ const composition = {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
} as const;
// ---cut---
diff --git a/packages/docs/docs/artifacts.mdx b/packages/docs/docs/artifacts.mdx
index 1128ca5073..b052543d81 100644
--- a/packages/docs/docs/artifacts.mdx
+++ b/packages/docs/docs/artifacts.mdx
@@ -90,6 +90,7 @@ const composition: VideoConfig = {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
id: 'hi',
durationInFrames: 100,
};
diff --git a/packages/docs/docs/calculate-metadata.mdx b/packages/docs/docs/calculate-metadata.mdx
index 0276881999..b322f6b913 100644
--- a/packages/docs/docs/calculate-metadata.mdx
+++ b/packages/docs/docs/calculate-metadata.mdx
@@ -22,7 +22,7 @@ Use it if you:
<Step>3</Step> want to add a per-composition default codec
</div>
<div>
-<Step>4</Step> want to add per-composition default video image format or pixel format
+<Step>4</Step> want to add per-composition default video image format, pixel format, or ProRes profile
</div>
<div>
<Step>5</Step> want to run code once, before the actual render starts.
@@ -65,6 +65,8 @@ const calculateMetadata: CalculateMetadataFunction<MyComponentProps> = ({props,
defaultVideoImageFormat: 'png',
// or add per-composition default pixel format
defaultPixelFormat: 'yuv420p',
+ // or add per-composition default ProRes profile
+ defaultProResProfile: 'hq',
};
};
@@ -106,6 +108,7 @@ The function must return an pure JSON-serializable object, which can contain the
- `defaultOutName` _optional_: The default output name when rendering (without file extension) <AvailableFrom v="4.0.268" />
- `defaultVideoImageFormat` _optional_: The default video image format (`'png'`, `'jpeg'`, or `'none'`) <AvailableFrom v="4.0.316" />
- `defaultPixelFormat` _optional_: The default pixel format (`'yuv420p'`, `'yuva420p'`, `'yuv422p'`, `'yuv444p'`, `'yuv420p10le'`, `'yuv422p10le'`, `'yuv444p10le'`, or `'yuva444p10le'`) <AvailableFrom v="4.0.316" />
+- `defaultProResProfile` _optional_: The default ProRes profile (`'4444-xq'`, `'4444'`, `'hq'`, `'standard'`, `'light'`, or `'proxy'`) <AvailableFrom v="4.0.316" />
If you return a field, it will take precendence over the props directly passed to the composition. The defaultCodec returned will have a higher priority than the config file, but less priority than explicitly passing the option to renderMedia() i.e. the composition will be rendered with this codec if nothing with higher priority was specified.
diff --git a/packages/docs/docs/renderer/make-cancel-signal.mdx b/packages/docs/docs/renderer/make-cancel-signal.mdx
index 032aea08d6..434c891d3f 100644
--- a/packages/docs/docs/renderer/make-cancel-signal.mdx
+++ b/packages/docs/docs/renderer/make-cancel-signal.mdx
@@ -26,6 +26,7 @@ const composition: VideoConfig = {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
};
// ---cut---
import {makeCancelSignal, renderMedia} from '@remotion/renderer';
diff --git a/packages/it-tests/src/ssr/cancel-after-success.test.ts b/packages/it-tests/src/ssr/cancel-after-success.test.ts
index b8fc5daeda..d73a8c7855 100644
--- a/packages/it-tests/src/ssr/cancel-after-success.test.ts
+++ b/packages/it-tests/src/ssr/cancel-after-success.test.ts
@@ -21,6 +21,7 @@ test('Cancelling after success should not throw error', async () => {
defaultCodec: null,
defaultOutName: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
defaultVideoImageFormat: null,
},
concurrency: 1,
diff --git a/packages/it-tests/src/ssr/cancel-renderframes.test.ts b/packages/it-tests/src/ssr/cancel-renderframes.test.ts
index 636997d33f..5e5562fe3b 100644
--- a/packages/it-tests/src/ssr/cancel-renderframes.test.ts
+++ b/packages/it-tests/src/ssr/cancel-renderframes.test.ts
@@ -27,6 +27,7 @@ test('Should be able to cancel render', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
cancelSignal,
imageFormat: 'jpeg',
diff --git a/packages/it-tests/src/ssr/cancel-rendermedia.test.ts b/packages/it-tests/src/ssr/cancel-rendermedia.test.ts
index 4c1e9601e2..67a2e5046d 100644
--- a/packages/it-tests/src/ssr/cancel-rendermedia.test.ts
+++ b/packages/it-tests/src/ssr/cancel-rendermedia.test.ts
@@ -20,6 +20,7 @@ test('Should be able to cancel render', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
outputLocation: 'out/render.mp4',
cancelSignal,
diff --git a/packages/it-tests/src/ssr/cancel-renderstill.test.ts b/packages/it-tests/src/ssr/cancel-renderstill.test.ts
index 59a7d8905f..09ce420ea1 100644
--- a/packages/it-tests/src/ssr/cancel-renderstill.test.ts
+++ b/packages/it-tests/src/ssr/cancel-renderstill.test.ts
@@ -19,6 +19,7 @@ test('Should be able to cancel render', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
cancelSignal,
output: 'out/hithere.png',
diff --git a/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts b/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts
index ce16372ed9..ef8c94a94e 100644
--- a/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts
+++ b/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts
@@ -19,6 +19,7 @@ test('Fatal error on frame 10 should yield correct error', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
logLevel: 'error',
outputLocation: 'out/render.mp4',
diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.ts
index 0593ad269c..b6282cac3e 100644
--- a/packages/it-tests/src/ssr/render-media.test.ts
+++ b/packages/it-tests/src/ssr/render-media.test.ts
@@ -91,6 +91,7 @@ test('should fail on invalid CRF', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
frameRange: [0, 2],
puppeteerInstance: browserInstance,
@@ -145,6 +146,7 @@ test('Should fail invalid serve URL', async () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
});
} catch (err) {
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index 5bc5fa1834..5a2c8f7afb 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -132,6 +132,7 @@ const innerGetCompositions = async ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
} = r;
return {
@@ -150,6 +151,7 @@ const innerGetCompositions = async ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
};
});
};
diff --git a/packages/renderer/src/make-page.ts b/packages/renderer/src/make-page.ts
index 34a5c6c20a..f77d4a9bc3 100644
--- a/packages/renderer/src/make-page.ts
+++ b/packages/renderer/src/make-page.ts
@@ -7,6 +7,7 @@ import type {VideoImageFormat} from './image-format';
import type {LogLevel} from './log-level';
import {getAvailableMemory} from './memory/get-available-memory';
import type {PixelFormat} from './pixel-format';
+import type {ProResProfile} from './prores-profile';
import {puppeteerEvaluateWithCatch} from './puppeteer-evaluate';
import type {BrowserReplacer} from './replace-browser';
import {setPropsAndEnv} from './set-props-and-env';
@@ -98,6 +99,7 @@ export const makePage = async ({
defaultOutName: string | null,
defaultVideoImageFormat: VideoImageFormat | null,
defaultPixelFormat: PixelFormat | null,
+ defaultProResProfile: ProResProfile | null,
) => {
window.remotion_setBundleMode({
type: 'composition',
@@ -111,6 +113,7 @@ export const makePage = async ({
compositionDefaultOutName: defaultOutName,
compositionDefaultVideoImageFormat: defaultVideoImageFormat,
compositionDefaultPixelFormat: defaultPixelFormat,
+ compositionDefaultProResProfile: defaultProResProfile,
});
},
args: [
@@ -124,6 +127,7 @@ export const makePage = async ({
composition.defaultOutName,
composition.defaultVideoImageFormat,
composition.defaultPixelFormat,
+ composition.defaultProResProfile,
],
frame: null,
page,
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 11eaef55e8..c1926b1a6b 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -35,6 +35,7 @@ import type {ToOptions} from './options/option';
import type {optionsMap} from './options/options-map';
import {DEFAULT_OVERWRITE} from './overwrite';
import type {PixelFormat} from './pixel-format';
+import type {ProResProfile} from './prores-profile';
import type {RemotionServer} from './prepare-server';
import {makeOrReuseServer} from './prepare-server';
import {puppeteerEvaluateWithCatch} from './puppeteer-evaluate';
@@ -289,6 +290,7 @@ const innerRenderStill = async ({
defaultOutName: string | null,
defaultVideoImageFormat: VideoImageFormat | null,
defaultPixelFormat: PixelFormat | null,
+ defaultProResProfile: ProResProfile | null,
) => {
window.remotion_setBundleMode({
type: 'composition',
@@ -302,6 +304,7 @@ const innerRenderStill = async ({
compositionDefaultOutName: defaultOutName,
compositionDefaultVideoImageFormat: defaultVideoImageFormat,
compositionDefaultPixelFormat: defaultPixelFormat,
+ compositionDefaultProResProfile: defaultProResProfile,
});
},
args: [
@@ -315,6 +318,7 @@ const innerRenderStill = async ({
composition.defaultOutName,
composition.defaultVideoImageFormat,
composition.defaultPixelFormat,
+ composition.defaultProResProfile,
],
frame: null,
page,
diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.ts
index 9c140e64de..a6e337ee9c 100644
--- a/packages/renderer/src/select-composition.ts
+++ b/packages/renderer/src/select-composition.ts
@@ -158,6 +158,7 @@ const innerSelectComposition = async ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
} = res;
return {
metadata: {
@@ -176,6 +177,7 @@ const innerSelectComposition = async ({
defaultOutName,
defaultVideoImageFormat,
defaultPixelFormat,
+ defaultProResProfile,
},
propsSize: size,
};
diff --git a/packages/renderer/src/test/render-still.test.ts b/packages/renderer/src/test/render-still.test.ts
index b473561afb..3877433182 100644
--- a/packages/renderer/src/test/render-still.test.ts
+++ b/packages/renderer/src/test/render-still.test.ts
@@ -21,6 +21,7 @@ test(
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
frame: 0,
output: '/file/output.png',
@@ -53,6 +54,7 @@ test(
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
frame: 0,
serveUrl:
@@ -85,6 +87,7 @@ test(
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
frame: 200,
output: '/file/output.png',
@@ -118,6 +121,7 @@ test(
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
// @ts-expect-error
imageFormat: 'jjj',
diff --git a/packages/renderer/src/test/validate-config.test.ts b/packages/renderer/src/test/validate-config.test.ts
index d4d969d3a9..db88c977c5 100644
--- a/packages/renderer/src/test/validate-config.test.ts
+++ b/packages/renderer/src/test/validate-config.test.ts
@@ -18,6 +18,7 @@ describe('Should validate invalid data passed to renderFrames', () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
}),
).toThrow(
@@ -40,6 +41,7 @@ describe('Should validate invalid data passed to renderFrames', () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
}),
).toThrow(
@@ -62,6 +64,7 @@ describe('Should validate invalid data passed to renderFrames', () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
}),
).toThrow(
@@ -84,6 +87,7 @@ describe('Should validate invalid data passed to renderFrames', () => {
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
}),
).toThrow(
diff --git a/packages/serverless/src/handlers/renderer.ts b/packages/serverless/src/handlers/renderer.ts
index f496d95fa5..f6d4757a97 100644
--- a/packages/serverless/src/handlers/renderer.ts
+++ b/packages/serverless/src/handlers/renderer.ts
@@ -243,6 +243,7 @@ const renderHandler = async <Provider extends CloudProvider>({
defaultCodec: null,
defaultOutName: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
defaultVideoImageFormat: null,
},
imageFormat: params.imageFormat,
diff --git a/packages/test-utils/src/composition-manager-context.ts b/packages/test-utils/src/composition-manager-context.ts
index 7ec1b5fbc7..49dcc46603 100644
--- a/packages/test-utils/src/composition-manager-context.ts
+++ b/packages/test-utils/src/composition-manager-context.ts
@@ -17,6 +17,7 @@ export const makeMockCompositionManagerContext =
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
folders: [],
compositions: [
diff --git a/packages/web-renderer/src/render-still-on-web.tsx b/packages/web-renderer/src/render-still-on-web.tsx
index 92155fc9f3..5d844e5b73 100644
--- a/packages/web-renderer/src/render-still-on-web.tsx
+++ b/packages/web-renderer/src/render-still-on-web.tsx
@@ -60,6 +60,7 @@ export const renderStillOnWeb = async ({
defaultOutName: null,
defaultVideoImageFormat: null,
defaultPixelFormat: null,
+ defaultProResProfile: null,
},
folders: [],
compositions: [
@@ -128,6 +129,8 @@ export const renderStillOnWeb = async ({
defaultVideoImageFormat: null,
// TODO: Hardcoded
defaultPixelFormat: null,
+ // TODO: Hardcoded
+ defaultProResProfile: null,
}}
// TODO: Hardcoded
audioLatencyHint="interactive"