Kosinkadink / ComfyUI-VideoHelperSuite

Nodes related to video workflows
GNU General Public License v3.0
414 stars 74 forks source link

Load Images (Path) and/or Load Video (Path) Not Working #224

Open AtomicPerception opened 1 month ago

AtomicPerception commented 1 month ago

It's simple to recreate. Make a folder on your desktop, drop in some valid images, and then try to load the images in the folder using the Load Images (Path) node. The node will consistently error out on a valid path.

toyxyz commented 1 month ago

Same here! image

nothingness6 commented 1 month ago

Oh, I think there is a critical bug for path from the recent update.

Kosinkadink commented 1 month ago

Putting aside the in_place thing that was due to and then fixed in recent commits, I am unable to reproduce the bug with paths not working - here is me trying out both Load Video (Path) and Load Images (Path) with videos/folders that are in arbitrary locations: image

Only thing that causes an issue is for example having quotes at the start and end of the string - quotes used to be stripped automatically in the past, but I think that may have accidentally been removed as a side effect of the frontend being responsible for more things. @AustinMroz can we bring back stripping of quotes from the beginning and end of paths? In Windows at least, copying the paths of a folder/file will result in quotes surrounding it, so it will make it easier to use.

As for the bug, let's congregate all of the other related issues into this one so we don't have 3 separate issue reports. Anyone who is experiencing the bug, please provide your operating system, the string you were trying to input, and a screenshot of your particular (Path) node.

Also, try things like not having any widgets turned into inputs for the (Path) nodes to see if that somehow makes the error not happen, and make sure VHS is updated to the most recent version before doing anything else.

Kosinkadink commented 1 month ago

One thing to clarify, the path the node is trying to read is based on the paths available on the system that is running the ComfyUI instance, not the system that is running the browser. I don't think anyone here was confused by that, but just wanted to clarify in case it was the case for someone.

Only thing I can think of being a cause is either stray characters in the name, or something with the javascript layer. To make it easier to test, also see if you have Advanced Previews on in the ComfyUI settings menu: image (the settings menu can be accessed by clicking the gear icon by Queue Prompt): image

See if having that on or off impacts if the node works.

Kosinkadink commented 1 month ago

@bkmikaelo7 @itsklimov tagging you guys since you also experienced the issue in the past

AustinMroz commented 1 month ago

I'm looking into it. As far as I can tell from a quick scan of the revision history, Load Images (Path) has only ever had white space stripping applied, but Load Video (Path) and Load Audio (Path) (still) perform only quote stripping. I support the convenience of quote stripping, and will work on a patch to standardize the stripping of both quotes and whitespace across all nodes.

Edit: I can confirm that quote stripping is not currently applied at runtime.

AustinMroz commented 1 month ago

I've pushed a fairly robust rework of path stripping. From what error logs I've seen posted, I don't think it will be enough to resolve all of the reported issues, but it should provide nice QOL.

Forgot to bump version though. Will do so soon once I resolve unrelated bugs I encountered in testing this.

Edit: After a massive rabbit hole, the version has been bumped and path stripping changes are available to any using the comfy registry.

stephennilor commented 4 weeks ago

I seem to be getting this error every time on one of my two systems, but also with the (Upload) node. Have tried with a few different files, but the node was previously working, and still does on the other system which is still on a previous commit. Here's the details:

Path (that probs has the most problematic characters): G:\Shared drives\xxxxx\working files\Stephen\Bread Roll\bread-roll_00005.mp4 [xxxx bit omitted for security, note that this is a GDrive... which still loads fine on the other commit]

Commit not working: 08dc3d63a76942c0bdfd8492a50d1585e5252149 Commit on working system: acbf789291e5400f590378aac75909f28b8e7afb

both Win11

So i tried to checkout the commit that is working and the error persists, even when creating a new workflow (wondered if node version was getting cached if not) but on the messed up system, still messed up. Very confused...

Edit: Further details of the error trace: raise ValueError(f"{video} could not be loaded with cv.") and G:\Shared drives\xxxxxxx\working files\Stephen\Bread Roll\bread-roll_00005.mp4 could not be loaded with cv.

AustinMroz commented 3 weeks ago

Thanks for the detailed response. Between the listed commits, there hasn't been any change to the front end code, so I don't think there is risk of caching. I suspect there was a change or update to opencv-python that broke things for you. There have been weird issues with opencv I've not been able to reproduce before, but I'd start with comparing the opencv version between your systems.

xxBLUECATxx commented 3 weeks ago

Same/related issue happened when I try to use the Load Video (Path) in this workflow in AutoDL cloud server.

The workflow: https://civitai.com/models/372584/ipivs-morph-img2vid-animatediff-lcm-hyper-sd

The video link: https://i.imgur.com/FZojh3v.mp4 Error: Screenshot 2024-06-11 164426

Try saving the video to the storage, use local path, different error code:

