* Modernize CI

* Modernize CI

* Modernize CI

* Implement dynamic config (#518)

* Implement dynamic config

* Fix apply config

* Move config to general

* Move config to general

* Move config to general

* Add Windows installer

* Add --open-browser

* Add Windows installer part2

* Use non-commercial license for the installer

* Fix create environment in installer

* Fix openvino for installer

* Fix conda for installer

* Fix conda for installer, Remove python and pip as it is part of conda

* Improve installer - guess the path

* Fix CI

* Add missing accept-source-agreements to installer

* Install WinGet

* Improve WinGet installation steps

* Use absolute path for winget

* More installer polishing

* Add final page to installer, disable version check for Gradio

* Remove finish page again

* Use NEXT for metadata

* Support for /S mode

* Use winget-less approach

* Improve Conda uninstall

* Improve code using platform helpers (#529)

* Update dependencies

* Feat/fix windows unicode paths (#531)

* Fix the Windows unicode path dilemma

* Update dependencies

* Fix the Windows unicode path dilemma part2

* Remove conda environment on uninstall

* Fix uninstall command

* Install apps for local user only

* Add ultra sharp

* Add clear reality

* Update README and FUNDING

* Update FUNDING.yml

* Prevent preview of large videos in Gradio (#540)

* Fix order

* Refactor temporary file management, Use temporary file for image processing (#542)

* Allow webm on target component

* Reduce mosaic effect for frame processors

* clear static faces on trim frame changes

* Fix trim frame component

* Downgrade openvino dependency

* Prepare next release

* Move get_short_path to filesystem, Add/Improve some testing

* Prepare installer, Prevent infinite loop for sanitize_path_for_windows

* Introduce execution device id

* Introduce execution device id

* Seems like device id can be a string

* Seems like device id can be a string

* Make Intel Arc work with OpenVINOExecution

* Use latest Git

* Update wording

* Fix create_float_range

* Update preview

* Fix Git link
This commit is contained in:
Henry Ruhs
2024-05-19 15:22:03 +02:00
committed by GitHub
parent 6ff35965a7
commit 319e3f9652
46 changed files with 555 additions and 213 deletions

View File

@@ -6,7 +6,7 @@ import filetype
import facefusion.globals
from facefusion import logger, process_manager
from facefusion.typing import OutputVideoPreset, Fps, AudioBuffer
from facefusion.filesystem import get_temp_frames_pattern, get_temp_output_video_path
from facefusion.filesystem import get_temp_frames_pattern, get_temp_file_path
from facefusion.vision import restrict_video_fps
@@ -60,7 +60,7 @@ def extract_frames(target_path : str, temp_video_resolution : str, temp_video_fp
def merge_video(target_path : str, output_video_resolution : str, output_video_fps : Fps) -> bool:
temp_video_fps = restrict_video_fps(target_path, output_video_fps)
temp_output_video_path = get_temp_output_video_path(target_path)
temp_file_path = get_temp_file_path(target_path)
temp_frames_pattern = get_temp_frames_pattern(target_path, '%04d')
commands = [ '-r', str(temp_video_fps), '-i', temp_frames_pattern, '-s', str(output_video_resolution), '-c:v', facefusion.globals.output_video_encoder ]
@@ -76,20 +76,22 @@ def merge_video(target_path : str, output_video_resolution : str, output_video_f
if facefusion.globals.output_video_encoder in [ 'h264_amf', 'hevc_amf' ]:
output_video_compression = round(51 - (facefusion.globals.output_video_quality * 0.51))
commands.extend([ '-qp_i', str(output_video_compression), '-qp_p', str(output_video_compression), '-quality', map_amf_preset(facefusion.globals.output_video_preset) ])
commands.extend([ '-vf', 'framerate=fps=' + str(output_video_fps), '-pix_fmt', 'yuv420p', '-colorspace', 'bt709', '-y', temp_output_video_path ])
commands.extend([ '-vf', 'framerate=fps=' + str(output_video_fps), '-pix_fmt', 'yuv420p', '-colorspace', 'bt709', '-y', temp_file_path ])
return run_ffmpeg(commands)
def copy_image(target_path : str, output_path : str, temp_image_resolution : str) -> bool:
def copy_image(target_path : str, temp_image_resolution : str) -> bool:
temp_file_path = get_temp_file_path(target_path)
is_webp = filetype.guess_mime(target_path) == 'image/webp'
temp_image_compression = 100 if is_webp else 0
commands = [ '-i', target_path, '-s', str(temp_image_resolution), '-q:v', str(temp_image_compression), '-y', output_path ]
commands = [ '-i', target_path, '-s', str(temp_image_resolution), '-q:v', str(temp_image_compression), '-y', temp_file_path ]
return run_ffmpeg(commands)
def finalize_image(output_path : str, output_image_resolution : str) -> bool:
def finalize_image(target_path : str, output_path : str, output_image_resolution : str) -> bool:
temp_file_path = get_temp_file_path(target_path)
output_image_compression = round(31 - (facefusion.globals.output_image_quality * 0.31))
commands = [ '-i', output_path, '-s', str(output_image_resolution), '-q:v', str(output_image_compression), '-y', output_path ]
commands = [ '-i', temp_file_path, '-s', str(output_image_resolution), '-q:v', str(output_image_compression), '-y', output_path ]
return run_ffmpeg(commands)
@@ -105,8 +107,8 @@ def read_audio_buffer(target_path : str, sample_rate : int, channel_total : int)
def restore_audio(target_path : str, output_path : str, output_video_fps : Fps) -> bool:
trim_frame_start = facefusion.globals.trim_frame_start
trim_frame_end = facefusion.globals.trim_frame_end
temp_output_video_path = get_temp_output_video_path(target_path)
commands = [ '-i', temp_output_video_path ]
temp_file_path = get_temp_file_path(target_path)
commands = [ '-i', temp_file_path ]
if trim_frame_start is not None:
start_time = trim_frame_start / output_video_fps
@@ -119,8 +121,8 @@ def restore_audio(target_path : str, output_path : str, output_video_fps : Fps)
def replace_audio(target_path : str, audio_path : str, output_path : str) -> bool:
temp_output_path = get_temp_output_video_path(target_path)
commands = [ '-i', temp_output_path, '-i', audio_path, '-af', 'apad', '-shortest', '-y', output_path ]
temp_file_path = get_temp_file_path(target_path)
commands = [ '-i', temp_file_path, '-i', audio_path, '-af', 'apad', '-shortest', '-y', output_path ]
return run_ffmpeg(commands)