Limit "hwaccel_option" to non-audio task as of codec issues

This commit is contained in:
henryruhs 2023-06-02 22:18:16 +02:00
parent 49d78c138f
commit 6bd3724443

View File

@ -31,10 +31,10 @@ def detect_fps(input_path):
def run_ffmpeg(args): def run_ffmpeg(args):
hwaccel_option = '-hwaccel cuda' if roop.globals.gpu == 'nvidia' else ''
log_level = f'-loglevel {roop.globals.log_level}' 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): 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): def create_video(video_name, fps, output_dir):
hwaccel_option = '-hwaccel cuda' if roop.globals.gpu == 'nvidia' else ''
output_dir = path(output_dir) 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): 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) 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): def add_audio(output_dir, target_path, video, keep_frames, output_file):