Comfy-Org / Comfy-Org/ComfyUI

Specify content type in executed output messages

Open
#7,111 0 comments 1 reaction 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Feature Idea

Currently there is an `animated` field being used for webm and animated webp:

https://github.com/comfyanonymous/ComfyUI/blob/1650cda030daa32c9d12a5d92c02663bd076b071/comfy_extras/nodes_images.py#L191

https://github.com/comfyanonymous/ComfyUI/blob/1650cda030daa32c9d12a5d92c02663bd076b071/comfy_extras/nodes_images.py#L138

https://github.com/comfyanonymous/ComfyUI/blob/5d84607bf3a761d796fb0cf3b6fdba8480ead5f7/comfy_extras/nodes_video.py#L74

webp and webm need separate handling so `animated` doesn't help much for the frontend.

In general, the client wants to know the mime type before the request for the resource is actually made, but can only infer from the outputs being in either `images` or `audio` or from filename. To reduce burden on client and improve API, either add a field to denote mime type or add `videos` field.

1. Just add `videos` field for quick solution:

```diff
results: list[FileLocator] = [{
"filename": file,
"subfolder": subfolder,
"type": self.type
}]

+ return {"ui": {"videos": results, "animated": (True,)}}
```

2. Use a field to denote mime type and keep everything in `images`:

```diff
results: list[FileLocator] = [{
"filename": file,
"subfolder": subfolder,
"type": self.type
+ "mimeType" : "video/webm"
}]

return {"ui": {"images": results, "animated": (True,)}}
```

### Existing Solutions

_No response_

### Other

_No response_

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.