Skip to content

🎥 Make videos programmatically with React

renderMedia() allows relative output paths

Jonny Burgere3bb761bee64
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 40b9d85304..957d87f866 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -139,6 +139,10 @@ export const renderMedia = ({
validateOutputFilename(codec, getExtensionOfFilename(outputLocation));
}
+ const absoluteOutputLocation = outputLocation
+ ? path.resolve(process.cwd(), outputLocation)
+ : null;
+
validateScale(scale);
const everyNthFrame = options.everyNthFrame ?? 1;
@@ -335,8 +339,9 @@ export const renderMedia = ({
renderedDoneIn = Date.now() - renderStart;
callUpdate();
- if (outputLocation) {
- ensureOutputDirectory(outputLocation);
+ if (absoluteOutputLocation) {
+ console.log({outputLocation});
+ ensureOutputDirectory(absoluteOutputLocation);
}
const stitchStart = Date.now();
@@ -345,7 +350,7 @@ export const renderMedia = ({
width: composition.width * (scale ?? 1),
height: composition.height * (scale ?? 1),
fps,
- outputLocation,
+ outputLocation: absoluteOutputLocation,
internalOptions: {
preEncodedFileLocation,
imageFormat,