fix(ltx): scale fps to preserve duration with RIFE interpolation

LTX conditions the model on mp4_fps as the source frame rate, then
RIFE inflates frame count at save. Without compensation, save fps
stays equal to source fps and the video becomes (mp4_interpolate+1)x
slow-motion (e.g. 121 frames at 24 fps with mp4_interpolate=1 saved
as 242 frames at 24 fps = 10s instead of the intended 5s). Scale the
saved fps by the interpolation factor at the LTX call site so output
duration matches user intent.

FramePack already pre-divides mp4_fps at generation time (compute-
saving semantic baked into UI math), so it does not need this fix.
The pipelines now produce duration-correct output via two different
mechanisms; standardization is tracked for the RIFE-in-processing
follow-up.
This commit is contained in:
CalamitousFelicitousness
2026-04-25 21:15:06 +01:00
parent 121b357ba0
commit a2cccddee0
+4 -1
View File
@@ -563,11 +563,14 @@ def run_ltx(task_id,
except Exception:
aac_sample_rate = 24000
# LTX conditions the model on mp4_fps as the source frame rate; RIFE inflates frames at save time.
# Scale the saved fps by the interpolation factor so the output preserves the user's intended duration.
save_fps = mp4_fps * (mp4_interpolate + 1) if mp4_interpolate > 0 else mp4_fps
num_frames, video_file, _thumb = save_video(
p=p,
pixels=pixels,
audio=audio,
mp4_fps=mp4_fps,
mp4_fps=save_fps,
mp4_codec=mp4_codec,
mp4_opt=mp4_opt,
mp4_ext=mp4_ext,