From 030d6a698bd0d7bf2dfe5588a887a833d90223b0 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Fri, 2 Jun 2023 19:43:30 +0200 Subject: [PATCH] Less verbose ffmpeg outputs --- README.md | 1 + roop/core.py | 2 +- roop/utils.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 20eb6d1..af29800 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ options: maximum amount of RAM in GB to be used --max-cores CORES_COUNT number of cores to be use for CPU mode + --all-faces swap all faces in frame ``` Looking for a CLI mode? Using the -f/--face argument will make the program in cli mode. diff --git a/roop/core.py b/roop/core.py index 7acf33b..8405d08 100755 --- a/roop/core.py +++ b/roop/core.py @@ -102,7 +102,7 @@ def start_processing(): if args['gpu'] or n < 2: process_video(args['source_img'], args["frame_paths"]) return - # multi thread if video frames to cpu cores ratio is 2 + # multithread if total frames to cpu cores ratio is greater than 2 if n > 2: processes = [] for i in range(0, len(frame_paths), n): diff --git a/roop/utils.py b/roop/utils.py index 50aca35..bc3d25a 100644 --- a/roop/utils.py +++ b/roop/utils.py @@ -31,24 +31,24 @@ def detect_fps(input_path): def set_fps(input_path, output_path, fps): input_path, output_path = path(input_path), path(output_path) - os.system(f'ffmpeg -i "{input_path}" -filter:v fps=fps={fps} "{output_path}"') + os.system(f'ffmpeg -i "{input_path}" -filter:v fps=fps={fps} "{output_path}" -loglevel error') def create_video(video_name, fps, output_dir): output_dir = path(output_dir) - os.system(f'ffmpeg -framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4"') + os.system(f'ffmpeg -framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4" -loglevel error') def extract_frames(input_path, output_dir): input_path, output_dir = path(input_path), path(output_dir) - os.system(f'ffmpeg -i "{input_path}" "{output_dir}{sep}%04d.png"') + os.system(f'ffmpeg -i "{input_path}" "{output_dir}{sep}%04d.png" -loglevel error') def add_audio(output_dir, target_path, video, keep_frames, output_file): video_name = os.path.splitext(video)[0] save_to = output_file if output_file else output_dir + "/swapped-" + video_name + ".mp4" save_to_ff, output_dir_ff = path(save_to), path(output_dir) - os.system(f'ffmpeg -i "{output_dir_ff}{sep}output.mp4" -i "{output_dir_ff}{sep}{video}" -c:v copy -map 0:v:0 -map 1:a:0 -y "{save_to_ff}"') + os.system(f'ffmpeg -i "{output_dir_ff}{sep}output.mp4" -i "{output_dir_ff}{sep}{video}" -c:v copy -map 0:v:0 -map 1:a:0 -y "{save_to_ff}" -loglevel error') if not os.path.isfile(save_to): shutil.move(output_dir + "/output.mp4", save_to) if not keep_frames: