* honor webcam resolution to avoid stripe mismatch, update dependencies

* avoid version conflicts

* enforce prores video extraction to 8 bit

* make the installer more robust on execution switch

* make the installer more robust on execution switch

* improve the installer env handling

* different approach to handle env
This commit is contained in:
Henry Ruhs
2026-02-11 09:35:08 +01:00
committed by GitHub
parent a7f3de3dbc
commit 8801668562
8 changed files with 41 additions and 40 deletions
+2 -2
View File
@@ -43,9 +43,9 @@ def detect_local_camera_ids(id_start : int, id_end : int) -> List[int]:
local_camera_ids = []
for camera_id in range(id_start, id_end):
cv2.setLogLevel(0)
cv2.utils.logging.setLogLevel(0)
camera_capture = get_local_camera_capture(camera_id)
cv2.setLogLevel(3)
cv2.utils.logging.setLogLevel(3)
if camera_capture and camera_capture.isOpened():
local_camera_ids.append(camera_id)
+1
View File
@@ -114,6 +114,7 @@ def extract_frames(target_path : str, temp_video_resolution : Resolution, temp_v
ffmpeg_builder.set_input(target_path),
ffmpeg_builder.set_media_resolution(pack_resolution(temp_video_resolution)),
ffmpeg_builder.set_frame_quality(0),
ffmpeg_builder.enforce_pixel_format('rgb24'),
ffmpeg_builder.select_frame_range(trim_frame_start, trim_frame_end, temp_video_fps),
ffmpeg_builder.prevent_frame_drop(),
ffmpeg_builder.set_output(temp_frames_pattern)
+4
View File
@@ -79,6 +79,10 @@ def unsafe_concat() -> List[Command]:
return [ '-f', 'concat', '-safe', '0' ]
def enforce_pixel_format(pixel_format : str) -> List[Command]:
return [ '-pix_fmt', pixel_format ]
def set_pixel_format(video_encoder : VideoEncoder) -> List[Command]:
if video_encoder == 'rawvideo':
return [ '-pix_fmt', 'rgb24' ]
+23 -27
View File
@@ -19,16 +19,16 @@ LOCALES =\
}
ONNXRUNTIME_SET =\
{
'default': ('onnxruntime', '1.23.2')
'default': ('onnxruntime', '1.24.1')
}
if is_windows() or is_linux():
ONNXRUNTIME_SET['cuda'] = ('onnxruntime-gpu', '1.23.2')
ONNXRUNTIME_SET['cuda'] = ('onnxruntime-gpu', '1.24.1')
ONNXRUNTIME_SET['openvino'] = ('onnxruntime-openvino', '1.23.0')
if is_windows():
ONNXRUNTIME_SET['directml'] = ('onnxruntime-directml', '1.23.0')
ONNXRUNTIME_SET['directml'] = ('onnxruntime-directml', '1.24.1')
if is_linux():
ONNXRUNTIME_SET['migraphx'] = ('onnxruntime-migraphx', '1.23.0')
ONNXRUNTIME_SET['rocm'] = ('onnxruntime_rocm', '1.22.1', '7.0.2') #type:ignore[assignment]
ONNXRUNTIME_SET['migraphx'] = ('onnxruntime-migraphx', '1.23.2')
ONNXRUNTIME_SET['rocm'] = ('onnxruntime-rocm', '1.22.2.post1')
def cli() -> None:
@@ -48,15 +48,16 @@ def signal_exit(signum : int, frame : FrameType) -> None:
def run(program : ArgumentParser) -> None:
args = program.parse_args()
has_conda = 'CONDA_PREFIX' in os.environ
commands = [ shutil.which('pip'), 'install' ]
if args.force_reinstall:
commands.append('--force-reinstall')
if not args.skip_conda and not has_conda:
sys.stdout.write(LOCALES.get('conda_not_activated') + os.linesep)
sys.exit(1)
commands = [ shutil.which('pip'), 'install' ]
if args.force_reinstall:
commands.append('--force-reinstall')
with open('requirements.txt') as file:
for line in file.readlines():
@@ -64,17 +65,10 @@ def run(program : ArgumentParser) -> None:
if not __line__.startswith('onnxruntime'):
commands.append(__line__)
if args.onnxruntime == 'rocm':
onnxruntime_name, onnxruntime_version, rocm_version = ONNXRUNTIME_SET.get(args.onnxruntime) #type:ignore[misc]
python_id = 'cp' + str(sys.version_info.major) + str(sys.version_info.minor)
onnxruntime_name, onnxruntime_version = ONNXRUNTIME_SET.get(args.onnxruntime)
commands.append(onnxruntime_name + '==' + onnxruntime_version)
if python_id in [ 'cp310', 'cp312' ]:
wheel_name = onnxruntime_name + '-' + onnxruntime_version + '-' + python_id + '-' + python_id + '-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl'
wheel_url = 'https://repo.radeon.com/rocm/manylinux/rocm-rel-' + rocm_version + '/' + wheel_name
commands.append(wheel_url)
else:
onnxruntime_name, onnxruntime_version = ONNXRUNTIME_SET.get(args.onnxruntime)
commands.append(onnxruntime_name + '==' + onnxruntime_version)
subprocess.call([shutil.which('pip'), 'uninstall', 'onnxruntime', onnxruntime_name, '-y', '-q' ])
subprocess.call(commands)
@@ -82,28 +76,30 @@ def run(program : ArgumentParser) -> None:
library_paths = []
if is_linux():
if os.getenv('LD_LIBRARY_PATH'):
library_paths = os.getenv('LD_LIBRARY_PATH').split(os.pathsep)
python_id = 'python' + str(sys.version_info.major) + '.' + str(sys.version_info.minor)
library_paths.extend(
[
os.path.join(os.getenv('CONDA_PREFIX'), 'lib'),
os.path.join(os.getenv('CONDA_PREFIX'), 'lib', python_id, 'site-packages', 'tensorrt_libs')
])
library_paths = list(dict.fromkeys([ library_path for library_path in library_paths if os.path.exists(library_path) ]))
if os.getenv('LD_LIBRARY_PATH'):
library_paths.extend(os.getenv('LD_LIBRARY_PATH').split(os.pathsep))
library_paths = list(dict.fromkeys(filter(os.path.exists, library_paths)))
subprocess.call([ shutil.which('conda'), 'env', 'config', 'vars', 'set', 'LD_LIBRARY_PATH=' + os.pathsep.join(library_paths) ])
if is_windows():
if os.getenv('PATH'):
library_paths = os.getenv('PATH').split(os.pathsep)
library_paths.extend(
[
os.path.join(os.getenv('CONDA_PREFIX'), 'Lib'),
os.path.join(os.getenv('CONDA_PREFIX'), 'Lib', 'site-packages', 'tensorrt_libs')
])
library_paths = list(dict.fromkeys([ library_path for library_path in library_paths if os.path.exists(library_path) ]))
if os.getenv('PATH'):
library_paths.extend(os.getenv('PATH').split(os.pathsep))
library_paths = list(dict.fromkeys(filter(os.path.exists, library_paths)))
subprocess.call([ shutil.which('conda'), 'env', 'config', 'vars', 'set', 'PATH=' + os.pathsep.join(library_paths) ])
+1 -1
View File
@@ -189,7 +189,7 @@ LOCALES : Locales =\
},
'about':
{
'fund': 'fund training server',
'fund': 'fund ai workstation',
'subscribe': 'become a member',
'join': 'join our community'
},
+1 -1
View File
@@ -4,7 +4,7 @@ METADATA =\
{
'name': 'FaceFusion',
'description': 'Industry leading face manipulation platform',
'version': '3.5.2',
'version': '3.5.3',
'license': 'OpenRAIL-AS',
'author': 'Henry Ruhs',
'url': 'https://facefusion.io'
+3 -2
View File
@@ -10,7 +10,7 @@ from facefusion.streamer import multi_process_capture, open_stream
from facefusion.types import Fps, VisionFrame, WebcamMode
from facefusion.uis.core import get_ui_component
from facefusion.uis.types import File
from facefusion.vision import unpack_resolution
from facefusion.vision import fit_cover_frame, unpack_resolution
SOURCE_FILE : Optional[gradio.File] = None
WEBCAM_IMAGE : Optional[gradio.Image] = None
@@ -100,10 +100,11 @@ def start(webcam_device_id : int, webcam_mode : WebcamMode, webcam_resolution :
for capture_frame in multi_process_capture(camera_capture, webcam_fps):
capture_frame = cv2.cvtColor(capture_frame, cv2.COLOR_BGR2RGB)
capture_frame = fit_cover_frame(capture_frame, (webcam_width, webcam_height))
if webcam_mode == 'inline':
yield capture_frame
else:
if webcam_mode in [ 'udp', 'v4l2' ]:
try:
stream.stdin.write(capture_frame.tobytes())
except Exception:
+6 -7
View File
@@ -1,9 +1,8 @@
gradio-rangeslider==0.0.8
gradio==5.44.1
numpy==2.2.6
onnx==1.19.1
onnxruntime==1.23.2
opencv-python==4.12.0.88
psutil==7.1.3
tqdm==4.67.1
scipy==1.16.3
numpy==2.2.1
onnx==1.20.1
onnxruntime==1.24.1
opencv-python==4.13.0.92
tqdm==4.67.3
scipy==1.17.0