Compare commits
20 Commits
experiment
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4324b41b9e | ||
|
|
a6e00211f0 | ||
|
|
99214c7ab1 | ||
|
|
080d6f5110 | ||
|
|
155546b937 | ||
|
|
79fbb7998c | ||
|
|
5ce2fd298b | ||
|
|
740410dd73 | ||
|
|
cbc7c22f1c | ||
|
|
a31e81fa66 | ||
|
|
e8a8acca9f | ||
|
|
a9d4564726 | ||
|
|
fc47cffb18 | ||
|
|
fff3009c80 | ||
|
|
84c10400b9 | ||
|
|
9f58dfeee1 | ||
|
|
04e72a85c3 | ||
|
|
6a17297e2f | ||
|
|
ddd19474da | ||
|
|
d49a77b3a3 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -6,14 +6,16 @@ __pycache__/
|
||||
.todo
|
||||
*.log
|
||||
*.backup
|
||||
|
||||
tf_env/
|
||||
*.png
|
||||
*.mp4
|
||||
*.mkv
|
||||
|
||||
.tmp/
|
||||
temp/
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
workflow/
|
||||
gfpgan/
|
||||
models/inswapper_128.onnx
|
||||
|
||||
1
CONTRIBUTING.md
Normal file
1
CONTRIBUTING.md
Normal file
@@ -0,0 +1 @@
|
||||
Please always push on the experimental to ensure we don't mess with the main branch. All the test will be done on the experimental and will be pushed to the main branch after few days of testing.
|
||||
12
README.md
12
README.md
@@ -6,7 +6,7 @@ This software is meant to be a productive contribution to the rapidly growing AI
|
||||
|
||||
The developers of this software are aware of its possible unethical applications and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.
|
||||
|
||||
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.
|
||||
Users of this software are expected to use this software responsibly while abiding by local laws. If the face of a real person is being used, users are required to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.
|
||||
|
||||
## How do I install it?
|
||||
|
||||
@@ -135,7 +135,7 @@ Choose a face (image with desired face) and the target image/video (image/video
|
||||
Just follow the clicks on the screenshot
|
||||
1. Select a face
|
||||
2. Click live
|
||||
3. Wait for a few second (it takes a longer time, usually 10 to 30 seconds before the preview shows up)
|
||||
3. Wait for a few seconds (it takes a longer time, usually 10 to 30 seconds before the preview shows up)
|
||||
|
||||

|
||||
|
||||
@@ -166,10 +166,14 @@ options:
|
||||
|
||||
Looking for a CLI mode? Using the -s/--source argument will make the run program in cli mode.
|
||||
|
||||
## Want the Next Update Now?
|
||||
If you want the latest and greatest build, or want to see some new great features, go to our [experimental branch](https://github.com/hacksider/Deep-Live-Cam/tree/experimental) and experience what the contributors have given.
|
||||
|
||||
## Credits
|
||||
- [henryruhs](https://github.com/henryruhs): for being an irreplaceable contributor to the project
|
||||
|
||||
- [ffmpeg](https://ffmpeg.org/): for making video related operations easy
|
||||
- [deepinsight](https://github.com/deepinsight): for their [insightface](https://github.com/deepinsight/insightface) project which provided a well-made library and models.
|
||||
- [havok2-htwo](https://github.com/havok2-htwo) : for sharing the code for webcam
|
||||
- [GosuDRM](https://github.com/GosuDRM/nsfw-roop) : for uncensoring roop
|
||||
- and all developers behind libraries used in this project.
|
||||
- and [all developers](https://github.com/hacksider/Deep-Live-Cam/graphs/contributors) behind libraries used in this project.
|
||||
- Foot Note: [This is originally roop-cam, see the full history of the code here.](https://github.com/hacksider/roop-cam) Please be informed that the base author of the code is [s0md3v](https://github.com/s0md3v/roop)
|
||||
|
||||
@@ -74,7 +74,7 @@ def parse_args() -> None:
|
||||
modules.globals.fp_ui['face_enhancer'] = True
|
||||
else:
|
||||
modules.globals.fp_ui['face_enhancer'] = False
|
||||
|
||||
|
||||
modules.globals.nsfw = False
|
||||
|
||||
# translate deprecated args
|
||||
@@ -165,7 +165,6 @@ def update_status(message: str, scope: str = 'DLC.CORE') -> None:
|
||||
if not modules.globals.headless:
|
||||
ui.update_status(message)
|
||||
|
||||
|
||||
def start() -> None:
|
||||
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
||||
if not frame_processor.pre_start():
|
||||
|
||||
@@ -61,11 +61,11 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||
target_label = ctk.CTkLabel(root, text=None)
|
||||
target_label.place(relx=0.6, rely=0.1, relwidth=0.3, relheight=0.25)
|
||||
|
||||
source_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path())
|
||||
source_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||
select_face_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path())
|
||||
select_face_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||
|
||||
target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path())
|
||||
target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||
select_target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path())
|
||||
select_target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1)
|
||||
|
||||
keep_fps_value = ctk.BooleanVar(value=modules.globals.keep_fps)
|
||||
keep_fps_checkbox = ctk.CTkSwitch(root, text='Keep fps', variable=keep_fps_value, cursor='hand2', command=lambda: setattr(modules.globals, 'keep_fps', not modules.globals.keep_fps))
|
||||
@@ -88,9 +88,9 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||
many_faces_switch = ctk.CTkSwitch(root, text='Many faces', variable=many_faces_value, cursor='hand2', command=lambda: setattr(modules.globals, 'many_faces', many_faces_value.get()))
|
||||
many_faces_switch.place(relx=0.6, rely=0.65)
|
||||
|
||||
nsfw_value = ctk.BooleanVar(value=modules.globals.nsfw)
|
||||
nsfw_switch = ctk.CTkSwitch(root, text='NSFW', variable=nsfw_value, cursor='hand2', command=lambda: setattr(modules.globals, 'nsfw', nsfw_value.get()))
|
||||
nsfw_switch.place(relx=0.6, rely=0.7)
|
||||
# nsfw_value = ctk.BooleanVar(value=modules.globals.nsfw)
|
||||
# nsfw_switch = ctk.CTkSwitch(root, text='NSFW', variable=nsfw_value, cursor='hand2', command=lambda: setattr(modules.globals, 'nsfw', nsfw_value.get()))
|
||||
# nsfw_switch.place(relx=0.6, rely=0.7)
|
||||
|
||||
start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: select_output_path(start))
|
||||
start_button.place(relx=0.15, rely=0.80, relwidth=0.2, relheight=0.05)
|
||||
@@ -101,23 +101,8 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||
preview_button = ctk.CTkButton(root, text='Preview', cursor='hand2', command=lambda: toggle_preview())
|
||||
preview_button.place(relx=0.65, rely=0.80, relwidth=0.2, relheight=0.05)
|
||||
|
||||
# --- Camera Selection ---
|
||||
camera_label = ctk.CTkLabel(root, text="Select Camera:")
|
||||
camera_label.place(relx=0.4, rely=0.86, relwidth=0.2, relheight=0.05)
|
||||
|
||||
available_cameras = get_available_cameras()
|
||||
|
||||
# Convert camera indices to strings for CTkOptionMenu
|
||||
available_camera_strings = [str(cam) for cam in available_cameras]
|
||||
|
||||
camera_variable = ctk.StringVar(value=available_camera_strings[0] if available_camera_strings else "No cameras found")
|
||||
camera_optionmenu = ctk.CTkOptionMenu(root, variable=camera_variable,
|
||||
values=available_camera_strings)
|
||||
camera_optionmenu.place(relx=0.65, rely=0.86, relwidth=0.2, relheight=0.05)
|
||||
|
||||
live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview(int(camera_variable.get())))
|
||||
live_button.place(relx=0.15, rely=0.86, relwidth=0.2, relheight=0.05)
|
||||
# --- End Camera Selection ---
|
||||
live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview())
|
||||
live_button.place(relx=0.40, rely=0.86, relwidth=0.2, relheight=0.05)
|
||||
|
||||
status_label = ctk.CTkLabel(root, text=None, justify='center')
|
||||
status_label.place(relx=0.1, rely=0.9, relwidth=0.8)
|
||||
@@ -264,18 +249,14 @@ def update_preview(frame_number: int = 0) -> None:
|
||||
image = ctk.CTkImage(image, size=image.size)
|
||||
preview_label.configure(image=image)
|
||||
|
||||
def webcam_preview(camera_index: int):
|
||||
def webcam_preview():
|
||||
if modules.globals.source_path is None:
|
||||
# No image selected
|
||||
return
|
||||
|
||||
global preview_label, PREVIEW
|
||||
|
||||
cap = cv2.VideoCapture(camera_index)
|
||||
if not cap.isOpened():
|
||||
update_status(f"Error: Could not open camera with index {camera_index}")
|
||||
return
|
||||
|
||||
cap = cv2.VideoCapture(0) # Use index for the webcam (adjust the index accordingly if necessary)
|
||||
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 960) # Set the width of the resolution
|
||||
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 540) # Set the height of the resolution
|
||||
cap.set(cv2.CAP_PROP_FPS, 60) # Set the frame rate of the webcam
|
||||
@@ -311,15 +292,8 @@ def webcam_preview(camera_index: int):
|
||||
preview_label.configure(image=image)
|
||||
ROOT.update()
|
||||
|
||||
if PREVIEW.state() == 'withdrawn':
|
||||
break
|
||||
|
||||
cap.release()
|
||||
PREVIEW.withdraw() # Close preview window when loop is finished
|
||||
|
||||
def get_available_cameras():
|
||||
"""Returns a list of available camera indices."""
|
||||
available_cameras = []
|
||||
for index in range(10): # Check for cameras with index 0 to 9
|
||||
cap = cv2.VideoCapture(index)
|
||||
if cap.isOpened():
|
||||
available_cameras.append(index)
|
||||
cap.release()
|
||||
return available_cameras
|
||||
Reference in New Issue
Block a user