From 4980590ac12259213e854f2d68515fa3dc55c816 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Sun, 6 Apr 2025 14:41:41 +0300 Subject: [PATCH 1/3] Fix `pre_pass` and `inputs_main_pass` `args` index. --- videohelpersuite/nodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/videohelpersuite/nodes.py b/videohelpersuite/nodes.py index be64d4e..dec3bd8 100755 --- a/videohelpersuite/nodes.py +++ b/videohelpersuite/nodes.py @@ -478,7 +478,8 @@ class VideoCombine: raise Exception("Formats which require a pre_pass are incompatible with Batch Manager.") images = [b''.join(images)] os.makedirs(folder_paths.get_temp_directory(), exist_ok=True) - pre_pass_args = args[:13] + video_format['pre_pass'] + in_args_len = args.index("-i") + 2 # The index after ["-i", "-"] + pre_pass_args = args[:in_args_len] + video_format['pre_pass'] merge_filter_args(pre_pass_args) try: subprocess.run(pre_pass_args, input=images[0], env=env, @@ -487,7 +488,8 @@ class VideoCombine: raise Exception("An error occurred in the ffmpeg prepass:\n" \ + e.stderr.decode(*ENCODE_ARGS)) if "inputs_main_pass" in video_format: - args = args[:13] + video_format['inputs_main_pass'] + args[13:] + in_args_len = args.index("-i") + 2 # The index after ["-i", "-"] + args = args[:in_args_len] + video_format['inputs_main_pass'] + args[in_args_len:] if output_process is None: if 'gifski_pass' in video_format: From 17ad06aa2574e1bac43759986cb020c39af5fa8b Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Sun, 6 Apr 2025 15:25:09 +0300 Subject: [PATCH 2/3] Add NVENC AV1 format. --- video_formats/nvenc_av1-mp4.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 video_formats/nvenc_av1-mp4.json diff --git a/video_formats/nvenc_av1-mp4.json b/video_formats/nvenc_av1-mp4.json new file mode 100644 index 0000000..0996c65 --- /dev/null +++ b/video_formats/nvenc_av1-mp4.json @@ -0,0 +1,15 @@ +{ + "main_pass": + [ + "-n", "-c:v", "av1_nvenc", + "-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]], + "-vf", "scale=out_color_matrix=bt709", + "-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709" + ], + "fake_trc": "bt709", + "audio_pass": ["-c:a", "aac"], + "bitrate": ["bitrate","INT", {"default": 10, "min": 1, "max": 999, "step": 1 }], + "megabit": ["megabit","BOOLEAN", {"default": true}], + "save_metadata": ["save_metadata", "BOOLEAN", {"default": true}], + "extension": "mp4" +} From a11bcf4a08c25ef1ee7bb6738ca899c82f7e72b3 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Sun, 6 Apr 2025 15:49:15 +0300 Subject: [PATCH 3/3] Use correct `p010le` pixel format with NVENC. --- video_formats/nvenc_h264-mp4.json | 2 +- video_formats/nvenc_hevc-mp4.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/video_formats/nvenc_h264-mp4.json b/video_formats/nvenc_h264-mp4.json index 20d9719..1c39913 100644 --- a/video_formats/nvenc_h264-mp4.json +++ b/video_formats/nvenc_h264-mp4.json @@ -2,7 +2,7 @@ "main_pass": [ "-n", "-c:v", "h264_nvenc", - "-pix_fmt", ["pix_fmt", ["yuv420p", "yuv420p10le"]], + "-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]], "-vf", "scale=out_color_matrix=bt709", "-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709" ], diff --git a/video_formats/nvenc_hevc-mp4.json b/video_formats/nvenc_hevc-mp4.json index eabb278..2ec6f41 100644 --- a/video_formats/nvenc_hevc-mp4.json +++ b/video_formats/nvenc_hevc-mp4.json @@ -3,7 +3,7 @@ [ "-n", "-c:v", "hevc_nvenc", "-vtag", "hvc1", - "-pix_fmt", ["pix_fmt", ["yuv420p", "yuv420p10le"]], + "-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]], "-vf", "scale=out_color_matrix=bt709", "-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709" ],