diff --git a/roop/utils.py b/roop/utils.py index 34976ba..a9b0d05 100644 --- a/roop/utils.py +++ b/roop/utils.py @@ -31,10 +31,10 @@ def detect_fps(input_path): def run_ffmpeg(args): - hwaccel_option = '-hwaccel cuda' if roop.globals.gpu == 'nvidia' else '' + log_level = f'-loglevel {roop.globals.log_level}' - os.system(f'ffmpeg {hwaccel_option} {log_level} {args}') + os.system(f'ffmpeg {log_level} {args}') def set_fps(input_path, output_path, fps): @@ -43,13 +43,15 @@ def set_fps(input_path, output_path, fps): def create_video(video_name, fps, output_dir): + hwaccel_option = '-hwaccel cuda' if roop.globals.gpu == 'nvidia' else '' output_dir = path(output_dir) - run_ffmpeg(f'-framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4"') + run_ffmpeg(f'{hwaccel_option} -framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4"') def extract_frames(input_path, output_dir): + hwaccel_option = '-hwaccel cuda' if roop.globals.gpu == 'nvidia' else '' input_path, output_dir = path(input_path), path(output_dir) - run_ffmpeg(f'-i "{input_path}" "{output_dir}{sep}%04d.png"') + run_ffmpeg(f' {hwaccel_option} -i "{input_path}" "{output_dir}{sep}%04d.png"') def add_audio(output_dir, target_path, video, keep_frames, output_file):