Video editing with Python
Fix rotation in multiples of 90 degrees (#1335)
Nico00a9ef8b8f6c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d4c5165e..b916eb46 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed <!-- for any bug fixes -->- Fixed BitmapClip with fps != 1 not returning the correct frames or crashing [#1333]+- Fixed `rotate` sometimes failing with `ValueError: axes don't match array` [#1335]## [v2.0.0.dev2](https://github.com/zulko/moviepy/tree/v2.0.0.dev2)diff --git a/moviepy/video/fx/rotate.py b/moviepy/video/fx/rotate.pyindex 65e638b0..aa63a7e4 100644--- a/moviepy/video/fx/rotate.py+++ b/moviepy/video/fx/rotate.py@@ -62,8 +62,6 @@ def rotate(clip, angle, unit="deg", resample="bicubic", expand=True):def get_angle(t):return angle- transpose = [1, 0] if clip.is_mask else [1, 0, 2]-def filter(get_frame, t):angle = get_angle(t)@@ -72,6 +70,8 @@ def rotate(clip, angle, unit="deg", resample="bicubic", expand=True):if unit == "rad":angle = 360.0 * angle / (2 * np.pi)+ transpose = [1, 0] if len(im.shape) == 2 else [1, 0, 2]+angle %= 360if (angle == 0) and expand:return im