Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
feat(engine): add streamingEncodeDurationCapEnabled config flag, default off
Vance Ingalls68a605c82612
diff --git a/packages/engine/src/config.test.ts b/packages/engine/src/config.test.tsindex 95ee5096b0..55b83f2848 100644--- a/packages/engine/src/config.test.ts+++ b/packages/engine/src/config.test.ts@@ -53,6 +53,7 @@ describe("resolveConfig", () => {expect(config.browserGpuMode).toBe("software");expect(config.enableStreamingEncode).toBe(true);expect(config.streamingEncodeMaxDurationSeconds).toBe(240);+ expect(config.streamingEncodeDurationCapEnabled).toBe(false);expect((config as Record<string, unknown>).vp9CpuUsed).toBe(4);expect(config.audioGain).toBe(1);expect(config.debug).toBe(false);@@ -105,6 +106,18 @@ describe("resolveConfig", () => {expect(config.streamingEncodeMaxDurationSeconds).toBe(0);});+ it("reads the streaming duration cap enable flag from env", () => {+ setEnv("PRODUCER_STREAMING_ENCODE_DURATION_CAP_ENABLED", "true");++ const config = resolveConfig();+ expect(config.streamingEncodeDurationCapEnabled).toBe(true);+ });++ it("keeps the streaming duration cap disabled when the flag is unset", () => {+ const config = resolveConfig();+ expect(config.streamingEncodeDurationCapEnabled).toBe(false);+ });+it("reads VP9 cpu-used from env", () => {setEnv("PRODUCER_VP9_CPU_USED", "6");diff --git a/packages/engine/src/config.ts b/packages/engine/src/config.tsindex 127a98ffc1..ebb31c7fd2 100644--- a/packages/engine/src/config.ts+++ b/packages/engine/src/config.ts@@ -160,11 +160,17 @@ export interface EngineConfig {*/streamingEncodeAutoDisabledOnWin32Compound?: boolean;/**- * Max composition duration eligible for streaming encode (seconds).- * Mirrors GSAP rendering's 4-minute streaming guard: production has seen- * ffmpeg's streaming pipe hit FFMPEG_STREAMING_TIMEOUT_MS on longer videos.+ * Max composition duration eligible for streaming encode (seconds). Only+ * applied when `streamingEncodeDurationCapEnabled` is true. Historical: the+ * 240 s default (#579) guarded a total-render ffmpeg timeout that became an+ * inactivity timeout in efc16a945, so the cap is off by default.*/streamingEncodeMaxDurationSeconds: number;+ /**+ * Apply `streamingEncodeMaxDurationSeconds`. Default false: long single-worker+ * renders stream. Env: PRODUCER_STREAMING_ENCODE_DURATION_CAP_ENABLED.+ */+ streamingEncodeDurationCapEnabled: boolean;// ── FFmpeg timeouts ──────────────────────────────────────────────────/** Timeout for FFmpeg frame encoding (ms). Default: 600_000 */@@ -294,6 +300,7 @@ export const DEFAULT_CONFIG: EngineConfig = {chunkSizeFrames: 360,enableStreamingEncode: true,streamingEncodeMaxDurationSeconds: 240,+ streamingEncodeDurationCapEnabled: false,ffmpegEncodeTimeout: 600_000,ffmpegProcessTimeout: 300_000,@@ -338,6 +345,7 @@ const BOOLEAN_ENGINE_CONFIG_FIELDS = ["enablePageSideCompositing","enableChunkedEncode","enableStreamingEncode",+ "streamingEncodeDurationCapEnabled","hdrAutoDetect","verifyRuntime","debug",@@ -866,6 +874,10 @@ export function resolveConfig(overrides?: Partial<EngineConfig>): EngineConfig {DEFAULT_CONFIG.streamingEncodeMaxDurationSeconds,),),+ streamingEncodeDurationCapEnabled: envBool(+ "PRODUCER_STREAMING_ENCODE_DURATION_CAP_ENABLED",+ DEFAULT_CONFIG.streamingEncodeDurationCapEnabled,+ ),ffmpegEncodeTimeout: envNum("FFMPEG_ENCODE_TIMEOUT_MS", DEFAULT_CONFIG.ffmpegEncodeTimeout),ffmpegProcessTimeout: envNum("FFMPEG_PROCESS_TIMEOUT_MS", DEFAULT_CONFIG.ffmpegProcessTimeout),