From 4c4e3fa4e6d174f8f776448d6cc3764da0bd1890 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 2 Jun 2022 14:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80qsv=E5=8A=A0=E9=80=9F?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E4=B8=8D=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E7=9A=84rc=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danmaku_workflow.py | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) 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