Video editing with Python
Add test for detect_scenes (#589)
Roman Scherc62c8b181a7c
diff --git a/tests/test_videotools.py b/tests/test_videotools.pyindex 2609341c..0ed9dda3 100644--- a/tests/test_videotools.py+++ b/tests/test_videotools.py@@ -1,9 +1,11 @@# -*- coding: utf-8 -*-"""Video file clip tests meant to be run with pytest."""import os-import sys+from moviepy.video.VideoClip import ColorClip+from moviepy.video.compositing.concatenate import concatenate_videoclipsfrom moviepy.video.tools.credits import credits1+from moviepy.video.tools.cuts import detect_scenesfrom .test_helper import TMP_DIR, FONT@@ -38,3 +40,16 @@ def test_credits():image = image.set_duration(3)image.write_videofile(vid_location, fps=24)assert os.path.isfile(vid_location)+++def test_detect_scenes():+ """+ Test that a cut is detected between concatenated red and green clips+ """+ red = ColorClip((640, 480), color=(255, 0, 0)).set_duration(1)+ green = ColorClip((640, 480), color=(0, 200, 0)).set_duration(1)+ video = concatenate_videoclips([red, green])++ cuts, luminosities = detect_scenes(video, fps=10, logger=None)++ assert len(cuts) == 2