fix: Updates --prepend_frames logic

This commit is contained in:
Benjamin Herb
2025-08-21 08:12:07 +02:00
parent 1a12465588
commit 22aa85abb7
+4 -2
View File
@@ -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)