mirror of
https://github.com/facefusion/facefusion.git
synced 2026-04-26 03:16:12 +02:00
fix
This commit is contained in:
@@ -124,7 +124,7 @@ def extract_frames(target_path : str, temp_video_resolution : Resolution, temp_v
|
||||
return process.returncode == 0
|
||||
|
||||
|
||||
def copy_image(target_path : str, temp_image_resolution : Resolution, output_path : str) -> bool:
|
||||
def copy_image(target_path : str, output_path : str, temp_image_resolution : Resolution) -> bool:
|
||||
temp_image_path = get_temp_file_path(target_path, output_path)
|
||||
commands = ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(target_path),
|
||||
@@ -212,7 +212,7 @@ def replace_audio(target_path : str, audio_path : str, output_path : str) -> boo
|
||||
return run_ffmpeg(commands).returncode == 0
|
||||
|
||||
|
||||
def merge_video(target_path : str, temp_video_fps : Fps, output_video_resolution : Resolution, output_video_fps : Fps, trim_frame_start : int, trim_frame_end : int, output_path : str) -> bool:
|
||||
def merge_video(target_path : str, output_path : str, temp_video_fps : Fps, output_video_resolution : Resolution, output_video_fps : Fps, trim_frame_start : int, trim_frame_end : int) -> bool:
|
||||
output_video_encoder = state_manager.get_item('output_video_encoder')
|
||||
output_video_quality = state_manager.get_item('output_video_quality')
|
||||
output_video_preset = state_manager.get_item('output_video_preset')
|
||||
|
||||
@@ -42,15 +42,6 @@ def get_file_format(file_path : str) -> Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
def same_file_extension(first_file_path : str, second_file_path : str) -> bool:
|
||||
first_file_extension = get_file_extension(first_file_path)
|
||||
second_file_extension = get_file_extension(second_file_path)
|
||||
|
||||
if first_file_extension and second_file_extension:
|
||||
return get_file_extension(first_file_path) == get_file_extension(second_file_path)
|
||||
return False
|
||||
|
||||
|
||||
def is_file(file_path : str) -> bool:
|
||||
if file_path:
|
||||
return os.path.isfile(file_path)
|
||||
|
||||
@@ -47,7 +47,7 @@ def prepare_image() -> ErrorCode:
|
||||
temp_image_resolution = restrict_image_resolution(state_manager.get_item('target_path'), output_image_resolution)
|
||||
|
||||
logger.info(translator.get('copying_image').format(resolution = pack_resolution(temp_image_resolution)), __name__)
|
||||
if ffmpeg.copy_image(state_manager.get_item('target_path'), temp_image_resolution, state_manager.get_item('output_path')):
|
||||
if ffmpeg.copy_image(state_manager.get_item('target_path'), state_manager.get_item('output_path'), temp_image_resolution):
|
||||
logger.debug(translator.get('copying_image_succeeded'), __name__)
|
||||
else:
|
||||
logger.error(translator.get('copying_image_failed'), __name__)
|
||||
|
||||
@@ -141,7 +141,7 @@ def merge_frames() -> ErrorCode:
|
||||
temp_video_fps = restrict_video_fps(state_manager.get_item('target_path'), state_manager.get_item('output_video_fps'))
|
||||
|
||||
logger.info(translator.get('merging_video').format(resolution = pack_resolution(output_video_resolution), fps = state_manager.get_item('output_video_fps')), __name__)
|
||||
if ffmpeg.merge_video(state_manager.get_item('target_path'), temp_video_fps, output_video_resolution, state_manager.get_item('output_video_fps'), trim_frame_start, trim_frame_end, state_manager.get_item('output_path')):
|
||||
if ffmpeg.merge_video(state_manager.get_item('target_path'), state_manager.get_item('output_path'), temp_video_fps, output_video_resolution, state_manager.get_item('output_video_fps'), trim_frame_start, trim_frame_end):
|
||||
logger.debug(translator.get('merging_video_succeeded'), __name__)
|
||||
else:
|
||||
if is_process_stopping():
|
||||
|
||||
@@ -109,7 +109,7 @@ def test_merge_video() -> None:
|
||||
create_temp_directory(target_path)
|
||||
extract_frames(target_path, (452, 240), 25.0, 0, 1)
|
||||
|
||||
assert merge_video(target_path, 25.0, (452, 240), 25.0, 0, 1, target_path) is True
|
||||
assert merge_video(target_path, target_path, 25.0, (452, 240), 25.0, 0, 1) is True
|
||||
|
||||
clear_temp_directory(target_path)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import os.path
|
||||
import pytest
|
||||
|
||||
from facefusion.download import conditional_download
|
||||
from facefusion.filesystem import create_directory, filter_audio_paths, filter_image_paths, get_file_extension, get_file_format, get_file_size, has_audio, has_image, has_video, in_directory, is_audio, is_directory, is_file, is_image, is_video, remove_directory, resolve_file_paths, same_file_extension
|
||||
from facefusion.filesystem import create_directory, filter_audio_paths, filter_image_paths, get_file_extension, get_file_format, get_file_size, has_audio, has_image, has_video, in_directory, is_audio, is_directory, is_file, is_image, is_video, remove_directory, resolve_file_paths
|
||||
from .helper import get_test_example_file, get_test_examples_directory, get_test_outputs_directory
|
||||
|
||||
|
||||
@@ -35,12 +35,6 @@ def test_get_file_format() -> None:
|
||||
assert get_file_format('invalid') is None
|
||||
|
||||
|
||||
def test_same_file_extension() -> None:
|
||||
assert same_file_extension('source.jpg', 'source.jpg') is True
|
||||
assert same_file_extension('source.jpg', 'source.mp3') is False
|
||||
assert same_file_extension('invalid', 'invalid') is False
|
||||
|
||||
|
||||
def test_is_file() -> None:
|
||||
assert is_file(get_test_example_file('source.jpg')) is True
|
||||
assert is_file(get_test_examples_directory()) is False
|
||||
|
||||
Reference in New Issue
Block a user