Posts

Showing posts from 2024

Convert animated WEBP to MP4

 Animated WebP, similar to animated GIF, is not the best video format to work with, but this is what the usual SVD (image or text to video) and ComfyUI will generate. Unfortunately, FFMPEG does not support WebP to MP4 conversion yet, so this simple frame-by-frame conversation had to be done. As it's generating a PNG for each frame, it's rather slow, so it's only suitable for short animations. The below simple python code converts the animated WebP into MP4, using the predefined FPS. Don't forget to  pip3 install pillow   moviepy import os import shutil import tempfile import argparse from moviepy.video.io.ImageSequenceClip import ImageSequenceClip import PIL.Image def analyse_image (path): im = PIL . Image . open(path) results = { 'size' : im . size, 'mode' : 'full' , } try : while True : if im . tile: tile = im . tile[ 0 ] update_region = t