From 22aa85abb701b63ba57c10bdfcd68686fc993824 Mon Sep 17 00:00:00 2001 From: Benjamin Herb Date: Thu, 21 Aug 2025 08:12:07 +0200 Subject: [PATCH] fix: Updates --prepend_frames logic --- inference_cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inference_cli.py b/inference_cli.py index 0e488ab..71a18c9 100644 --- a/inference_cli.py +++ b/inference_cli.py @@ -130,8 +130,10 @@ def extract_frames_from_video(video_path, skip_first_frames=0, load_cap=None, pr # preprend frames if requested (reverse of the first few frames) if prepend_frames > 0: - prepend_frames = min(prepend_frames, len(frames)) - frames = frames[-prepend_frames:] + frames + start_frames = [] + if prepend_frames >= len(frames): # repeat first (=last) frame + start_frames = [frames[-1]] * (prepend_frames - len(frames) + 1) + frames = start_frames + frames[prepend_frames:0:-1] + frames # Convert to tensor [T, H, W, C] and cast to Float16 for ComfyUI compatibility frames_tensor = torch.from_numpy(np.stack(frames)).to(torch.float16)