This commit is contained in:
WarpedAnimation
2025-05-24 01:21:09 -05:00
committed by GitHub
parent a6abe68ef4
commit ab04330026
-97
View File
@@ -3345,103 +3345,6 @@ class WarpedBundleVideoImages:
return (batched_images, first_image, last_image, int(batched_images.shape[0]), width, height, float(fps), )
# class WarpedBundleVideoImagesFramepack:
# @classmethod
# def INPUT_TYPES(s):
# return {"required":
# {"video_path": ("STRING", {"default": ""}),
# "starting_index": ("INT", {"default": 0}),
# "num_frames": ("INT", {"default": 301, "min": 5, "max": 1000001, "step": 4}),
# "use_gpu": ("BOOLEAN", {"default": True}),
# },
# }
# RETURN_TYPES = ("IMAGE", "IMAGE", "IMAGE", "INT", "INT", "INT", "FLOAT", )
# RETURN_NAMES = ("image_batch", "first_image", "last_image", "num_frames", "width", "height", "fps", )
# FUNCTION = "generate"
#
# CATEGORY = "Warped/Framepack/Video"
#
# def generate(self, video_path, starting_index, num_frames, use_gpu=False):
# if use_gpu:
# device = mm.get_torch_device()
# else:
# device = get_offload_device()
#
# print("WarpedBundleVideoImagesFramepack: device: {}".format(device))
#
# cap = cv2.VideoCapture(video_path)
#
# width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
# print('WarpedBundleVideoImagesFramepack: width = %d' % width)
# height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
# print('WarpedBundleVideoImagesFramepack: height = %d' % height)
# length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
# print('WarpedBundleVideoImagesFramepack: length = %d' % length)
# fps = float(cap.get(cv2.CAP_PROP_FPS))
# fps = round(fps)
# print('WarpedBundleVideoImagesFramepack: fps = %d' % fps)
#
# batched_images = None
# # print_it = True
# last_image = None
# first_image = None
#
# if starting_index > length:
# starting_index = 0
#
# if ((starting_index + num_frames) > length) or (num_frames == 0):
# num_frames = length - starting_index
#
# try:
# if starting_index > 0:
# cap.set(cv2.CAP_PROP_POS_FRAMES, starting_index)
#
# video_frames = []
# frame_count = 0
# for i in tqdm(range(num_frames), desc="Reading Video Frames: "):
# frame_count += 1
#
# # Take each frame
# _, frameorig = cap.read()
#
# color_coverted = cv2.cvtColor(frameorig, cv2.COLOR_BGR2RGB)
# video_frames.append(color_coverted)
#
# pil_image = Image.fromarray(video_frames[0])
# first_image = pil2tensorSwap(pil_image, device=device)
# first_image = first_image.to(get_offload_device())
#
# pil_image = Image.fromarray(video_frames[len(video_frames) - 1])
# last_image = pil2tensorSwap(pil_image, device=device)
# last_image = last_image.to(get_offload_device())
#
# for i in tqdm(range(len(video_frames)), desc="Preprocessing Video Frames: "):
# pil_image = Image.fromarray(video_frames[i])
# temp_image = pil2tensorSwap(pil_image, device=device)
#
# if len(temp_image.shape) < 4:
# temp_image = temp_image.unsqueeze(0)
#
# if not batched_images is None:
# batched_images = torch.cat((batched_images, temp_image), 0)
# else:
# batched_images = temp_image
#
# temp_image.to(get_offload_device())
# temp_image = None
# except:
# print("WarpedBundleVideoImagesFramepack: Exception During Video File Read.")
# finally:
# cap.release()
#
# batched_images = batched_images.to(get_offload_device())
#
# mm.soft_empty_cache()
# gc.collect()
# time.sleep(1)
#
# return (batched_images, first_image, last_image, int(batched_images.shape[0]), width, height, float(fps), )
class WarpedWanImageToVideo:
@classmethod
def INPUT_TYPES(s):