diff --git a/examples/diffusers/Dockerfile.dreamverse b/examples/diffusers/Dockerfile.dreamverse index c161352ebb3a..bec0f90760d6 100644 --- a/examples/diffusers/Dockerfile.dreamverse +++ b/examples/diffusers/Dockerfile.dreamverse @@ -36,14 +36,17 @@ RUN . /opt/venv/bin/activate \ # the exact commit these patches were authored against, so they apply clean. COPY patches/ltx23_gpu_worker_megacache.patch /tmp/megacache.patch COPY patches/x264-threads-cap.patch /tmp/x264-threads-cap.patch +COPY patches/pyav-scenecut.patch /tmp/pyav-scenecut.patch # NOTE: verify by grepping the patched source, NOT by importing fastvideo -- # importing pulls in triton, which fails to init its driver in a GPU-less build # ("0 active drivers"). RUN SP=/opt/venv/lib/python3.12/site-packages \ && patch -p1 -d "$SP" --forward --fuzz=0 < /tmp/megacache.patch \ && patch -p1 -d "$SP" --forward --fuzz=0 < /tmp/x264-threads-cap.patch \ + && patch -p1 -d "$SP" --forward --fuzz=0 < /tmp/pyav-scenecut.patch \ && grep -q 'torch.compiler.load_cache_artifacts' "$SP/fastvideo/worker/gpu_worker.py" \ && grep -q 'FASTVIDEO_X264_THREADS' "$SP/fastvideo/entrypoints/video_generator.py" \ + && grep -q 'FASTVIDEO_X264_SCENECUT' "$SP/fastvideo/entrypoints/video_generator.py" \ && echo "patches applied + verified" ENV FASTVIDEO_VIDEO_CODEC=libx264 diff --git a/examples/diffusers/patches/pyav-scenecut.patch b/examples/diffusers/patches/pyav-scenecut.patch new file mode 100644 index 000000000000..79d003e5d7ab --- /dev/null +++ b/examples/diffusers/patches/pyav-scenecut.patch @@ -0,0 +1,17 @@ +diff --git a/fastvideo/entrypoints/video_generator.py b/fastvideo/entrypoints/video_generator.py +index bfc1633..ef4f213 100644 +--- a/fastvideo/entrypoints/video_generator.py ++++ b/fastvideo/entrypoints/video_generator.py +@@ -1010,6 +1010,12 @@ class VideoGenerator: + video_stream.options = { + "preset": "ultrafast", + "tune": "zerolatency", ++ # Skip x264's scene-cut cost analysis: a pure encode-speed lever ++ # with no quality/compat effect for our fixed-GOP single-file ++ # output. Env-configurable (mirrors FASTVIDEO_X264_THREADS / ++ # FASTVIDEO_X264_PRESET below) so it's opt-out per model without ++ # a rebuild. Measured ~50-100ms/clip (deepinfra, 2026-07-07). ++ "x264-params": f"scenecut={os.getenv('FASTVIDEO_X264_SCENECUT', '0')}", + } + + audio_stream = output.add_stream("aac", rate=sample_rate, layout=layout)