(frames, save_path, fps=30, quality=5)
| 40 | return t.to(dtype) |
| 41 | |
| 42 | def save_video(frames, save_path, fps=30, quality=5): |
| 43 | os.makedirs(os.path.dirname(save_path), exist_ok=True) |
| 44 | w = imageio.get_writer(save_path, fps=fps, quality=quality) |
| 45 | for f in tqdm(frames, desc=f"Saving {os.path.basename(save_path)}"): |
| 46 | w.append_data(np.array(f)) |
| 47 | w.close() |
| 48 | |
| 49 | def compute_scaled_and_target_dims(w0: int, h0: int, scale: float = 4.0, multiple: int = 128): |
| 50 | if w0 <= 0 or h0 <= 0: |