Comfy-Org / Comfy-Org/ComfyUI

SaveAnimatedWebP takes forever

Open
#13,300 8 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [ ] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

Execution time should be a few seconds.

### Actual Behavior

Execution time is about 2.5 minutes for a 120 frame image.

### Steps to Reproduce

Use official LTX2.3 two pass I2V video flow, add SaveToAnimatedWebP node from VAE decode images output.

### Debug Logs

```powershell
11:13:21.575728 -1
11:13:21.586866 -2
11:13:25.536638 -3
11:13:25.537434 -4
11:13:25.537691 -5
11:16:07.836907 -6
```

### Other

Added some debug statements in the code to get execution times of the sub node pieces in the above log file.
```

print(str(datetime.datetime.now().time())," -1")
"""Saves a batch of images as a single animated WebP."""
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
)
print(str(datetime.datetime.now().time())," -2")
pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
print(str(datetime.datetime.now().time())," -3")
pil_exif = ImageSaveHelper._create_webp_metadata(pil_images[0], cls)
print(str(datetime.datetime.now().time())," -4")
file = f"{filename}_{counter:05}_.webp"
print(str(datetime.datetime.now().time())," -5")
pil_images[0].save(
os.path.join(full_output_folder, file),
save_all=True,
duration=int(1000.0 / fps),
append_images=pil_images[1:],
exif=pil_exif,
lossless=lossless,
quality=quality,
method=method,
)
print(str(datetime.datetime.now().time())," -6")
return SavedResult(file, subfolder, folder_type)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.