From 121b357ba0b01a18eeac959d5ed602bc8a7f9283 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sat, 25 Apr 2026 21:14:36 +0100 Subject: [PATCH] fix(video): normalize pixel range to [0,1] before RIFE video_save passes [-1,1]-range pixels to rife.interpolate_nchw, but RIFE v4.25's IFNet explicitly clamps inputs to [0,1] (Head and IFNet forward pass), turning every negative pixel value into zero. v3.9 silently extrapolated and produced soft artifacts; v4.25 produces washout. Convert to [0,1] before the RIFE call and back to [-1,1] for downstream save. --- modules/video_models/video_save.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/video_models/video_save.py b/modules/video_models/video_save.py index e75276935..8d194356a 100644 --- a/modules/video_models/video_save.py +++ b/modules/video_models/video_save.py @@ -273,9 +273,11 @@ def save_video( stream.output_queue.push(('progress', (None, 'Saving video...'))) if mp4_interpolate > 0: x = pixels.squeeze(0).permute(1, 0, 2, 3) + x = (x.clamp(-1., 1.) + 1.0) * 0.5 # RIFE expects [0, 1]; video pixels are [-1, 1] interpolated = rife.interpolate_nchw(x, count=mp4_interpolate+1) pixels = torch.stack(interpolated, dim=0) pixels = pixels.permute(1, 2, 0, 3, 4) + pixels = pixels * 2.0 - 1.0 # back to [-1, 1] for downstream save n, _c, t, h, w = pixels.shape x = torch.clamp(pixels.float(), -1., 1.) * 127.5 + 127.5