From b3ef364d791d5977eb85db762446988ca4b7cf76 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 14 Jun 2015 00:38:45 +0200 Subject: [PATCH] Pass mp4_options to the tests using generate_video. Otherwise ffmpeg might fail if it doesn't get the -strict -2 option for the aac encoder. --- sigal/settings.py | 2 +- tests/test_video.py | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sigal/settings.py b/sigal/settings.py index 39380c4..e59e762 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -70,7 +70,7 @@ _DEFAULT_CONFIG = { 'video_format': 'webm', 'webm_options': ['-crf', '10', '-b:v', '1.6M', '-qmin', '4', '-qmax', '63'], - 'mp4_options': ['-crf', '23', '-strict', '-2' ], + 'mp4_options': ['-crf', '23', '-strict', '-2'], 'write_html': True, 'zip_gallery': False, 'zip_media_format': 'resized', diff --git a/tests/test_video.py b/tests/test_video.py index 2841052..368c8de 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -17,17 +17,16 @@ def test_video_size(): size_src = video_size(SRCFILE) assert size_src == (480, 270) -@pytest.mark.parametrize("fmt", [ - ('webm'), - ('mp4') -]) + +@pytest.mark.parametrize("fmt", ['webm', 'mp4']) def test_generate_video_fit_height(tmpdir, fmt): """largest fitting dimension is height""" base, ext = os.path.splitext(TEST_VIDEO) dstfile = str(tmpdir.join(base + '.' + fmt)) settings = create_settings(video_size=(50, 100), video_format=fmt) - generate_video(SRCFILE, dstfile, settings) + generate_video(SRCFILE, dstfile, settings, + options=settings[fmt + '_options']) size_src = video_size(SRCFILE) size_dst = video_size(dstfile) @@ -36,17 +35,16 @@ def test_generate_video_fit_height(tmpdir, fmt): # less than 2% error on ratio assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2 -@pytest.mark.parametrize("fmt", [ - ('webm'), - ('mp4') -]) + +@pytest.mark.parametrize("fmt", ['webm', 'mp4']) def test_generate_video_fit_width(tmpdir, fmt): """largest fitting dimension is width""" base, ext = os.path.splitext(TEST_VIDEO) dstfile = str(tmpdir.join(base + '.' + fmt)) settings = create_settings(video_size=(100, 50), video_format=fmt) - generate_video(SRCFILE, dstfile, settings) + generate_video(SRCFILE, dstfile, settings, + options=settings[fmt + '_options']) size_src = video_size(SRCFILE) size_dst = video_size(dstfile) @@ -55,17 +53,16 @@ def test_generate_video_fit_width(tmpdir, fmt): # less than 2% error on ratio assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2 -@pytest.mark.parametrize("fmt", [ - ('webm'), - ('mp4') -]) + +@pytest.mark.parametrize("fmt", ['webm', 'mp4']) def test_generate_video_dont_enlarge(tmpdir, fmt): """video dimensions should not be enlarged""" base, ext = os.path.splitext(TEST_VIDEO) dstfile = str(tmpdir.join(base + '.' + fmt)) settings = create_settings(video_size=(1000, 1000), video_format=fmt) - generate_video(SRCFILE, dstfile, settings) + generate_video(SRCFILE, dstfile, settings, + options=settings[fmt + '_options']) size_src = video_size(SRCFILE) size_dst = video_size(dstfile)