Skip to content

🎥 Make videos programmatically with React

validate file extension

Jonny Burger0de8e7c86bce
diff --git a/packages/cli/src/get-filename.ts b/packages/cli/src/get-filename.ts
index 53eb18b281..539b34df1c 100644
--- a/packages/cli/src/get-filename.ts
+++ b/packages/cli/src/get-filename.ts
@@ -38,6 +38,12 @@ export const getOutputFilename = (
filename += '.webm';
extension = 'webm';
}
+
+ if (codec === 'prores') {
+ Log.info('No file extension specified, adding .mov automatically.');
+ filename += '.mov';
+ extension = 'mov';
+ }
}
if (codec === 'h264') {
@@ -67,6 +73,18 @@ export const getOutputFilename = (
}
}
+ if (codec === 'prores') {
+ const allowedProResExtensions = ['mov', 'mkv', 'mxf'];
+ if (!extension || !allowedProResExtensions.includes(extension)) {
+ Log.error(
+ `When using the 'prores' codec, the output must end in one of those extensions: ${allowedProResExtensions
+ .map((a) => `.${a}`)
+ .join(', ')}`
+ );
+ process.exit(1);
+ }
+ }
+
if (codec === 'mp3') {
if (extension !== 'mp3') {
Log.error("When using the 'mp3' codec, the output must end in .mp3");