!!! Exception during processing!!! 'NoneType' object has no attribute 'shape' Traceback (most recent call last): File "/root/autodl-tmp/root/ComfyUI/execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/root/autodl-tmp/root/ComfyUI/execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/root/autodl-tmp/root/ComfyUI/execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "/root/autodl-tmp/root/ComfyUI/nodes.py", line 1346, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "/root/autodl-tmp/root/ComfyUI/nodes.py", line 1316, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 419, in motion_sample latents = orig_comfy_sample(model, noise, *args, *kwargs) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control_reference.py", line 47, in refcn_sample return orig_comfy_sample(model, args, kwargs) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 111, in uncond_multiplier_check_cn_sample return orig_comfy_sample(model, args, kwargs) File "/root/autodl-tmp/root/ComfyUI/comfy/sample.py", line 43, in sample samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 794, in sample return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 696, in sample return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 683, in sample output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 662, in inner_sample samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 567, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, self.extra_options) File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "/root/autodl-tmp/root/ComfyUI/comfy/k_diffusion/sampling.py", line 762, in sample_lcm denoised = model(x, sigmas[i] * s_in, *extra_args) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 291, in call out = self.inner_model(x, sigma, model_options=model_options, seed=seed) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 649, in call return self.predict_noise(args, kwargs) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 652, in predict_noise return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 456, in evolved_sampling_function cond_pred, uncond_pred = sliding_calc_condsbatch(model, [cond, uncond], x, timestep, model_options) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 593, in sliding_calc_conds_batch sub_conds_out = calc_cond_uncond_batch_wrapper(model, sub_conds, sub_x, sub_timestep, model_options) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 653, in calc_cond_uncond_batch_wrapper return comfy.samplers.calc_cond_batch(model, conds, x_in, timestep, model_options) File "/root/autodl-tmp/root/ComfyUI/comfy/samplers.py", line 200, in calc_cond_batch c['control'] = control.get_control(inputx, timestep, c, len(cond_or_uncond)) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 706, in get_control_inject return self.get_control_advanced(x_noisy, t, cond, batched_number) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 34, in get_control_advanced return self.sliding_get_control(x_noisy, t, cond, batched_number) File "/root/autodl-tmp/root/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 83, in sliding_get_control control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(dtype), y=y) File "/root/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/root/autodl-tmp/root/ComfyUI/comfy/cldm/cldm.py", line 296, in forward assert y.shape[0] == x.shape[0] AttributeError: 'NoneType' object has no attribute 'shape'

Prompt executed in 4.56 seconds

Bastian4523 commented 3 weeks ago

This is the error I'm getting. Turning advanced previews on or off has no impact. Error occurred when executing VHS_LoadVideo:

PdhAddEnglishCounterW failed. Performance counters may be disabled.

File "D:\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "D:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\videohelpersuite\load_video_nodes.py", line 230, in load_video return load_video_cv(kwargs) File "D:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\videohelpersuite\load_video_nodes.py", line 144, in load_video_cv memory_limit = (psutil.virtual_memory().available + psutil.swap_memory().free) - 2 ** 27 File "D:\ComfyUI\python_embeded\lib\site-packages\psutil__init__.py", line 1992, in swap_memory return _psplatform.swap_memory() File "D:\ComfyUI\python_embeded\lib\site-packages\psutil_pswindows.py", line 257, in swap_memory percentswap = cext.swap_percent()

stephennilor commented 3 weeks ago

I seem to be getting this error every time on one of my two systems, but also with the (Upload) node. Have tried with a few different files, but the node was previously working, and still does on the other system which is still on a previous commit. Here's the details:

Path (that probs has the most problematic characters): G:\Shared drives\xxxxx\working files\Stephen\Bread Roll\bread-roll_00005.mp4 [xxxx bit omitted for security, note that this is a GDrive... which still loads fine on the other commit]

Commit not working: 08dc3d63a76942c0bdfd8492a50d1585e5252149 Commit on working system: acbf789291e5400f590378aac75909f28b8e7afb

both Win11

So i tried to checkout the commit that is working and the error persists, even when creating a new workflow (wondered if node version was getting cached if not) but on the messed up system, still messed up. Very confused...

Edit: Further details of the error trace: raise ValueError(f"{video} could not be loaded with cv.") and G:\Shared drives\xxxxxxx\working files\Stephen\Bread Roll\bread-roll_00005.mp4 could not be loaded with cv.

Thanks for the detailed response. Between the listed commits, there hasn't been any change to the front end code, so I don't think there is risk of caching. I suspect there was a change or update to opencv-python that broke things for you. There have been weird issues with opencv I've not been able to reproduce before, but I'd start with comparing the opencv version between your systems.

It does seem my issue appears to have resolved by manually uninstalling and installing opencv-python. Thanks!

AustinMroz commented 3 weeks ago

@Bastian4523, Your issue appears to be the result of corrupt performance counters (More info here). I'll push a quick commit to handle this more gracefully (by simply disabling the memory limit with a warning).

CrazyIpMaster commented 3 weeks ago

If you don't add the quotes you will still get the error.

微信图片_20240614091123

samueljwilkes commented 2 weeks ago

If you don't add the quotes you will still get the error.

微信图片_20240614091123

I am usure if its related or not, but I had similar issues to the screenshot you just shared. Replacing the vhs nodes with new ones appear to have fixed it.