diff --git a/danmaku_workflow.py b/danmaku_workflow.py index 8e99a67..96b53d2 100644 --- a/danmaku_workflow.py +++ b/danmaku_workflow.py @@ -420,8 +420,8 @@ def get_encode_process_use_nvenc(orig_filename: str, subtitles: list[str], new_f encode_process = subprocess.Popen([ FFMPEG_EXEC, *_common_ffmpeg_setting(), "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles) + ",hwupload_cuda", - "-c:v", "h264_nvenc", "-rc:v", "vbr", + ",".join("subtitles=%s" % i for i in subtitles), + "-c:v", "h264_nvenc", *_common_ffmpeg_params(), # "-t", "10", new_filename @@ -430,28 +430,17 @@ def get_encode_process_use_nvenc(orig_filename: str, subtitles: list[str], new_f def get_encode_process_use_intel(orig_filename: str, subtitles: list[str], new_filename: str): - if platform.system().lower() == "windows": - print("[+]Use Intel QSV Acceleration") - encode_process = subprocess.Popen([ - FFMPEG_EXEC, *_common_ffmpeg_setting(), - "-hwaccel", "qsv", "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles), - "-c:v", "h264_qsv", "-rc:v", "vbr", - *_common_ffmpeg_params(), - # "-t", "10", - new_filename - ], **subprocess_args(True)) - else: - print("[+]Use Intel VAAPI Acceleration") - encode_process = subprocess.Popen([ - FFMPEG_EXEC, *_common_ffmpeg_setting(), - "-hwaccel", "vaapi", "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles) + ",hwupload", - "-c:v", "h264_vaapi", "-rc:v", "vbr", - *_common_ffmpeg_params(), - # "-t", "10", - new_filename - ], **subprocess_args(True)) + print("[+]Use Intel QSV Acceleration") + encode_process = subprocess.Popen([ + FFMPEG_EXEC, *_common_ffmpeg_setting(), + "-init_hw_device", "qsv=hw", "-filter_hw_device", "hw", + "-i", orig_filename, "-vf", + ",".join("subtitles=%s" % i for i in subtitles), + "-c:v", "h264_qsv", + *_common_ffmpeg_params(), + # "-t", "10", + new_filename + ], stdout=subprocess.PIPE) return encode_process