ForeignGods / ComfyUI-Mana-Nodes

Font Animation, Automatic Speech Recognition and Text to Speech Custom Nodes for ComfyUI
MIT License
209 stars 12 forks source link

Potentially small error in time to frame aligment in font2img_node #23

Closed Quasimondo closed 5 months ago

Quasimondo commented 5 months ago

I am not sure if this is just due to the way I use this node, but I was struggling with the issue that the very first word would never get rendered if it starts at start time 0.0. The reason seems to be in the format_transcription() method where it calculates

frame_number = round(start_time * transcription_fps)

It looks to me like it assumes that frame numbering starts at 0, but further down in the generate_images() code the first frame is 1:

for i in range(1, frame_count + 1):

So my fix is to add 1 to frame_number which seems to work: frame_number = 1 + round(start_time * transcription_fps)

ForeignGods commented 5 months ago

The intended logic is to start the frame numbering at 1. So you're right for spotting this error, thank you. You could submit a pull request, so I can merge the solution you proposed. Or else I'll just make the fix myself.

Anyway thanks again for reaching out.

Quasimondo commented 5 months ago

Happy to help! And I just submitted the pull request.