decouple from streamer

This commit is contained in:
harisreedhar
2026-06-10 14:26:06 +05:30
parent d1830d244f
commit 0da13a919c
2 changed files with 8 additions and 2 deletions
+8
View File
@@ -9,6 +9,8 @@ from facefusion.types import Face, FaceStabilizerStore, FaceStabilizerTrail, Fac
FACE_STABILIZER_STORE : FaceStabilizerStore = {}
FACE_STABILIZER_TRAIL : FaceStabilizerTrail = {}
FACE_STABILIZER_TRAIL_LENGTH = 64
FACE_STABILIZER_TIMESTAMP = 0.0
FACE_STABILIZER_GAP = 1.0
def clear_face_stabilizer() -> None:
@@ -27,11 +29,17 @@ def append_face_stabilizer_trail(face_key : str, raw_point : Points, smoothed_po
def stabilize_faces(faces : List[Face], resolution : Resolution, smoothness : float) -> List[Face]:
global FACE_STABILIZER_TIMESTAMP
stabilized_faces = []
if smoothness > 0:
timestamp = monotonic()
if timestamp - FACE_STABILIZER_TIMESTAMP > FACE_STABILIZER_GAP:
clear_face_stabilizer()
FACE_STABILIZER_TIMESTAMP = timestamp
for index, face in enumerate(faces):
stabilized_faces.append(stabilize_face(face, str(index), timestamp, resolution, smoothness))
return stabilized_faces
-2
View File
@@ -11,7 +11,6 @@ from tqdm import tqdm
from facefusion import ffmpeg_builder, logger, state_manager, translator
from facefusion.audio import create_empty_audio_frame
from facefusion.content_analyser import analyse_stream
from facefusion.face_stabilizer import clear_face_stabilizer
from facefusion.ffmpeg import open_ffmpeg
from facefusion.filesystem import is_directory
from facefusion.processors.core import get_processors_modules
@@ -22,7 +21,6 @@ from facefusion.vision import extract_vision_mask, read_static_images
def multi_process_capture(camera_capture : cv2.VideoCapture, camera_fps : Fps) -> Iterator[VisionFrame]:
capture_deque : Deque[VisionFrame] = deque()
source_vision_frames = read_static_images(state_manager.get_item('source_paths'))
clear_face_stabilizer()
with tqdm(desc = translator.get('streaming'), unit = 'frame', disable = state_manager.get_item('log_level') in [ 'warn', 'error' ]) as progress:
with ThreadPoolExecutor(max_workers = state_manager.get_item('execution_thread_count')) as executor: