Skip to content

Commit

Permalink
Add warning when using movipy 2 and imageio < 2.29 when writing videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Jan 20, 2025
1 parent 677bd5f commit 4bcb03a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tensorboardX/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,22 @@ def make_video(tensor, fps):
import imageio
import moviepy.version
from packaging.version import Version
moviepy_version = Version(moviepy.version.__version__)
imageio_version = Version(imageio.__version__)

t, h, w, c = tensor.shape
# Warn about movipy and imageio incompatibility
if moviepy_version >= Version("2") and imageio_version < Version("2.29"):
logger.error(
"You are using moviepy >= 2.0.0 and imageio < 2.29.0. "
"This combination is known to cause issues when writing videos. "
"Please upgrade imageio to 2.29 or later or use moviepy < 2.0.0."
)

# Convert to RGB if moviepy v2/imageio>2.27 is used; 1-channel input is not supported.
if c == 1 and (
Version(moviepy.version.__version__) >= Version("2")
or Version(imageio.__version__) > Version("2.27")
moviepy_version >= Version("2")
or imageio_version > Version("2.27")
):
tensor = np.repeat(tensor, 3, axis=-1)
# encode sequence of images into gif string
Expand Down

0 comments on commit 4bcb03a

Please sign in to comment.