Skip to content

Write HTML. Render video. Built for agents.

fix(producer): propagate audio mixer config (#3239)

Miguel Ángelc32b8041dbd1
diff --git a/packages/producer/src/services/distributed/plan.ts b/packages/producer/src/services/distributed/plan.ts
index 50150e3908..e6652bf808 100644
--- a/packages/producer/src/services/distributed/plan.ts
+++ b/packages/producer/src/services/distributed/plan.ts
@@ -1063,6 +1063,8 @@ export async function buildLocalExecutionPlan(
workDir,
compiledDir,
duration: job.duration,
+ ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
+ audioGain: cfg.audioGain,
audios: composition.audios,
abortSignal,
assertNotAborted,
diff --git a/packages/producer/src/services/render/stages/audioStage.test.ts b/packages/producer/src/services/render/stages/audioStage.test.ts
index ffa0b97159..9c60114c30 100644
--- a/packages/producer/src/services/render/stages/audioStage.test.ts
+++ b/packages/producer/src/services/render/stages/audioStage.test.ts
@@ -39,6 +39,8 @@ describe("runAudioStage", () => {
workDir,
compiledDir: join(workDir, "compiled"),
duration: 5,
+ ffmpegProcessTimeout: 3_600_000,
+ audioGain: 1,
audios,
abortSignal: undefined,
assertNotAborted: () => {},
@@ -72,6 +74,16 @@ describe("runAudioStage", () => {
expect(result.audioFailures).toEqual([
expect.objectContaining({ reason: "source_not_found", stage: "source" }),
]);
+ expect(processCompositionAudioMock).toHaveBeenCalledWith(
+ audios,
+ expect.any(String),
+ expect.any(String),
+ expect.any(String),
+ 5,
+ undefined,
+ { ffmpegProcessTimeout: 3_600_000, audioGain: 1 },
+ expect.any(String),
+ );
});
it("falls back to a generic message when the mixer fails without an error string", async () => {
diff --git a/packages/producer/src/services/render/stages/audioStage.ts b/packages/producer/src/services/render/stages/audioStage.ts
index 5e61a4a17f..e99c493eee 100644
--- a/packages/producer/src/services/render/stages/audioStage.ts
+++ b/packages/producer/src/services/render/stages/audioStage.ts
@@ -33,6 +33,10 @@ export interface AudioStageInput {
compiledDir: string;
/** Composition duration (post-probe). Must be > 0 — probeStage guarantees this. */
duration: number;
+ /** Timeout forwarded to ffmpeg subprocesses used by the audio mixer. */
+ ffmpegProcessTimeout: number;
+ /** Master gain forwarded to the audio mixer. */
+ audioGain: number;
/** Read-only view of `composition.audios`. */
audios: CompositionMetadata["audios"];
abortSignal: AbortSignal | undefined;
@@ -59,8 +63,18 @@ export interface AudioStageResult {
}
export async function runAudioStage(input: AudioStageInput): Promise<AudioStageResult> {
- const { projectDir, workDir, compiledDir, duration, audios, abortSignal, assertNotAborted, log } =
- input;
+ const {
+ projectDir,
+ workDir,
+ compiledDir,
+ duration,
+ ffmpegProcessTimeout,
+ audioGain,
+ audios,
+ abortSignal,
+ assertNotAborted,
+ log,
+ } = input;
const stage3Start = Date.now();
const audioOutputPath = join(workDir, MIXED_AUDIO_FILENAME);
@@ -84,7 +98,7 @@ export async function runAudioStage(input: AudioStageInput): Promise<AudioStageR
audioOutputPath,
duration,
abortSignal,
- undefined,
+ { ffmpegProcessTimeout, audioGain },
compiledDir,
);
} catch (err) {
diff --git a/packages/producer/src/services/renderOrchestrator.ts b/packages/producer/src/services/renderOrchestrator.ts
index 762dde215c..f94affaf65 100644
--- a/packages/producer/src/services/renderOrchestrator.ts
+++ b/packages/producer/src/services/renderOrchestrator.ts
@@ -2529,6 +2529,8 @@ async function executeRenderPipeline(input: {
workDir,
compiledDir,
duration: probeResult.duration,
+ ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
+ audioGain: cfg.audioGain,
audios: composition.audios,
abortSignal: executionSignal,
assertNotAborted,