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.
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user