Skip to content

Commit 58df767

Browse files
committed
Fixes to trimming, add to formats
The js code to add format widgets incorrectly checked for truthiness, so trying to set false as a default value would leave a widget uninitialized. This has been fixed. The check for the actual state of trim_to_audio incorrectly assumed it to still be a boolean and has been corrected. The webm and h264 formats have had widgets added for trimming to audio length. After further consideration, VHS already has code to ensure that workflows won't brick if an option is removed in the future. A minor QoL being sunset in the future is still better than that QoL feature never existing. Bump version
1 parent 8027f1c commit 58df767

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
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.4.1"
4+
version = "1.4.2"
55
license = { file = "LICENSE" }
66
dependencies = ["opencv-python", "imageio-ffmpeg"]
77

video_formats/h264-mp4.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
],
1010
"audio_pass": ["-c:a", "aac"],
1111
"save_metadata": ["save_metadata", "BOOLEAN", {"default": true}],
12+
"trim_to_audio": ["trim_to_audio", "BOOLEAN", {"default": false}],
1213
"extension": "mp4"
1314
}

video_formats/webm.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
],
1111
"audio_pass": ["-c:a", "libvorbis"],
1212
"save_metadata": ["save_metadata", "BOOLEAN", {"default": true}],
13+
"trim_to_audio": ["trim_to_audio", "BOOLEAN", {"default": false}],
1314
"extension": "webm"
1415
}

videohelpersuite/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def pad(image):
538538
#Reconsider forcing apad/shortest
539539
channels = audio['waveform'].size(1)
540540
min_audio_dur = total_frames_output / frame_rate + 1
541-
if video_format.get('trim_to_audio', False):
541+
if video_format.get('trim_to_audio', 'False') != 'False':
542542
apad = []
543543
else:
544544
apad = ["-af", "apad=whole_dur="+str(min_audio_dur)]

web/js/VHS.core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ function addFormatWidgets(nodeType) {
10701070
w.options.values = w.type;
10711071
w.type = "combo";
10721072
}
1073-
if(inputData[1]?.default) {
1073+
if(inputData[1]?.default != undefined) {
10741074
w.value = inputData[1].default;
10751075
}
10761076
if (w.type == "INT") {

0 commit comments

Comments
 (0)