Preserve string video_size options on inputs

Assisted-by: OpenAI Codex
This commit is contained in:
曾楚笑 2026-09-23 05:13:25 +08:00
parent df129c7ba3
commit 7ddec85753
2 changed files with 18 additions and 1 deletions

View File

@ -42,7 +42,9 @@ def _get_input_args(input_node):
if fmt:
args += ['-f', fmt]
if video_size:
args += ['-video_size', '{}x{}'.format(video_size[0], video_size[1])]
if not isinstance(video_size, basestring):
video_size = '{}x{}'.format(video_size[0], video_size[1])
args += ['-video_size', video_size]
args += convert_kwargs_to_cmd_line_args(kwargs)
args += ['-i', filename]
else:

View File

@ -372,6 +372,21 @@ def test__output__video_size(video_size):
assert args == ['-i', 'in', '-video_size', '320x240', 'out']
@pytest.mark.parametrize(
'video_size,expected',
[
((320, 240), '320x240'),
([320, 240], '320x240'),
('320x240', '320x240'),
('1920x1080', '1920x1080'),
('hd720', 'hd720'),
],
)
def test__input__video_size(video_size, expected):
args = ffmpeg.input('in', video_size=video_size).output('out').get_args()
assert args == ['-video_size', expected, '-i', 'in', 'out']
def test_filter_normal_arg_escape():
"""Test string escaping of normal filter args (e.g. ``font`` param of ``drawtext``
filter).