fix: Updates --prepend_frames logic
This commit is contained in:
+4
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user