from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
from PIL import Image
import numpy as np
for i in range(10):
    frames = []
    for step in range(70):
        state_path = f'videos/IGNet/iter-{i}/state-{step}.bmp'
        image = Image.open(state_path).convert('RGB')
        frames.append(np.asarray(image))
    clip = ImageSequenceClip(frames, with_mask=True, fps=5)
    clip.write_videofile(f'videos/IGNet/iter-{i}/video.mp4', logger=None)