🎥 Make videos programmatically with React
add comments about option resolution
Jonny Burger5379c66ee638
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.tsindex 16f763a969..c2962741c4 100644--- a/packages/cli/src/benchmark.ts+++ b/packages/cli/src/benchmark.ts@@ -257,6 +257,7 @@ export const benchmarkCommand = async (uiMuted: null,uiQuality: null,uiScale: null,+ uiConcurrency: null,});const concurrency = getValidConcurrency(renderMediaOptions);diff --git a/packages/cli/src/get-render-media-options.ts b/packages/cli/src/get-render-media-options.tsindex 8dcbad7294..347dc91c04 100644--- a/packages/cli/src/get-render-media-options.ts+++ b/packages/cli/src/get-render-media-options.ts@@ -16,6 +16,7 @@ export const getRenderMediaOptions = async ({uiScale,uiMuted,uiQuality,+ uiConcurrency,}: {outputLocation: RenderMediaOptions['outputLocation'];config: RenderMediaOptions['composition'];@@ -28,6 +29,7 @@ export const getRenderMediaOptions = async ({uiScale: number | null;uiMuted: boolean | null;uiQuality: number | null;+ uiConcurrency: number | string | null;}): Promise<RenderMediaOptions> => {// TODO: Lots of these options can have difference defaults// TODO: Scale option for example is not being applied@@ -87,8 +89,7 @@ export const getRenderMediaOptions = async ({pixelFormat,// TODO: Take from UIproResProfile,- // TODO: Take from UI- quality,+ quality: uiQuality ?? quality,dumpBrowserLogs: RenderInternals.isEqualOrBelowLogLevel(ConfigInternals.Logging.getLogLevel(),'verbose'@@ -108,8 +109,7 @@ export const getRenderMediaOptions = async ({enforceAudioTrack,browserExecutable,ffmpegOverride,- // TODO: Take from UI- concurrency,+ concurrency: uiConcurrency ?? concurrency,serveUrl,// TODO: Take from UIcodec,diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.tsindex 131fa844cf..5940b93dd1 100644--- a/packages/cli/src/render-flows/render.ts+++ b/packages/cli/src/render-flows/render.ts@@ -276,6 +276,25 @@ export const renderCompFlow = async ({let renderedDoneIn: number | null = null;let stitchStage: StitchingState = 'encoding';+ const options = await getRenderMediaOptions({+ config,+ outputLocation: absoluteOutputFile,+ serveUrl: urlOrBundle,+ codec,+ remotionRoot,+ uiImageFormat,+ uiCrf,+ uiFrameRange: frameRange,+ uiMuted,+ uiQuality: quality ?? null,+ uiScale: scale,+ uiConcurrency: concurrency,+ });++ const actualConcurrency = RenderInternals.getActualConcurrency(+ 'concurrency' in options ? concurrency : null+ );+const updateRenderProgress = () => {if (totalFrames.length === 0) {throw new Error('totalFrames should not be 0');@@ -286,7 +305,7 @@ export const renderCompFlow = async ({rendering: {frames: renderedFrames,totalFrames: totalFrames.length,- concurrency: RenderInternals.getActualConcurrency(concurrency),+ concurrency: actualConcurrency,doneIn: renderedDoneIn,steps,},@@ -358,13 +377,19 @@ export const renderCompFlow = async ({'verbose'),everyNthFrame,+ // TODO: Take from UIenvVariables,+ // TODO: Take from UIframeRange,- concurrency,+ // TODO: Take from UI+ concurrency: actualConcurrency,puppeteerInstance,+ // TODO: Take from UIquality,timeoutInMilliseconds: puppeteerTimeout,+ // TODO: Take from UIchromiumOptions,+ // TODO: Take from UIscale,ffmpegExecutable,ffprobeExecutable,@@ -378,20 +403,6 @@ export const renderCompFlow = async ({Log.infoAdvanced({indent, logLevel}, chalk.cyan(`â–¶ ${absoluteOutputFile}`));}- const options = await getRenderMediaOptions({- config,- outputLocation: absoluteOutputFile,- serveUrl: urlOrBundle,- codec,- remotionRoot,- uiImageFormat,- uiCrf,- uiFrameRange: frameRange,- uiMuted,- uiQuality: quality ?? null,- uiScale: scale,- });-await renderMedia({...options,onProgress: (update) => {