mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-27 12:30:55 +02:00
e5851ac308
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tbcd6VWCiU4BQP1gywPr2a
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
from shutil import which
|
|
|
|
from facefusion import ffprobe_builder
|
|
from facefusion.ffprobe_builder import chain, format_to_key_value, run, select_stream, set_input, show_format_entries, show_stream_entries
|
|
|
|
|
|
def test_run() -> None:
|
|
assert run([ '-v', 'error' ]) == [ which('ffprobe'), '-loglevel', 'error', '-v', 'error' ]
|
|
|
|
|
|
def test_chain() -> None:
|
|
assert chain(
|
|
ffprobe_builder.select_stream('v:0'),
|
|
ffprobe_builder.show_stream_entries([ 'duration' ]),
|
|
ffprobe_builder.format_to_key_value(),
|
|
ffprobe_builder.set_input('target.mp4')
|
|
) == [ '-select_streams', 'v:0', '-show_entries', 'stream=duration', '-of', 'default=noprint_wrappers=1', '-i', 'target.mp4' ]
|
|
|
|
|
|
def test_select_stream() -> None:
|
|
assert select_stream('v:0') == [ '-select_streams', 'v:0' ]
|
|
assert select_stream('a:0') == [ '-select_streams', 'a:0' ]
|
|
|
|
|
|
def test_show_stream_entries() -> None:
|
|
assert show_stream_entries([ 'duration' ]) == [ '-show_entries', 'stream=duration' ]
|
|
assert show_stream_entries([ 'duration', 'width' ]) == [ '-show_entries', 'stream=duration,width' ]
|
|
|
|
|
|
def test_show_format_entries() -> None:
|
|
assert show_format_entries([ 'duration' ]) == [ '-show_entries', 'format=duration' ]
|
|
assert show_format_entries([ 'duration', 'bit_rate' ]) == [ '-show_entries', 'format=duration,bit_rate' ]
|
|
|
|
|
|
def test_format_to_key_value() -> None:
|
|
assert format_to_key_value() == [ '-of', 'default=noprint_wrappers=1' ]
|
|
|
|
|
|
def test_set_input() -> None:
|
|
assert set_input('input.mp3') == [ '-i', 'input.mp3' ]
|
|
assert set_input('input.wav') == [ '-i', 'input.wav' ]
|