Skip to content

Commit

Permalink
Add a test for codec-container combinations for video save
Browse files Browse the repository at this point in the history
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 <Daniel.Falk.1@FixedIT.ai>
  • Loading branch information
daniel-falk committed Jun 18, 2022
1 parent f36929c commit 33ebba9
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion tests/extras/datasets/video/test_video_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

0 comments on commit 33ebba9

Please sign in to comment.