Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/diffusers/Dockerfile.dreamverse
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions examples/diffusers/patches/pyav-scenecut.patch
Original file line number Diff line number Diff line change
@@ -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)
Loading