Skip to content

🎥 Make videos programmatically with React

:new: ProRes support

William Candillon58c9752833e2
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index ba0be433c1..56ec6c232d 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -167,6 +167,7 @@ export const getCliOptions = async () => {
codec,
pixelFormat,
});
+ const profile = getProfile();
return {
parallelism: Internals.getConcurrency(),
@@ -182,5 +183,6 @@ export const getCliOptions = async () => {
crf,
pixelFormat,
imageFormat,
+ profile
};
};
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 67beb3e5c0..6facf7f6aa 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -70,6 +70,7 @@ export const render = async () => {
const {
codec,
+ profile,
parallelism,
frameRange,
shouldOutputImageSequence,
@@ -235,6 +236,7 @@ export const render = async () => {
imageFormat,
pixelFormat,
codec,
+ profile,
crf,
assetsInfo,
parallelism,
diff --git a/packages/core/src/config/codec.ts b/packages/core/src/config/codec.ts
index 65ea23306b..481577675c 100644
--- a/packages/core/src/config/codec.ts
+++ b/packages/core/src/config/codec.ts
@@ -6,18 +6,24 @@ const validCodecs = [
'mp3',
'aac',
'wav',
+ 'prores'
] as const;
export type Codec = typeof validCodecs[number];
export type CodecOrUndefined = Codec | undefined;
+export type ProfileOrUndefined = string | undefined;
const validLegacyFormats = ['mp4', 'png-sequence'] as const;
type LegacyFormat = typeof validLegacyFormats[number];
let codec: CodecOrUndefined;
+let profile: ProfileOrUndefined;
export const getOutputCodecOrUndefined = (): CodecOrUndefined => {
return codec;
};
+export const getOutputProfileOrUndefined = (): ProfileOrUndefined => {
+ return profile;
+}
export const DEFAULT_CODEC: Codec = 'h264';
@@ -136,3 +142,7 @@ export const setCodec = (newCodec: CodecOrUndefined) => {
codec = newCodec;
};
+
+export const setProfile = (newProfile: ProfileOrUndefined) => {
+ profile = newProfile;
+}
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.ts
index 7f315be504..17485b6252 100644
--- a/packages/renderer/src/stitcher.ts
+++ b/packages/renderer/src/stitcher.ts
@@ -39,6 +39,10 @@ const getCodecName = (codec: Codec): string | null => {
return 'libvpx-vp9';
}
+ if (codec === 'prores') {
+ return 'prores_ks'
+ }
+
throw new TypeError(`Cannot find FFMPEG codec for ${codec}`);
};
@@ -71,6 +75,7 @@ export const stitchFramesToVideo = async (options: {
imageFormat?: ImageFormat;
pixelFormat?: PixelFormat;
codec?: Codec;
+ profile?: string;
crf?: number;
// TODO: Do we want a parallelism flag for stitcher?
parallelism?: number | null;
@@ -174,6 +179,7 @@ export const stitchFramesToVideo = async (options: {
// Ignore audio from image sequence
isAudioOnly ? null : ['-map', '0:v'],
options.force ? '-y' : null,
+ options.profile ? ['-profile:v', options.profile] : null,
options.outputLocation,
];