Video editing with Python
Fix incorrect behaviour from BitmapClip when fps != 1 (#1333)
Tom Burrows873530e506c6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0c6298e0..4729aa19 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Removed <!-- for now removed features -->### Fixed <!-- for any bug fixes -->+- Fixed BitmapClip with fps != 1 not returning the correct frames or crashing [#1333]## [v2.0.0.dev2](https://github.com/zulko/moviepy/tree/v2.0.0.dev2)diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 6c29ce38..3fcd92f0 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -1411,7 +1411,7 @@ class BitmapClip(VideoClip):VideoClip.__init__(self,- make_frame=lambda t: frame_array[int(t)],+ make_frame=lambda t: frame_array[int(t * fps)],ismask=ismask,duration=duration,)diff --git a/tests/test_BitmapClip.py b/tests/test_BitmapClip.pyindex b4eb2d8c..527f3e99 100644--- a/tests/test_BitmapClip.py+++ b/tests/test_BitmapClip.py@@ -45,5 +45,15 @@ def test_setting_duration():assert clip.duration == 6+def test_to_bitmap():+ bitmap = [["R"], ["R"], ["B"], ["B"], ["G"], ["G"]]+ clip1 = BitmapClip(bitmap, fps=0.345)+ clip2 = BitmapClip(bitmap, fps=1)+ clip3 = BitmapClip(bitmap, fps=3.12345)+ assert bitmap == clip1.to_bitmap()+ assert bitmap == clip2.to_bitmap()+ assert bitmap == clip3.to_bitmap()++if __name__ == "__main__":pytest.main()