Browse Source

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.
pull/165/head
Simon Conseil 11 years ago
parent
commit
b3ef364d79
  1. 2
      sigal/settings.py
  2. 27
      tests/test_video.py

2
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',

27
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)

Loading…
Cancel
Save