Skip to content

🎥 Make videos programmatically with React

fix up last things

Jonny Burgerdf2f9a06dddc
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index fab4ed6959..f01b66d62d 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -17,7 +17,8 @@ export const getImageFormat = (
codec === 'h264' ||
codec === 'h265' ||
codec === 'vp8' ||
- codec === 'vp9'
+ codec === 'vp9' ||
+ codec === 'prores'
) {
return 'jpeg';
}
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 30b445901a..a220d051ec 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -96,7 +96,9 @@ export const parseCommandLine = () => {
}
if (parsedCli['prores-profile']) {
- Config.Output.setProResProfile(parsedCli['prores-profile']);
+ Config.Output.setProResProfile(
+ String(parsedCli['prores-profile']) as ProResProfile
+ );
}
if (typeof parsedCli.overwrite !== 'undefined') {
diff --git a/packages/core/src/config/crf.ts b/packages/core/src/config/crf.ts
index 201f829924..3ece1d34a3 100644
--- a/packages/core/src/config/crf.ts
+++ b/packages/core/src/config/crf.ts
@@ -38,6 +38,10 @@ export const getDefaultCrfForCodec = (codec: Codec): number => {
return 28; // FFMPEG recommendation 31
}
+ if (codec === 'prores') {
+ return 0;
+ }
+
throw new TypeError(`Got unexpected codec "${codec}"`);
};
@@ -46,6 +50,10 @@ export const getValidCrfRanges = (codec: Codec): [number, number] => {
return [0, 0];
}
+ if (codec === 'prores') {
+ return [0, 0];
+ }
+
if (codec === 'h264') {
return [1, 51];
}
diff --git a/packages/core/src/config/prores-profile.ts b/packages/core/src/config/prores-profile.ts
index bd19309dd3..6194372589 100644
--- a/packages/core/src/config/prores-profile.ts
+++ b/packages/core/src/config/prores-profile.ts
@@ -33,7 +33,7 @@ export const validateSelectedCodecAndProResCombination = (
if (
actualProResProfile !== undefined &&
- !proResProfileOptions.includes(actualProResProfile)
+ !proResProfileOptions.includes(actualProResProfile as ProResProfile)
) {
throw new TypeError(
`The ProRes profile "${actualProResProfile}" is not valid. Valid options are ${proResProfileOptions
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.ts
index 765a530037..040fae2ab7 100644
--- a/packages/renderer/src/stitcher.ts
+++ b/packages/renderer/src/stitcher.ts
@@ -51,17 +51,23 @@ export const stitchFramesToVideo = async (options: {
const encoderName = getCodecName(codec);
const audioCodecName = getAudioCodecName(codec);
- const proResProfileName = getProResProfileName(options.proResProfile);
+ const proResProfileName = getProResProfileName(codec, options.proResProfile);
+
const isAudioOnly = encoderName === null;
+ const supportsCrf = encoderName && codec !== 'prores';
if (options.verbose) {
console.log('[verbose] encoder', encoderName);
console.log('[verbose] audioCodec', audioCodecName);
console.log('[verbose] pixelFormat', pixelFormat);
console.log('[verbose] imageFormat', imageFormat);
- console.log('[verbose] crf', crf);
+ if (supportsCrf) {
+ console.log('[verbose] crf', crf);
+ }
+
console.log('[verbose] codec', codec);
console.log('[verbose] isAudioOnly', isAudioOnly);
+ console.log('[verbose] proResProfileName', proResProfileName);
}
Internals.validateSelectedCrfAndCodecCombination(crf, codec);
@@ -129,7 +135,7 @@ export const stitchFramesToVideo = async (options: {
: // If only exporting audio, we drop the video explicitly
['-vn'],
proResProfileName ? ['-profile:v', proResProfileName] : null,
- isAudioOnly ? null : ['-crf', String(crf)],
+ supportsCrf ? ['-crf', String(crf)] : null,
isAudioOnly ? null : ['-pix_fmt', pixelFormat],
// Without explicitly disabling auto-alt-ref,