ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Align type of SaveAnimatedWEBP/PNG fps value with that of svd_img2vid_conditioning

Open Wendelstein7 opened this issue 2 years ago • 3 comments

By setting the fps parameter on the SaveAnimatedWEBP and SaveAnimatedPNG nodes to the int type, it is now consistent with the fps parameter of the SVD_img2vid_Conditioning and they can now share a single primitive controlling the value for both nodes.

Before: image After: image

Wendelstein7 avatar Jan 08 '24 21:01 Wendelstein7

WEBP and APNG can have fractional fps values so it doesn't make sense to make the fps an int.

comfyanonymous avatar Jan 08 '24 22:01 comfyanonymous

That's true, allthough it would be technically more accurate to say that they do not have fractional fps values but have frame durations as integer. (which is equivalent to a finite set of specific fps values) by the way they are stored now with your code:

pil_images[i].save(os.path.join(full_output_folder, file), save_all=True, duration=int(1000.0/fps), append_images=pil_images[i + 1:i + num_frames], exif=metadata, lossless=lossless, quality=quality, method=method)

(note the duration=int(1000.0/fps))

I think it would be reasonable to use an integer for storing the images, as this node currently is mainly in-use for the SVD-model which does only do integer fps values. (At least, I figured, but if not, we should change that to be a float instead)

What do you think, @comfyanonymous ?

Wendelstein7 avatar Jan 08 '24 22:01 Wendelstein7

Hi @comfyanonymous , I can understand that you're very busy but I'm still interested in hearing your position regarding my last message above :)

Wendelstein7 avatar Feb 16 '24 19:02 Wendelstein7

I'm not sure the goal here? The PR itself is wrong, the input needs to be a float, as eg 6.5 fps is perfectly valid (wherein int(1000.0/6.5) is 153 vs /6 is 166)

does the PIL Image.save duration= value take a float input? If so it could make sense to remove the int() conversion and feed a float into it.

mcmonkey4eva avatar May 17 '24 18:05 mcmonkey4eva