Spaces:
Running
Running
Commit ·
47c8f24
1
Parent(s): 1c23235
Fix flickering: detect faces every frame, no per-frame enhancement in video
Browse files- processors/face_swap.py +2 -5
- processors/video_processor.py +1 -1
processors/face_swap.py
CHANGED
|
@@ -465,11 +465,8 @@ class FaceSwapper:
|
|
| 465 |
for tgt_face in target_faces:
|
| 466 |
result = self._swapper.get(result, tgt_face, source_face, paste_back=True)
|
| 467 |
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
# temporal flicker (each frame independently restored = jitter).
|
| 471 |
-
# OpenCV unsharp+CLAHE is temporally stable and fast.
|
| 472 |
-
result = self._enhance_opencv(result, target_faces)
|
| 473 |
|
| 474 |
# Scale back up to original frame size
|
| 475 |
if scale_down < 1.0:
|
|
|
|
| 465 |
for tgt_face in target_faces:
|
| 466 |
result = self._swapper.get(result, tgt_face, source_face, paste_back=True)
|
| 467 |
|
| 468 |
+
# No per-frame enhancement for video — temporally unstable (causes flicker).
|
| 469 |
+
# FFmpeg unsharp filter handles sharpening globally at encode time.
|
|
|
|
|
|
|
|
|
|
| 470 |
|
| 471 |
# Scale back up to original frame size
|
| 472 |
if scale_down < 1.0:
|
processors/video_processor.py
CHANGED
|
@@ -19,7 +19,7 @@ import numpy as np
|
|
| 19 |
from pathlib import Path
|
| 20 |
|
| 21 |
MAX_FRAMES = 600 # ~20 s at 30 fps
|
| 22 |
-
DET_INTERVAL =
|
| 23 |
|
| 24 |
|
| 25 |
class VideoProcessor:
|
|
|
|
| 19 |
from pathlib import Path
|
| 20 |
|
| 21 |
MAX_FRAMES = 600 # ~20 s at 30 fps
|
| 22 |
+
DET_INTERVAL = 1 # detect faces every frame — caching causes flicker when face moves
|
| 23 |
|
| 24 |
|
| 25 |
class VideoProcessor:
|