From 86448ccc9340edae3eed65e81a0c1867c163b4d0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 12 Oct 2022 15:57:40 +0800 Subject: [PATCH] Fix VAAPI Encode Error --- workflow/video.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/workflow/video.py b/workflow/video.py index 561acda..bf6af83 100644 --- a/workflow/video.py +++ b/workflow/video.py @@ -83,7 +83,8 @@ def get_encode_process_use_vaapi(orig_filename: str, subtitles: list[str], new_f encode_process = subprocess.Popen([ FFMPEG_EXEC, *_common_ffmpeg_setting(), "-hwaccel", "vaapi", "-hwaccel_output_format", "vaapi", "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles), + "hwmap=mode=read+write+direct,format=nv12," + + "".join("subtitles=%s," % i for i in subtitles) + "hwmap", "-c:v", "h264_vaapi", *_common_ffmpeg_params(), # "-t", "10", @@ -111,7 +112,7 @@ def get_encode_hevc_process_use_nvenc(orig_filename: str, subtitles: list[str], encode_process = subprocess.Popen([ FFMPEG_EXEC, *_common_ffmpeg_setting(), "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles) + ",hwupload_cuda", + "".join("subtitles=%s," % i for i in subtitles) + ",hwupload_cuda", "-c:v", "hevc_nvenc", *_common_ffmpeg_params(), # "-t", "10", @@ -125,7 +126,8 @@ def get_encode_hevc_process_use_vaapi(orig_filename: str, subtitles: list[str], encode_process = subprocess.Popen([ FFMPEG_EXEC, *_common_ffmpeg_setting(), "-hwaccel", "vaapi", "-hwaccel_output_format", "vaapi", "-i", orig_filename, "-vf", - ",".join("subtitles=%s" % i for i in subtitles), + "hwmap=mode=read+write+direct,format=nv12," + + "".join("subtitles=%s," % i for i in subtitles) + "hwmap", "-c:v", "hevc_vaapi", *_common_ffmpeg_params(), # "-t", "10",