Skip to content

Commit 136fc6a

Browse files
committed
Merge nvenc-av1, pixfmt, prepass fixes
4 parents 82f62dc + 17ad06a + a11bcf4 + 4980590 commit 136fc6a

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-videohelpersuite"
33
description = "Nodes related to video workflows"
4-
version = "1.5.18"
4+
version = "1.5.19"
55
license = { file = "LICENSE" }
66
dependencies = ["opencv-python", "imageio-ffmpeg"]
77

video_formats/nvenc_av1-mp4.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"main_pass":
3+
[
4+
"-n", "-c:v", "av1_nvenc",
5+
"-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]],
6+
"-vf", "scale=out_color_matrix=bt709",
7+
"-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709"
8+
],
9+
"fake_trc": "bt709",
10+
"audio_pass": ["-c:a", "aac"],
11+
"bitrate": ["bitrate","INT", {"default": 10, "min": 1, "max": 999, "step": 1 }],
12+
"megabit": ["megabit","BOOLEAN", {"default": true}],
13+
"save_metadata": ["save_metadata", "BOOLEAN", {"default": true}],
14+
"extension": "mp4"
15+
}

video_formats/nvenc_h264-mp4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main_pass":
33
[
44
"-n", "-c:v", "h264_nvenc",
5-
"-pix_fmt", ["pix_fmt", ["yuv420p", "yuv420p10le"]],
5+
"-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]],
66
"-vf", "scale=out_color_matrix=bt709",
77
"-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709"
88
],

video_formats/nvenc_hevc-mp4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[
44
"-n", "-c:v", "hevc_nvenc",
55
"-vtag", "hvc1",
6-
"-pix_fmt", ["pix_fmt", ["yuv420p", "yuv420p10le"]],
6+
"-pix_fmt", ["pix_fmt", ["yuv420p", "p010le"]],
77
"-vf", "scale=out_color_matrix=bt709",
88
"-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709"
99
],

videohelpersuite/nodes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ def pad(image):
478478
raise Exception("Formats which require a pre_pass are incompatible with Batch Manager.")
479479
images = [b''.join(images)]
480480
os.makedirs(folder_paths.get_temp_directory(), exist_ok=True)
481-
pre_pass_args = args[:13] + video_format['pre_pass']
481+
in_args_len = args.index("-i") + 2 # The index after ["-i", "-"]
482+
pre_pass_args = args[:in_args_len] + video_format['pre_pass']
482483
merge_filter_args(pre_pass_args)
483484
try:
484485
subprocess.run(pre_pass_args, input=images[0], env=env,
@@ -487,7 +488,8 @@ def pad(image):
487488
raise Exception("An error occurred in the ffmpeg prepass:\n" \
488489
+ e.stderr.decode(*ENCODE_ARGS))
489490
if "inputs_main_pass" in video_format:
490-
args = args[:13] + video_format['inputs_main_pass'] + args[13:]
491+
in_args_len = args.index("-i") + 2 # The index after ["-i", "-"]
492+
args = args[:in_args_len] + video_format['inputs_main_pass'] + args[in_args_len:]
491493

492494
if output_process is None:
493495
if 'gifski_pass' in video_format:

0 commit comments

Comments
 (0)