mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-28 21:08:54 +02:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11bbc89a0e | ||
|
|
0ce48da740 | ||
|
|
2c72bb21c8 | ||
|
|
280713ed13 | ||
|
|
3834e3856a | ||
|
|
ac9f514d60 |
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workflow]
|
||||
workflow =
|
||||
workflow_mode =
|
||||
|
||||
[paths]
|
||||
temp_path =
|
||||
|
||||
@@ -15,6 +15,6 @@ async def get_capabilities(request : Request) -> JSONResponse:
|
||||
'image': facefusion.choices.image_formats,
|
||||
'video': facefusion.choices.video_formats
|
||||
},
|
||||
'arguments': capability_store.get_api_capability_group()
|
||||
'arguments': capability_store.get_api_capability_set()
|
||||
}
|
||||
return JSONResponse(capabilities, status_code = HTTP_200_OK)
|
||||
|
||||
@@ -11,7 +11,7 @@ from facefusion.vision import detect_video_fps
|
||||
|
||||
def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None:
|
||||
apply_state_item('command', args.get('command'))
|
||||
apply_state_item('workflow', args.get('workflow'))
|
||||
apply_state_item('workflow_mode', args.get('workflow_mode'))
|
||||
apply_state_item('temp_path', args.get('temp_path'))
|
||||
apply_state_item('jobs_path', args.get('jobs_path'))
|
||||
apply_state_item('source_paths', args.get('source_paths'))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from argparse import Action
|
||||
from typing import Dict, List
|
||||
|
||||
from facefusion.types import CapabilityGroup, CapabilitySet, CapabilityStore, Group, Scope
|
||||
from facefusion.types import CapabilitySet, CapabilityStore, Scope
|
||||
|
||||
CAPABILITY_STORE : CapabilityStore =\
|
||||
{
|
||||
@@ -11,16 +11,6 @@ CAPABILITY_STORE : CapabilityStore =\
|
||||
}
|
||||
|
||||
|
||||
def get_api_capability_group() -> CapabilityGroup:
|
||||
capability_group : CapabilityGroup = {}
|
||||
|
||||
for name, value in CAPABILITY_STORE.get('api').items():
|
||||
for group in value.get('groups'):
|
||||
capability_group.setdefault(group, {})[name] = value
|
||||
|
||||
return capability_group
|
||||
|
||||
|
||||
def get_api_capability_set() -> Dict[str, CapabilitySet]:
|
||||
return CAPABILITY_STORE.get('api')
|
||||
|
||||
@@ -45,12 +35,11 @@ def get_sys_arguments() -> List[str]:
|
||||
return list(get_sys_capability_set().keys())
|
||||
|
||||
|
||||
def register_capability_set(actions : List[Action], scopes : List[Scope], groups : List[Group]) -> None:
|
||||
def register_capability_set(actions : List[Action], scopes : List[Scope]) -> None:
|
||||
for action in actions:
|
||||
value : CapabilitySet =\
|
||||
{
|
||||
'default': action.default,
|
||||
'groups': groups
|
||||
'default': action.default
|
||||
}
|
||||
|
||||
if action.choices:
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
from typing import List, Sequence, get_args
|
||||
|
||||
from facefusion.common_helper import create_float_range, create_int_range
|
||||
from facefusion.types import Angle, ApiSecurityStrategy, AudioEncoder, AudioFormat, AudioSet, BenchmarkMode, BenchmarkResolution, BenchmarkSet, DownloadProvider, DownloadProviderSet, DownloadScope, ExecutionProvider, ExecutionProviderSet, FaceDetectorModel, FaceDetectorSet, FaceLandmarkerModel, FaceMaskArea, FaceMaskAreaSet, FaceMaskRegion, FaceMaskRegionSet, FaceMaskType, FaceOccluderModel, FaceParserModel, FaceSelectorGender, FaceSelectorMode, FaceSelectorOrder, FaceSelectorRace, Gender, ImageEncoder, ImageFormat, ImageSet, JobStatus, LogLevel, LogLevelSet, Race, Score, TempFrameFormat, VideoEncoder, VideoFormat, VideoMemoryStrategy, VideoPreset, VideoSet, VoiceExtractorModel, WorkFlow
|
||||
from facefusion.types import Angle, ApiSecurityStrategy, AudioEncoder, AudioFormat, AudioSet, BenchmarkMode, BenchmarkResolution, BenchmarkSet, DownloadProvider, DownloadProviderSet, DownloadScope, ExecutionProvider, ExecutionProviderSet, FaceDetectorModel, FaceDetectorSet, FaceLandmarkerModel, FaceMaskArea, FaceMaskAreaSet, FaceMaskRegion, FaceMaskRegionSet, FaceMaskType, FaceOccluderModel, FaceParserModel, FaceSelectorGender, FaceSelectorMode, FaceSelectorOrder, FaceSelectorRace, Gender, ImageEncoder, ImageFormat, ImageSet, JobStatus, LogLevel, LogLevelSet, Race, Score, TempFrameFormat, VideoEncoder, VideoFormat, VideoMemoryStrategy, VideoPreset, VideoSet, VoiceExtractorModel, WorkflowMode
|
||||
|
||||
face_detector_set : FaceDetectorSet =\
|
||||
{
|
||||
@@ -47,7 +47,7 @@ face_mask_regions : List[FaceMaskRegion] = list(get_args(FaceMaskRegion))
|
||||
|
||||
voice_extractor_models : List[VoiceExtractorModel] = list(get_args(VoiceExtractorModel))
|
||||
|
||||
workflows : List[WorkFlow] = [ 'auto', 'audio-to-image:frames', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames' ]
|
||||
workflow_modes : List[WorkflowMode] = [ 'auto', 'audio-to-image:frames', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames' ]
|
||||
|
||||
audio_set : AudioSet =\
|
||||
{
|
||||
|
||||
+9
-9
@@ -19,7 +19,7 @@ from facefusion.jobs.job_list import compose_job_list
|
||||
from facefusion.processors.core import get_processors_modules
|
||||
from facefusion.program import create_program
|
||||
from facefusion.program_helper import validate_args
|
||||
from facefusion.types import Args, ErrorCode, WorkFlow
|
||||
from facefusion.types import Args, ErrorCode, WorkflowMode
|
||||
from facefusion.workflows import audio_to_image, audio_to_image_as_frames, image_to_image, image_to_video, image_to_video_as_frames
|
||||
|
||||
|
||||
@@ -317,28 +317,28 @@ def process_step(job_id : str, step_index : int, step_args : Args) -> bool:
|
||||
def conditional_process() -> ErrorCode:
|
||||
start_time = time()
|
||||
|
||||
if state_manager.get_item('workflow') == 'auto':
|
||||
state_manager.set_item('workflow', detect_workflow())
|
||||
if state_manager.get_item('workflow_mode') == 'auto':
|
||||
state_manager.set_item('workflow_mode', detect_workflow_mode())
|
||||
|
||||
for processor_module in get_processors_modules(state_manager.get_item('processors')):
|
||||
if not processor_module.pre_process('output'):
|
||||
return 2
|
||||
|
||||
if state_manager.get_item('workflow') == 'audio-to-image:video':
|
||||
if state_manager.get_item('workflow_mode') == 'audio-to-image:video':
|
||||
return audio_to_image.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'audio-to-image:frames':
|
||||
if state_manager.get_item('workflow_mode') == 'audio-to-image:frames':
|
||||
return audio_to_image_as_frames.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-image':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-image':
|
||||
return image_to_image.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
return image_to_video.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-video:frames':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video:frames':
|
||||
return image_to_video_as_frames.process(start_time)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def detect_workflow() -> WorkFlow:
|
||||
def detect_workflow_mode() -> WorkflowMode:
|
||||
if has_video([ state_manager.get_item('target_path') ]):
|
||||
if get_file_extension(state_manager.get_item('output_path')):
|
||||
return 'image-to-video'
|
||||
|
||||
@@ -17,10 +17,6 @@ def show_entries(entries : List[str]) -> List[Command]:
|
||||
return [ '-show_entries', 'stream=' + ','.join(entries) ]
|
||||
|
||||
|
||||
def format_to_value() -> List[Command]:
|
||||
return [ '-of', 'default=noprint_wrappers=1:nokey=1' ]
|
||||
|
||||
|
||||
def format_to_key_value() -> List[Command]:
|
||||
return [ '-of', 'default=noprint_wrappers=1' ]
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ LOCALES : Locales =\
|
||||
{
|
||||
'install_dependency': 'choose the variant of {dependency} to install',
|
||||
'skip_conda': 'skip the conda environment check',
|
||||
'workflow': 'choose the workflow',
|
||||
'workflow_mode': 'choose the workflow mode',
|
||||
'config_path': 'choose the config file to override defaults',
|
||||
'temp_path': 'specify the directory for the temporary resources',
|
||||
'jobs_path': 'specify the directory to store jobs',
|
||||
|
||||
@@ -142,8 +142,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_int_metavar(age_modifier_choices.age_modifier_direction_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'age_modifier' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -171,7 +170,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -519,8 +519,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'background_remover' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -549,7 +548,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -294,8 +294,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_int_metavar(deep_swapper_choices.deep_swapper_morph_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'deep_swapper' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -325,7 +324,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -125,8 +125,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = 'EXPRESSION_RESTORER_AREAS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'expression_restorer' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -158,7 +157,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -44,8 +44,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = 'FACE_DEBUGGER_ITEMS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_debugger' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -68,7 +67,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -251,8 +251,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_float_metavar(face_editor_choices.face_editor_head_roll_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_editor' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -293,7 +292,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -319,8 +319,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_float_metavar(face_enhancer_choices.face_enhancer_weight_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_enhancer' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -349,7 +348,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -537,8 +537,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
choices = face_swapper_choices.face_swapper_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_swapper' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
known_args, _ = program.parse_known_args()
|
||||
face_swapper_pixel_boost_choices = face_swapper_choices.face_swapper_set.get(known_args.face_swapper_model)
|
||||
@@ -558,8 +557,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
choices = face_swapper_choices.face_swapper_weight_range
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_swapper' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -601,7 +599,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -211,8 +211,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_int_metavar(frame_colorizer_choices.frame_colorizer_blend_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_colorizer' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -241,7 +240,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -599,8 +599,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_int_metavar(frame_enhancer_choices.frame_enhancer_blend_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_enhancer' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -628,7 +627,7 @@ def pre_process(mode : ProcessMode) -> bool:
|
||||
if mode in [ 'output', 'preview' ] and not is_image(state_manager.get_item('target_path')) and not is_video(state_manager.get_item('target_path')):
|
||||
logger.error(translator.get('choose_image_or_video_target') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:video', 'image-to-image', 'image-to-video' ]:
|
||||
if mode == 'output' and not in_directory(state_manager.get_item('output_path')):
|
||||
logger.error(translator.get('specify_image_or_video_output') + translator.get('exclamation_mark'), __name__)
|
||||
return False
|
||||
|
||||
@@ -151,8 +151,7 @@ def register_args(program : ArgumentParser) -> None:
|
||||
metavar = create_float_metavar(lip_syncer_choices.lip_syncer_weight_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'lip_syncer' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
|
||||
|
||||
+65
-125
@@ -32,8 +32,7 @@ def create_config_path_program() -> ArgumentParser:
|
||||
default = 'facefusion.ini'
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
apply_config_path(program)
|
||||
@@ -47,14 +46,13 @@ def create_workflow_program() -> ArgumentParser:
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
group_paths.add_argument(
|
||||
'--workflow',
|
||||
help = translator.get('help.workflow'),
|
||||
default = config.get_str_value('workflow', 'workflow', 'auto'),
|
||||
choices = facefusion.choices.workflows
|
||||
'--workflow-mode',
|
||||
help = translator.get('help.workflow_mode'),
|
||||
default = config.get_str_value('workflow', 'workflow_mode', 'auto'),
|
||||
choices = facefusion.choices.workflow_modes
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -72,8 +70,7 @@ def create_temp_path_program() -> ArgumentParser:
|
||||
default = config.get_str_value('paths', 'temp_path', tempfile.gettempdir())
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -91,8 +88,7 @@ def create_jobs_path_program() -> ArgumentParser:
|
||||
default = config.get_str_value('paths', 'jobs_path', '.jobs')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -111,8 +107,7 @@ def create_source_paths_program() -> ArgumentParser:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -130,8 +125,7 @@ def create_target_path_program() -> ArgumentParser:
|
||||
default = config.get_str_value('paths', 'target_path')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -149,8 +143,7 @@ def create_output_path_program() -> ArgumentParser:
|
||||
default = config.get_str_value('paths', 'output_path')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -168,8 +161,7 @@ def create_source_pattern_program() -> ArgumentParser:
|
||||
default = config.get_str_value('patterns', 'source_pattern')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'patterns' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -187,8 +179,7 @@ def create_target_pattern_program() -> ArgumentParser:
|
||||
default = config.get_str_value('patterns', 'target_pattern')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'patterns' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -206,8 +197,7 @@ def create_output_pattern_program() -> ArgumentParser:
|
||||
default = config.get_str_value('patterns', 'output_pattern')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'patterns' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -226,8 +216,7 @@ def create_face_detector_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_detector_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_detector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
known_args, _ = program.parse_known_args()
|
||||
@@ -242,8 +231,7 @@ def create_face_detector_program() -> ArgumentParser:
|
||||
choices = face_detector_size_choices
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_detector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -255,8 +243,7 @@ def create_face_detector_program() -> ArgumentParser:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_detector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -270,8 +257,7 @@ def create_face_detector_program() -> ArgumentParser:
|
||||
metavar = 'FACE_DETECTOR_ANGLES'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_detector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -284,8 +270,7 @@ def create_face_detector_program() -> ArgumentParser:
|
||||
metavar = create_float_metavar(facefusion.choices.face_detector_score_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_detector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -304,8 +289,7 @@ def create_face_landmarker_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_landmarker_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_landmarker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -318,8 +302,7 @@ def create_face_landmarker_program() -> ArgumentParser:
|
||||
metavar = create_float_metavar(facefusion.choices.face_landmarker_score_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_landmarker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -338,8 +321,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_selector_modes
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -350,8 +332,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_selector_orders
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -364,8 +345,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.face_selector_age_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -378,8 +358,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.face_selector_age_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -390,8 +369,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_selector_genders
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -402,8 +380,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_selector_races
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -414,8 +391,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
default = config.get_int_value('face_selector', 'reference_face_position', '0')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -428,8 +404,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
metavar = create_float_metavar(facefusion.choices.reference_face_distance_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -440,8 +415,7 @@ def create_face_selector_program() -> ArgumentParser:
|
||||
default = config.get_int_value('face_selector', 'reference_frame_number', '0')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_selector' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -462,8 +436,7 @@ def create_face_tracker_program() -> ArgumentParser:
|
||||
metavar = create_float_metavar(facefusion.choices.face_tracker_score_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_tracker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -482,8 +455,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_occluder_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -494,8 +466,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.face_parser_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -508,8 +479,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
metavar = 'FACE_MASK_TYPES'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -522,8 +492,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
metavar = 'FACE_MASK_AREAS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -536,8 +505,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
metavar = 'FACE_MASK_REGIONS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -550,8 +518,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
metavar = create_float_metavar(facefusion.choices.face_mask_blur_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -563,8 +530,7 @@ def create_face_masker_program() -> ArgumentParser:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'face_masker' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -583,8 +549,7 @@ def create_voice_extractor_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.voice_extractor_models
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'voice_extractor' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -603,8 +568,7 @@ def create_frame_extraction_program() -> ArgumentParser:
|
||||
default = facefusion.config.get_int_value('frame_extraction', 'trim_frame_start')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_extraction' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -615,8 +579,7 @@ def create_frame_extraction_program() -> ArgumentParser:
|
||||
default = facefusion.config.get_int_value('frame_extraction', 'trim_frame_end')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_extraction' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -627,8 +590,7 @@ def create_frame_extraction_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.temp_frame_formats
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_extraction' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -644,13 +606,12 @@ def create_frame_distribution_program() -> ArgumentParser:
|
||||
'--target-frame-amount',
|
||||
help = translator.get('help.target_frame_amount'),
|
||||
type = int,
|
||||
default = config.get_int_value('frame_distribution', 'target_frame_amount', '5'),
|
||||
default = config.get_int_value('frame_distribution', 'target_frame_amount', '2'),
|
||||
choices = facefusion.choices.target_frame_amount_range,
|
||||
metavar = create_int_metavar(facefusion.choices.target_frame_amount_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'frame_distribution' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -672,8 +633,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.output_image_quality_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -685,8 +645,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.output_image_scale_range
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -697,8 +656,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
choices = available_encoder_set.get('audio')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -711,8 +669,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.output_audio_quality_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -725,8 +682,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.output_audio_volume_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -737,8 +693,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
choices = available_encoder_set.get('video')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -749,8 +704,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.video_presets
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -763,8 +717,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.output_video_quality_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -776,8 +729,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.output_video_scale_range
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -788,8 +740,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
default = config.get_float_value('output_creation', 'output_video_fps')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -800,8 +751,7 @@ def create_output_creation_program() -> ArgumentParser:
|
||||
default = config.get_float_value('output_creation', 'output_audio_fps', '25.0')
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'output_creation' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -822,8 +772,7 @@ def create_processors_program() -> ArgumentParser:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api', 'cli' ],
|
||||
groups = [ 'processors' ]
|
||||
scopes = [ 'api', 'cli' ]
|
||||
)
|
||||
|
||||
for processor_module in get_processors_modules(available_processors):
|
||||
@@ -847,8 +796,7 @@ def create_download_providers_program() -> ArgumentParser:
|
||||
metavar = 'DOWNLOAD_PROVIDERS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'download' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -867,8 +815,7 @@ def create_download_scope_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.download_scopes
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'download' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -926,8 +873,7 @@ def create_api_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.api_security_strategies
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'api' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -949,8 +895,7 @@ def create_execution_program() -> ArgumentParser:
|
||||
metavar = 'EXECUTION_DEVICE_IDS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'execution' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -963,8 +908,7 @@ def create_execution_program() -> ArgumentParser:
|
||||
metavar = 'EXECUTION_PROVIDERS'
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'execution' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -977,8 +921,7 @@ def create_execution_program() -> ArgumentParser:
|
||||
metavar = create_int_metavar(facefusion.choices.execution_thread_count_range)
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'execution' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -997,8 +940,7 @@ def create_memory_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.video_memory_strategies
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli', 'sys' ],
|
||||
groups = [ 'memory' ]
|
||||
scopes = [ 'cli', 'sys' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -1017,8 +959,7 @@ def create_log_level_program() -> ArgumentParser:
|
||||
choices = facefusion.choices.log_levels
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'misc' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
@@ -1037,8 +978,7 @@ def create_halt_on_error_program() -> ArgumentParser:
|
||||
default = config.get_bool_value('misc', 'halt_on_error')
|
||||
)
|
||||
],
|
||||
scopes = [ 'cli' ],
|
||||
groups = [ 'misc' ]
|
||||
scopes = [ 'cli' ]
|
||||
)
|
||||
|
||||
return program
|
||||
|
||||
+4
-7
@@ -65,7 +65,7 @@ Language = Literal['en']
|
||||
Locales : TypeAlias = Dict[Language, Dict[str, Any]]
|
||||
LocalePoolSet : TypeAlias = Dict[str, Locales]
|
||||
|
||||
WorkFlow = Literal['auto', 'audio-to-image:frames', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames']
|
||||
WorkflowMode = Literal['auto', 'audio-to-image:frames', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames']
|
||||
|
||||
VideoCaptureSet : TypeAlias = Dict[str, cv2.VideoCapture]
|
||||
VideoWriterSet : TypeAlias = Dict[str, cv2.VideoWriter]
|
||||
@@ -135,13 +135,11 @@ Args : TypeAlias = Dict[str, Any]
|
||||
|
||||
Choice : TypeAlias = Union[int | str]
|
||||
Scope : TypeAlias = Literal['api', 'cli', 'sys']
|
||||
Group : TypeAlias = str
|
||||
|
||||
CapabilitySet = TypedDict('CapabilitySet',
|
||||
{
|
||||
'default' : Any,
|
||||
'choices' : NotRequired[List[Choice]],
|
||||
'groups' : NotRequired[List[Group]]
|
||||
'choices' : NotRequired[List[Choice]]
|
||||
})
|
||||
CapabilityStore = TypedDict('CapabilityStore',
|
||||
{
|
||||
@@ -149,7 +147,6 @@ CapabilityStore = TypedDict('CapabilityStore',
|
||||
'cli' : Dict[str, CapabilitySet],
|
||||
'sys' : Dict[str, CapabilitySet]
|
||||
})
|
||||
CapabilityGroup : TypeAlias = Dict[Group, Dict[str, CapabilitySet]]
|
||||
|
||||
ProcessState = Literal['checking', 'processing', 'stopping', 'pending']
|
||||
UpdateProgress : TypeAlias = Callable[[int], None]
|
||||
@@ -478,7 +475,7 @@ StateValue : TypeAlias = Any
|
||||
StateKey = Literal\
|
||||
[
|
||||
'command',
|
||||
'workflow',
|
||||
'workflow_mode',
|
||||
'config_path',
|
||||
'temp_path',
|
||||
'jobs_path',
|
||||
@@ -552,7 +549,7 @@ StateKey = Literal\
|
||||
State = TypedDict('State',
|
||||
{
|
||||
'command' : str,
|
||||
'workflow' : WorkFlow,
|
||||
'workflow_mode' : WorkflowMode,
|
||||
'config_path' : str,
|
||||
'temp_path' : str,
|
||||
'jobs_path' : str,
|
||||
|
||||
@@ -19,6 +19,12 @@ def get_video_capture(video_path : str) -> cv2.VideoCapture:
|
||||
return VIDEO_POOL_SET.get('capture').get(video_path)
|
||||
|
||||
|
||||
def conditional_set_video_frame_position(video_capture : cv2.VideoCapture, frame_position : int) -> bool:
|
||||
if not video_capture.get(cv2.CAP_PROP_POS_FRAMES) == frame_position:
|
||||
return video_capture.set(cv2.CAP_PROP_POS_FRAMES, frame_position)
|
||||
return True
|
||||
|
||||
|
||||
def get_video_writer(video_path : str) -> cv2.VideoWriter:
|
||||
if video_path not in VIDEO_POOL_SET.get('writer'):
|
||||
video_writer = cv2.VideoWriter()
|
||||
|
||||
+10
-10
@@ -11,7 +11,7 @@ from facefusion.filesystem import get_file_extension, is_image, is_video
|
||||
from facefusion.media_helper import restrict_trim_frame
|
||||
from facefusion.thread_helper import thread_lock, thread_semaphore
|
||||
from facefusion.types import ColorMode, Duration, Fps, Mask, Orientation, Resolution, Scale, VisionFrame
|
||||
from facefusion.video_manager import get_video_capture
|
||||
from facefusion.video_manager import conditional_set_video_frame_position, get_video_capture
|
||||
|
||||
|
||||
def read_static_images(image_paths : List[str], color_mode : ColorMode = 'rgb') -> List[VisionFrame]:
|
||||
@@ -81,11 +81,11 @@ def read_video_frame(video_path : str, frame_number : int = 0) -> Optional[Visio
|
||||
video_capture = get_video_capture(video_path)
|
||||
|
||||
if video_capture and video_capture.isOpened():
|
||||
frame_total = video_capture.get(cv2.CAP_PROP_FRAME_COUNT)
|
||||
frame_position = min(frame_total, frame_number)
|
||||
video_frame_total = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
video_frame_position = min(video_frame_total, frame_number)
|
||||
|
||||
with thread_semaphore():
|
||||
video_capture.set(cv2.CAP_PROP_POS_FRAMES, frame_position)
|
||||
conditional_set_video_frame_position(video_capture, video_frame_position)
|
||||
has_vision_frame, vision_frame = video_capture.read()
|
||||
|
||||
if has_vision_frame:
|
||||
@@ -106,13 +106,13 @@ def read_video_chunk(video_path : str, chunk_number : int, chunk_size : int) ->
|
||||
video_capture = get_video_capture(video_path)
|
||||
|
||||
if video_capture and video_capture.isOpened():
|
||||
frame_total = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
frame_position = chunk_number * chunk_size
|
||||
video_frame_total = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
video_frame_position = chunk_number * chunk_size
|
||||
|
||||
with thread_semaphore():
|
||||
video_capture.set(cv2.CAP_PROP_POS_FRAMES, frame_position)
|
||||
conditional_set_video_frame_position(video_capture, video_frame_position)
|
||||
|
||||
for frame_number in range(frame_position, min(frame_position + chunk_size, frame_total)):
|
||||
for frame_number in range(video_frame_position, min(video_frame_position + chunk_size, video_frame_total)):
|
||||
has_vision_frame, vision_frame = video_capture.read()
|
||||
|
||||
if has_vision_frame:
|
||||
@@ -121,9 +121,9 @@ def read_video_chunk(video_path : str, chunk_number : int, chunk_size : int) ->
|
||||
return video_frame_chunk
|
||||
|
||||
|
||||
def select_video_frames(video_path : str, frame_number : int = 0, frame_offset : int = 5) -> List[VisionFrame]:
|
||||
def select_video_frames(video_path : str, frame_number : int = 0, frame_offset : int = 2) -> List[VisionFrame]:
|
||||
vision_frames = []
|
||||
chunk_size = (frame_offset * 2 + 1) * 4
|
||||
chunk_size = frame_offset * 2 + 1
|
||||
|
||||
if is_video(video_path):
|
||||
with thread_lock():
|
||||
|
||||
@@ -3,7 +3,8 @@ from functools import partial
|
||||
from facefusion import process_manager
|
||||
from facefusion.types import ErrorCode
|
||||
from facefusion.workflows.as_frames import create_temp_frames
|
||||
from facefusion.workflows.core import analyse_image, clear, process_frames, setup
|
||||
from facefusion.workflows.core import clear, process_frames, setup
|
||||
from facefusion.workflows.to_image import analyse_image
|
||||
from facefusion.workflows.to_video import finalize_video, merge_frames, restore_audio
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ from functools import partial
|
||||
from facefusion import process_manager
|
||||
from facefusion.types import ErrorCode
|
||||
from facefusion.workflows.as_frames import copy_temp_frames, create_temp_frames, finalize_frames
|
||||
from facefusion.workflows.core import analyse_image, clear, process_frames, setup
|
||||
from facefusion.workflows.core import clear, process_frames, setup
|
||||
from facefusion.workflows.to_image import analyse_image
|
||||
|
||||
|
||||
def process(start_time : float) -> ErrorCode:
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import List
|
||||
import numpy
|
||||
from tqdm import tqdm
|
||||
|
||||
from facefusion import content_analyser, logger, process_manager, state_manager, translator
|
||||
from facefusion import logger, process_manager, state_manager, translator
|
||||
from facefusion.audio import create_empty_audio_frame, get_audio_frame, get_voice_frame
|
||||
from facefusion.common_helper import get_first
|
||||
from facefusion.filesystem import filter_audio_paths
|
||||
@@ -33,18 +33,12 @@ def clear() -> ErrorCode:
|
||||
return 0
|
||||
|
||||
|
||||
def analyse_image() -> ErrorCode:
|
||||
if content_analyser.analyse_image(state_manager.get_item('target_path')):
|
||||
return 3
|
||||
return 0
|
||||
|
||||
|
||||
def conditional_get_source_audio_frame(frame_number : int) -> AudioFrame:
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:frames', 'audio-to-image:video', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:frames', 'audio-to-image:video', 'image-to-video' ]:
|
||||
source_audio_path = get_first(filter_audio_paths(state_manager.get_item('source_paths')))
|
||||
fps = state_manager.get_item('output_audio_fps')
|
||||
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
fps = restrict_video_fps(state_manager.get_item('target_path'), state_manager.get_item('output_video_fps'))
|
||||
|
||||
source_audio_frame = get_audio_frame(source_audio_path, fps, frame_number)
|
||||
@@ -56,11 +50,11 @@ def conditional_get_source_audio_frame(frame_number : int) -> AudioFrame:
|
||||
|
||||
|
||||
def conditional_get_source_voice_frame(frame_number : int) -> AudioFrame:
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:frames', 'audio-to-image:video', 'image-to-video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:frames', 'audio-to-image:video', 'image-to-video' ]:
|
||||
source_audio_path = get_first(filter_audio_paths(state_manager.get_item('source_paths')))
|
||||
temp_fps = state_manager.get_item('output_audio_fps')
|
||||
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
temp_fps = restrict_video_fps(state_manager.get_item('target_path'), state_manager.get_item('output_video_fps'))
|
||||
|
||||
source_voice_frame = get_voice_frame(source_audio_path, temp_fps, frame_number)
|
||||
@@ -72,15 +66,15 @@ def conditional_get_source_voice_frame(frame_number : int) -> AudioFrame:
|
||||
|
||||
|
||||
def conditional_get_reference_vision_frame() -> VisionFrame:
|
||||
if state_manager.get_item('workflow') in [ 'image-to-video', 'image-to-video:frames' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'image-to-video', 'image-to-video:frames' ]:
|
||||
return read_static_video_frame(state_manager.get_item('target_path'), state_manager.get_item('reference_frame_number'))
|
||||
return read_static_image(state_manager.get_item('target_path'))
|
||||
|
||||
|
||||
def conditional_get_target_vision_frames(temp_frame_path : str, frame_number : int) -> List[VisionFrame]:
|
||||
if state_manager.get_item('workflow') in [ 'image-to-video', 'image-to-video:frames' ]:
|
||||
def conditional_get_target_vision_frames(frame_number : int) -> List[VisionFrame]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'image-to-video', 'image-to-video:frames' ]:
|
||||
return select_video_frames(state_manager.get_item('target_path'), frame_number, state_manager.get_item('target_frame_amount'))
|
||||
return [ read_static_image(temp_frame_path) ]
|
||||
return [ read_static_image(state_manager.get_item('target_path')) ]
|
||||
|
||||
|
||||
def process_temp_frame(temp_frame_path : str, frame_number : int) -> bool:
|
||||
@@ -88,7 +82,7 @@ def process_temp_frame(temp_frame_path : str, frame_number : int) -> bool:
|
||||
source_vision_frames = read_static_images(state_manager.get_item('source_paths'))
|
||||
source_audio_frame = conditional_get_source_audio_frame(frame_number)
|
||||
source_voice_frame = conditional_get_source_voice_frame(frame_number)
|
||||
target_vision_frames = conditional_get_target_vision_frames(temp_frame_path, frame_number)
|
||||
target_vision_frames = conditional_get_target_vision_frames(frame_number)
|
||||
temp_vision_frame = read_static_image(temp_frame_path, 'rgba').copy()
|
||||
temp_vision_mask = extract_vision_mask(temp_vision_frame)
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ from functools import partial
|
||||
|
||||
from facefusion import process_manager
|
||||
from facefusion.types import ErrorCode
|
||||
from facefusion.workflows.core import analyse_image, clear, setup
|
||||
from facefusion.workflows.to_image import finalize_image, prepare_image, process_image
|
||||
from facefusion.workflows.core import clear, setup
|
||||
from facefusion.workflows.to_image import analyse_image, finalize_image, prepare_image, process_image
|
||||
|
||||
|
||||
def process(start_time : float) -> ErrorCode:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from facefusion import ffmpeg, logger, process_manager, state_manager, translator
|
||||
from facefusion import content_analyser, ffmpeg, logger, process_manager, state_manager, translator
|
||||
from facefusion.filesystem import is_image
|
||||
from facefusion.temp_helper import get_temp_file_path
|
||||
from facefusion.time_helper import calculate_end_time
|
||||
@@ -7,6 +7,12 @@ from facefusion.vision import detect_image_resolution, pack_resolution, restrict
|
||||
from facefusion.workflows.core import is_process_stopping, process_temp_frame
|
||||
|
||||
|
||||
def analyse_image() -> ErrorCode:
|
||||
if content_analyser.analyse_image(state_manager.get_item('target_path')):
|
||||
return 3
|
||||
return 0
|
||||
|
||||
|
||||
def prepare_image() -> ErrorCode:
|
||||
output_image_resolution = scale_resolution(detect_image_resolution(state_manager.get_item('target_path')), state_manager.get_item('output_image_scale'))
|
||||
temp_image_resolution = restrict_image_resolution(state_manager.get_item('target_path'), output_image_resolution)
|
||||
|
||||
@@ -94,23 +94,23 @@ def finalize_video(start_time : float) -> ErrorCode:
|
||||
|
||||
|
||||
def conditional_clear_video_pool() -> None:
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
video_manager.clear_video_pool()
|
||||
|
||||
|
||||
def conditional_restrict_video_fps() -> Fps:
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
return restrict_video_fps(state_manager.get_item('target_path'), state_manager.get_item('output_video_fps'))
|
||||
return conditional_get_output_fps()
|
||||
|
||||
|
||||
def conditional_get_output_fps() -> Fps:
|
||||
if state_manager.get_item('workflow') in [ 'audio-to-image:frames', 'audio-to-image:video' ]:
|
||||
if state_manager.get_item('workflow_mode') in [ 'audio-to-image:frames', 'audio-to-image:video' ]:
|
||||
return state_manager.get_item('output_audio_fps')
|
||||
return state_manager.get_item('output_video_fps')
|
||||
|
||||
|
||||
def conditional_scale_resolution() -> Resolution:
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
||||
return scale_resolution(detect_video_resolution(state_manager.get_item('target_path')), state_manager.get_item('output_video_scale'))
|
||||
return scale_resolution(detect_image_resolution(state_manager.get_item('target_path')), state_manager.get_item('output_video_scale'))
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import subprocess
|
||||
import tempfile
|
||||
from typing import Iterator
|
||||
|
||||
import pytest
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
from facefusion import metadata, session_manager, state_manager
|
||||
from facefusion import ffmpeg, ffmpeg_builder, metadata, process_manager, session_manager, state_manager
|
||||
from facefusion.apis import asset_store
|
||||
from facefusion.apis.core import create_api
|
||||
from facefusion.download import conditional_download
|
||||
@@ -14,6 +13,7 @@ from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
@@ -21,7 +21,16 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
|
||||
@@ -18,8 +18,7 @@ def before_all() -> None:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -29,8 +28,7 @@ def before_all() -> None:
|
||||
choices = [ 'mp4', 'mkv', 'webm' ]
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
|
||||
|
||||
@@ -57,5 +55,5 @@ def test_get_capabilities(test_client : TestClient) -> None:
|
||||
|
||||
assert 'mp4' in capabilities_body.get('formats').get('video')
|
||||
|
||||
assert capabilities_body.get('arguments').get('paths').get('source_paths').get('default') is None
|
||||
assert capabilities_body.get('arguments').get('paths').get('output_format').get('choices') == [ 'mp4', 'mkv', 'webm' ]
|
||||
assert capabilities_body.get('arguments').get('source_paths').get('default') is None
|
||||
assert capabilities_body.get('arguments').get('output_format').get('choices') == [ 'mp4', 'mkv', 'webm' ]
|
||||
|
||||
+15
-9
@@ -1,11 +1,10 @@
|
||||
import subprocess
|
||||
from argparse import ArgumentParser
|
||||
from typing import Iterator
|
||||
|
||||
import pytest
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
from facefusion import capability_store, metadata, session_manager, state_manager
|
||||
from facefusion import capability_store, ffmpeg, ffmpeg_builder, metadata, process_manager, session_manager, state_manager
|
||||
from facefusion.apis import asset_store
|
||||
from facefusion.apis.core import create_api
|
||||
from facefusion.download import conditional_download
|
||||
@@ -14,6 +13,7 @@ from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
program = ArgumentParser()
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -22,8 +22,7 @@ def before_all() -> None:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -31,8 +30,7 @@ def before_all() -> None:
|
||||
'--target-path'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
capability_store.register_capability_set(
|
||||
[
|
||||
@@ -41,8 +39,7 @@ def before_all() -> None:
|
||||
nargs = '+'
|
||||
)
|
||||
],
|
||||
scopes = [ 'api' ],
|
||||
groups = [ 'paths' ]
|
||||
scopes = [ 'api' ]
|
||||
)
|
||||
|
||||
state_manager.init_item('execution_providers', [ 'cpu' ])
|
||||
@@ -53,7 +50,16 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
|
||||
+10
-4
@@ -1,8 +1,8 @@
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
from pytest import approx
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.audio import detect_audio_duration, get_audio_frame, read_static_audio, restrict_trim_audio_frame
|
||||
from facefusion.download import conditional_download
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
@@ -10,17 +10,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.mp3'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.mp3'), get_test_example_file('source.wav') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.mp3')),
|
||||
ffmpeg_builder.set_output(get_test_example_file('source.wav'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_get_audio_frame() -> None:
|
||||
assert hasattr(get_audio_frame(get_test_example_file('source.mp3'), 25), '__array_interface__')
|
||||
assert hasattr(get_audio_frame(get_test_example_file('source.wav'), 25), '__array_interface__')
|
||||
assert get_audio_frame(get_test_example_file('source.mp3'), 25).shape == (80, 16)
|
||||
assert get_audio_frame(get_test_example_file('source.wav'), 25).shape == (80, 16)
|
||||
assert get_audio_frame('invalid', 25) is None
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,12 +11,22 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -26,21 +37,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_modify_age_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-age-face-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-age-face-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-age-face-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_modify_age_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-age-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_modify_age_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-age-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_remove_background_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-remove-background-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-remove-background-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-remove-background-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_remove_background_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-remove-background-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_remove_background_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-remove-background-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p-batch-1.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '2', get_test_example_file('target-240p-batch-2.jpg') ])
|
||||
for frame_number in [ 1, 2 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
str(frame_number)
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-batch-' + str(frame_number) + '.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,7 +38,7 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_batch_run_targets() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'batch-run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p-batch-*.jpg'), '-o', get_test_output_path('test-batch-run-targets-{index}.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'batch-run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p-batch-*.jpg'), '-o', get_test_output_path('test-batch-run-targets-{index}.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-batch-run-targets-0.jpg') is True
|
||||
@@ -36,7 +47,7 @@ def test_batch_run_targets() -> None:
|
||||
|
||||
|
||||
def test_batch_run_sources_to_targets() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'batch-run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('target-240p-batch-*.jpg'), '-t', get_test_example_file('target-240p-batch-*.jpg'), '-o', get_test_output_path('test-batch-run-sources-to-targets-{index}.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'batch-run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('target-240p-batch-*.jpg'), '-t', get_test_example_file('target-240p-batch-*.jpg'), '-o', get_test_output_path('test-batch-run-sources-to-targets-{index}.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-batch-run-sources-to-targets-0.jpg') is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,12 +11,22 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -26,21 +37,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_restore_expression_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-restore-expression-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-restore-expression-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-restore-expression-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_restore_expression_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-restore-expression-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_restore_expression_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-restore-expression-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_debug_face_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-debug-face-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-debug-face-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-debug-face-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_debug_face_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-debug-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_debug_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-debug-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_edit_face_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-edit-face-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-edit-face-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-edit-face-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_edit_face_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-edit-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_edit_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-edit-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_enhance_face_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-enhance-face-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-enhance-face-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-enhance-face-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_enhance_face_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-enhance-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_enhance_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_swap_face_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-swap-face-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-swap-face-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-swap-face-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_swap_face_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-swap-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_swap_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-swap-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,14 +11,37 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.mp4') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
[
|
||||
'-vf',
|
||||
'hue=s=0'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-0sat.jpg'))
|
||||
)
|
||||
)
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vf',
|
||||
'hue=s=0'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-0sat.mp4'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -28,21 +52,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_colorize_frame_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.jpg'), '-o', get_test_output_path('test_colorize-frame-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.jpg'), '-o', get_test_output_path('test_colorize-frame-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test_colorize-frame-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_colorize_frame_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-colorize-frame-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_colorize_frame_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-colorize-frame-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -27,21 +38,21 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_enhance_frame_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-enhance-frame-to-image.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-enhance-frame-to-image.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-enhance-frame-to-image.jpg') is True
|
||||
|
||||
|
||||
def test_enhance_frame_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test-enhance-frame-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_enhance_frame_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-frame-to-video-as-frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, count_step_total, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_job_file
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -51,7 +62,7 @@ def test_job_submit() -> None:
|
||||
|
||||
assert subprocess.run(commands).returncode == 1
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-submit', 'test-job-submit', '--jobs-path', get_test_jobs_directory() ]
|
||||
@@ -74,10 +85,10 @@ def test_submit_all() -> None:
|
||||
|
||||
assert subprocess.run(commands).returncode == 1
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit-all-1', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit-all-1', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit-all-2', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-submit-all-2', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-submit-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
|
||||
@@ -123,7 +134,7 @@ def test_job_delete_all() -> None:
|
||||
|
||||
|
||||
def test_job_add_step() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-add-step', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-add-step', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 1
|
||||
assert count_step_total('test-job-add-step') == 0
|
||||
@@ -131,14 +142,14 @@ def test_job_add_step() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-add-step', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-add-step', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-add-step', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert count_step_total('test-job-add-step') == 1
|
||||
|
||||
|
||||
def test_job_remix() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '0', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '0', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 1
|
||||
assert count_step_total('test-job-remix-step') == 0
|
||||
@@ -146,23 +157,23 @@ def test_job_remix() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-remix-step', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-remix-step', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-remix-step', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '0', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '0', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert count_step_total('test-job-remix-step') == 1
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert count_step_total('test-job-remix-step') == 2
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '-1', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-remix-step', 'test-job-remix-step', '-1', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert count_step_total('test-job-remix-step') == 3
|
||||
|
||||
|
||||
def test_job_insert_step() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '0', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '0', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 1
|
||||
assert count_step_total('test-job-insert-step') == 0
|
||||
@@ -170,16 +181,16 @@ def test_job_insert_step() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-insert-step', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-insert-step', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-insert-step', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '0', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '0', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert count_step_total('test-job-insert-step') == 1
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert count_step_total('test-job-insert-step') == 2
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '-1', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-insert-step', 'test-job-insert-step', '-1', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert count_step_total('test-job-insert-step') == 3
|
||||
@@ -193,7 +204,7 @@ def test_job_remove_step() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-remove-step', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-remove-step', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-remove-step', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-remix-step.jpg') ]
|
||||
subprocess.run(commands)
|
||||
subprocess.run(commands)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs, move_job_file, set_steps_status
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, prepare_test_output_directory
|
||||
@@ -10,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -34,7 +45,7 @@ def test_job_run() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-run', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-run.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-run.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-run', 'test-job-run', '--jobs-path', get_test_jobs_directory() ]
|
||||
@@ -62,13 +73,13 @@ def test_job_run_all() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-run-all-2', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-1', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-run-all-1.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-1', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-run-all-1.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-2', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-run-all-2.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-2', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-run-all-2.mp4'), '--trim-frame-end', '1' ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-2', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-run-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-run-all-2', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-run-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-run-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
|
||||
@@ -94,7 +105,7 @@ def test_job_retry() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-retry', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-retry.jpg') ]
|
||||
commands = [sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-retry.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-retry', 'test-job-retry', '--jobs-path', get_test_jobs_directory() ]
|
||||
@@ -122,13 +133,13 @@ def test_job_retry_all() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-create', 'test-job-retry-all-2', '--jobs-path', get_test_jobs_directory() ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-1', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-retry-all-1.jpg') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-1', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test-job-retry-all-1.jpg') ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-2', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-retry-all-2.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-2', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-retry-all-2.mp4'), '--trim-frame-end', '1' ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-2', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-retry-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-add-step', 'test-job-retry-all-2', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-job-retry-all-2.mp4'), '--trim-frame-start', '0', '--trim-frame-end', '1' ]
|
||||
subprocess.run(commands)
|
||||
|
||||
commands = [ sys.executable, 'facefusion.py', 'job-retry-all', '--jobs-path', get_test_jobs_directory(), '--halt-on-error' ]
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_jobs_directory, get_test_output_path, is_test_output_file, is_test_output_sequence, prepare_test_output_directory
|
||||
@@ -10,6 +11,7 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
@@ -17,7 +19,16 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -28,28 +39,28 @@ def before_each() -> None:
|
||||
|
||||
|
||||
def test_sync_lip_to_image() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'audio-to-image:video', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test_sync_lip_to_image.mp4') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'audio-to-image:video', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test_sync_lip_to_image.mp4') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test_sync_lip_to_image.mp4') is True
|
||||
|
||||
|
||||
def test_sync_lip_to_image_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'audio-to-image:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test_sync_lip_to_image_as_frames') ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'audio-to-image:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.jpg'), '-o', get_test_output_path('test_sync_lip_to_image_as_frames') ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test_sync_lip_to_image_as_frames')) is True
|
||||
|
||||
|
||||
def test_sync_lip_to_video() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video.mp4'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video.mp4'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_file('test_sync_lip_to_video.mp4') is True
|
||||
|
||||
|
||||
def test_sync_lip_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video_as_frames'), '--trim-frame-end', '1' ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video_as_frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test_sync_lip_to_video_as_frames')) is True
|
||||
|
||||
@@ -3,6 +3,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.jobs.job_manager import clear_jobs, init_jobs
|
||||
from facefusion.types import Resolution, Scale
|
||||
@@ -12,13 +13,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
@@ -37,7 +48,7 @@ def before_each() -> None:
|
||||
])
|
||||
def test_output_image_scale(output_image_scale : Scale, output_image_resolution : Resolution) -> None:
|
||||
output_file_path = get_test_output_path('test-output-image-scale-' + str(output_image_scale) + '.jpg')
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', output_file_path, '--output-image-scale', str(output_image_scale) ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-image', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.jpg'), '-o', output_file_path, '--output-image-scale', str(output_image_scale) ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert detect_image_resolution(output_file_path) == output_image_resolution
|
||||
@@ -52,7 +63,7 @@ def test_output_image_scale(output_image_scale : Scale, output_image_resolution
|
||||
])
|
||||
def test_output_video_scale(output_video_scale : Scale, output_video_resolution : Resolution) -> None:
|
||||
output_file_path = get_test_output_path('test-output-video-scale-' + str(output_video_scale) + '.mp4')
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', output_file_path, '--trim-frame-end', '1', '--output-video-scale', str(output_video_scale) ]
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow-mode', 'image-to-video', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', output_file_path, '--trim-frame-end', '1', '--output-video-scale', str(output_video_scale) ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert detect_video_resolution(output_file_path) == output_video_resolution
|
||||
|
||||
@@ -16,7 +16,7 @@ def test_create_int_range() -> None:
|
||||
|
||||
def test_create_float_range() -> None:
|
||||
assert create_float_range(0.0, 1.0, 0.5) == [ 0.0, 0.5, 1.0 ]
|
||||
assert create_float_range(0.0, 1.0, 0.05) == [ 0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.0 ]
|
||||
assert create_float_range(0.0, 0.5, 0.05) == [ 0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50 ]
|
||||
|
||||
|
||||
def test_calc_int_step() -> None:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import subprocess
|
||||
|
||||
import numpy
|
||||
import pytest
|
||||
|
||||
from facefusion import face_classifier, face_detector, face_landmarker, face_recognizer, state_manager
|
||||
from facefusion import face_classifier, face_detector, face_landmarker, face_recognizer, ffmpeg, ffmpeg_builder, process_manager, state_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.face_creator import average_face_geometry, get_many_faces, get_one_face, refill_faces
|
||||
from facefusion.face_store import clear_faces
|
||||
@@ -13,13 +12,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg'
|
||||
])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.8:ih*0.8', get_test_example_file('source-80crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.7:ih*0.7', get_test_example_file('source-70crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.6:ih*0.6', get_test_example_file('source-60crop.jpg') ])
|
||||
|
||||
for crop_scale in [ 80, 70, 60 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.jpg')),
|
||||
[
|
||||
'-vf',
|
||||
'crop=iw*0.' + str(crop_scale) + ':ih*0.' + str(crop_scale)
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('source-' + str(crop_scale) + 'crop.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
state_manager.init_item('execution_device_ids', [ 0 ])
|
||||
state_manager.init_item('execution_providers', [ 'cpu' ])
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import face_detector, state_manager
|
||||
from facefusion import face_detector, ffmpeg, ffmpeg_builder, process_manager, state_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.face_detector import detect_with_retinaface, detect_with_scrfd, detect_with_yolo_face, detect_with_yunet
|
||||
from facefusion.face_helper import apply_nms, get_nms_threshold
|
||||
@@ -12,13 +11,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg'
|
||||
])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.8:ih*0.8', get_test_example_file('source-80crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.7:ih*0.7', get_test_example_file('source-70crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.6:ih*0.6', get_test_example_file('source-60crop.jpg') ])
|
||||
|
||||
for crop_scale in [ 80, 70, 60 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.jpg')),
|
||||
[
|
||||
'-vf',
|
||||
'crop=iw*0.' + str(crop_scale) + ':ih*0.' + str(crop_scale)
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('source-' + str(crop_scale) + 'crop.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
state_manager.init_item('execution_device_ids', [ 0 ])
|
||||
state_manager.init_item('execution_providers', [ 'cpu' ])
|
||||
@@ -34,9 +43,17 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.8:ih*0.8', get_test_example_file('source-80crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.7:ih*0.7', get_test_example_file('source-70crop.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.6:ih*0.6', get_test_example_file('source-60crop.jpg') ])
|
||||
for crop_scale in [ 80, 70, 60 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.jpg')),
|
||||
[
|
||||
'-vf',
|
||||
'crop=iw*0.' + str(crop_scale) + ':ih*0.' + str(crop_scale)
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('source-' + str(crop_scale) + 'crop.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(autouse = True)
|
||||
|
||||
+36
-9
@@ -1,11 +1,10 @@
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
import facefusion.ffmpeg
|
||||
from facefusion import process_manager, state_manager
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager, state_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.ffmpeg import concat_video, extract_frames, merge_video, read_audio_buffer, replace_audio, restore_audio, sanitize_audio, sanitize_image, sanitize_video, spawn_frames
|
||||
from facefusion.ffprobe import probe_entries
|
||||
@@ -34,16 +33,44 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.mp3'), get_test_example_file('source.wav') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=25', get_test_example_file('target-240p-25fps.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=30', get_test_example_file('target-240p-30fps.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=60', get_test_example_file('target-240p-60fps.mp4') ])
|
||||
for video_fps in [ 25, 30, 60 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_video_fps(video_fps),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-' + str(video_fps) + 'fps.mp4'))
|
||||
)
|
||||
)
|
||||
|
||||
for output_video_format in [ 'avi', 'm4v', 'mkv', 'mov', 'mp4', 'webm', 'wmv' ]:
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.mp3'), '-i', get_test_example_file('target-240p.mp4'), '-ar', '16000', get_test_example_file('target-240p-16khz.' + output_video_format) ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.mp3')),
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_audio_sample_rate(16000),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-16khz.' + output_video_format))
|
||||
)
|
||||
)
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.mp3'), '-i', get_test_example_file('target-240p.mp4'), '-ar', '48000', get_test_example_file('target-240p-48khz.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-c:v', 'libx265', '-an', '-movflags', '+faststart', get_test_example_file('target-240p-h265.mp4') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.mp3')),
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_audio_sample_rate(48000),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-48khz.mp4'))
|
||||
)
|
||||
)
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_video_encoder('libx265'),
|
||||
[
|
||||
'-an'
|
||||
],
|
||||
ffmpeg_builder.set_faststart('mp4'),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-h265.mp4'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
|
||||
+17
-4
@@ -1,8 +1,7 @@
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import process_manager
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.ffprobe import extract_audio_metadata, extract_video_metadata
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory
|
||||
@@ -18,8 +17,22 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.mp3'), '-t', '1.9', '-ar', '48000', '-ac', '2', get_test_example_file('source-48000khz-2ch.wav') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-t', '1', get_test_example_file('target-240p-1s.mov') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('source.mp3')),
|
||||
ffmpeg_builder.set_video_duration(1.9),
|
||||
ffmpeg_builder.set_audio_sample_rate(48000),
|
||||
ffmpeg_builder.set_audio_channel_total(2),
|
||||
ffmpeg_builder.set_output(get_test_example_file('source-48000khz-2ch.wav'))
|
||||
)
|
||||
)
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_video_duration(1),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-1s.mov'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_extract_audio_metadata() -> None:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from shutil import which
|
||||
|
||||
from facefusion import ffprobe_builder
|
||||
from facefusion.ffprobe_builder import chain, format_to_key_value, format_to_value, run, set_input, show_entries
|
||||
from facefusion.ffprobe_builder import chain, format_to_key_value, run, set_input, show_entries
|
||||
|
||||
|
||||
def test_run() -> None:
|
||||
@@ -11,9 +11,9 @@ def test_run() -> None:
|
||||
def test_chain() -> None:
|
||||
assert chain(
|
||||
ffprobe_builder.show_entries([ 'sample_rate' ]),
|
||||
ffprobe_builder.format_to_value(),
|
||||
ffprobe_builder.format_to_key_value(),
|
||||
ffprobe_builder.set_input('audio.mp3')
|
||||
) == [ '-show_entries', 'stream=sample_rate', '-of', 'default=noprint_wrappers=1:nokey=1', '-i', 'audio.mp3' ]
|
||||
) == [ '-show_entries', 'stream=sample_rate', '-of', 'default=noprint_wrappers=1', '-i', 'audio.mp3' ]
|
||||
|
||||
|
||||
def test_show_entries() -> None:
|
||||
@@ -21,10 +21,6 @@ def test_show_entries() -> None:
|
||||
assert show_entries([ 'duration', 'sample_rate']) == [ '-show_entries', 'stream=duration,sample_rate' ]
|
||||
|
||||
|
||||
def test_format_to_value() -> None:
|
||||
assert format_to_value() == [ '-of', 'default=noprint_wrappers=1:nokey=1' ]
|
||||
|
||||
|
||||
def test_format_to_key_value() -> None:
|
||||
assert format_to_key_value() == [ '-of', 'default=noprint_wrappers=1' ]
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.filesystem import copy_file, create_directory, get_file_extension
|
||||
from facefusion.jobs.job_manager import add_step, clear_jobs, create_job, init_jobs, move_job_file, submit_job, submit_jobs
|
||||
@@ -13,13 +13,23 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
|
||||
+76
-12
@@ -1,8 +1,8 @@
|
||||
import subprocess
|
||||
|
||||
import numpy
|
||||
import pytest
|
||||
|
||||
from facefusion import ffmpeg, ffmpeg_builder, process_manager
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.vision import calculate_histogram_difference, count_video_frame_total, detect_image_resolution, detect_video_duration, detect_video_fps, detect_video_resolution, match_frame_color, normalize_resolution, pack_resolution, predict_video_frame_total, read_image, read_video_chunk, read_video_frame, restrict_image_resolution, restrict_trim_video_frame, restrict_video_fps, restrict_video_resolution, scale_resolution, select_video_frames, unpack_resolution, write_image
|
||||
from .assert_helper import get_test_example_file, get_test_examples_directory, get_test_output_path, prepare_test_output_directory
|
||||
@@ -10,6 +10,7 @@ from .assert_helper import get_test_example_file, get_test_examples_directory, g
|
||||
|
||||
@pytest.fixture(scope = 'module', autouse = True)
|
||||
def before_all() -> None:
|
||||
process_manager.start()
|
||||
conditional_download(get_test_examples_directory(),
|
||||
[
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
|
||||
@@ -17,17 +18,80 @@ def before_all() -> None:
|
||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-1080p.mp4'
|
||||
])
|
||||
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('目标-240p.webp') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vframes', '1', get_test_example_file('target-1080p.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'transpose=0', get_test_example_file('target-240p-90deg.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vframes', '1', '-vf', 'transpose=0', get_test_example_file('target-1080p-90deg.jpg') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=25', get_test_example_file('target-240p-25fps.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=30', get_test_example_file('target-240p-30fps.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'fps=60', get_test_example_file('target-240p-60fps.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vf', 'transpose=0', get_test_example_file('target-240p-90deg.mp4') ])
|
||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vf', 'transpose=0', get_test_example_file('target-1080p-90deg.mp4') ])
|
||||
for target_name in [ 'target-240p', 'target-1080p' ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file(target_name + '.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file(target_name + '.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('目标-240p.webp'))
|
||||
)
|
||||
)
|
||||
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
[
|
||||
'-vf',
|
||||
'hue=s=0'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-0sat.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
for target_name in [ 'target-240p', 'target-1080p' ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file(target_name + '.mp4')),
|
||||
[
|
||||
'-vframes',
|
||||
'1'
|
||||
],
|
||||
[
|
||||
'-vf',
|
||||
'transpose=0'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file(target_name + '-90deg.jpg'))
|
||||
)
|
||||
)
|
||||
|
||||
for video_fps in [ 25, 30, 60 ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file('target-240p.mp4')),
|
||||
ffmpeg_builder.set_video_fps(video_fps),
|
||||
ffmpeg_builder.set_output(get_test_example_file('target-240p-' + str(video_fps) + 'fps.mp4'))
|
||||
)
|
||||
)
|
||||
|
||||
for target_name in [ 'target-240p', 'target-1080p' ]:
|
||||
ffmpeg.run_ffmpeg(
|
||||
ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(get_test_example_file(target_name + '.mp4')),
|
||||
[
|
||||
'-vf',
|
||||
'transpose=0'
|
||||
],
|
||||
ffmpeg_builder.set_output(get_test_example_file(target_name + '-90deg.mp4'))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope = 'function', autouse = True)
|
||||
|
||||
Reference in New Issue
Block a user