From 33ebba90f2b59bc74aca87a6b801900b37a134b4 Mon Sep 17 00:00:00 2001 From: Daniel Falk Date: Sat, 18 Jun 2022 17:10:51 +0200 Subject: [PATCH] Add a test for codec-container combinations for video save This makes it easier to see in e.g. CI jobs what combinations are supported on that specific platform since codecs are normally distributed separated from the libraries due to licensing issues. Signed-off-by: Daniel Falk --- .../datasets/video/test_video_dataset.py | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tests/extras/datasets/video/test_video_dataset.py b/tests/extras/datasets/video/test_video_dataset.py index 44e2cd0dfd..fda5582a7c 100644 --- a/tests/extras/datasets/video/test_video_dataset.py +++ b/tests/extras/datasets/video/test_video_dataset.py @@ -7,7 +7,7 @@ from PIL import ImageChops from kedro.extras.datasets.video import VideoDataSet -from kedro.extras.datasets.video.video_dataset import FileVideo +from kedro.extras.datasets.video.video_dataset import FileVideo, SequenceVideo from kedro.io import DataSetError S3_BUCKET_NAME = "test_bucket" @@ -108,3 +108,41 @@ def test_save_s3(self, mp4_object, mocked_s3_bucket, tmp_path): ) reloaded_video = FileVideo(str(tmp_file)) assert_videos_equal(reloaded_video, mp4_object) + + @pytest.mark.xfail + @pytest.mark.parametrize( + "fourcc, suffix", + [ + ("mp4v", "mp4"), + ("mp4v", "mjpeg"), + ("mp4v", "avi"), + ("avc1", "mp4"), + ("avc1", "mjpeg"), + ("avc1", "avi"), + ("mjpg", "mp4"), + ("mjpg", "mjpeg"), + ("mjpg", "avi"), + ("xvid", "mp4"), + ("xvid", "mjpeg"), + ("xvid", "avi"), + ("x264", "mp4"), + ("x264", "mjpeg"), + ("x264", "avi"), + ("divx", "mp4"), + ("divx", "mjpeg"), + ("divx", "avi"), + ("fmp4", "mp4"), + ("fmp4", "mjpeg"), + ("fmp4", "avi"), + ], + ) + def test_video_codecs(self, fourcc, suffix, color_video): + """Test different codec and container combinations + + Some of these are expected to fail depending on what + codecs are installed on the machine. + """ + video_name = "video.%s" % suffix + video = SequenceVideo(color_video._frames, 25, fourcc) + ds = VideoDataSet(video_name, fourcc=None) + ds.save(video)