Feature Truncate Or Extend β‘π ‘π π £π
Fixing length mismatches between reactive signals
- feature
- target_feature_pipe
- FEATURE
This is a plumbing node, and if you've spent any time chaining two or more Feature extractors in RyanOnTheInside's system you've probably already hit the problem it solves: two features that don't have the same number of frames. An audio-amplitude feature sampled at 3 fps and a motion feature sampled at 24 fps, or two audio features analyzed over clips of slightly different length, simply won't line up frame-for-frame - and most Flex nodes expect their feature input to match the frame count of whatever they're modulating. FeatureTruncateOrExtend forces one feature to match the length of another, either by cutting it short or padding it out.
How it works
You give it the feature you want to fix, plus a target_feature_pipe - the FEATURE_PIPE (the pack's bundled frame-count/fps context object) belonging to the sequence you want to match. If your input feature is longer than the target, it gets truncated to fit. If it's shorter, it gets extended using whichever fill_method you pick: zeros and ones pad with flat dead values, average pads with the feature's own mean (a reasonable neutral choice if you don't want the tail to spike or flatline), random fills with noise, and repeat loops the existing values to fill the gap - usually the most natural-looking option if the feature has any rhythm to it.
Inputs and outputs that matter
feature(FEATURE, required) - the signal you're reshaping.target_feature_pipe(FEATURE_PIPE, required, tooltip: "Feature pipe to match length with") - defines the frame count you're matching against. You get this from whatever node produced the sequence you actually want to sync to.fill_method- one ofzeros,ones,average,random,repeat. Only matters when extending; ignored when truncating.invert_output(boolean, default off) - flips the resulting values, in case the feature you're aligning needs to run in the opposite direction from how it came in.
The single output is FEATURE - same type as the input, now length-matched, ready to plug into a Flex node alongside whatever else is driven by the target sequence.
How to install it
Same as the rest of the pack. ComfyUI Manager, search "RyanOnTheInside," install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt
This node itself has no special dependency - it's pure sequence manipulation - but you need the rest of the pack installed to have Feature and FEATURE_PIPE objects to feed it in the first place.
Common issues & troubleshooting
Where do I even get a FEATURE_PIPE? It's not something you build by hand - it comes bundled with the output of whichever node originally extracted a feature over your target sequence (your video's frame count, your audio's fps, etc.). If you're not sure which one to use, trace back to the node whose length you're actually trying to match and grab its pipe output from there.
The extended tail looks jarring. That's almost always fill_method fighting the character of the data. zeros or ones create an abrupt flat plateau that reads as a hard cut in whatever effect it's driving; repeat tends to look far more natural for anything rhythmic (audio, motion) because it continues the pattern instead of stopping it dead. Try repeat or average before assuming the node itself is misbehaving.
Nothing visibly changes after truncating. If the feature was already shorter than or equal to the target length, truncation is a no-op - the node only trims, it never extends unless the source is genuinely short. Check the actual frame counts on both sides if you expected a change and didn't get one.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| feature | FEATURE | Input feature to truncate or extend | |
| target_feature_pipe | FEATURE_PIPE | Feature pipe to match length with | |
| fill_method | COMBO | Method to fill extended frames ('zeros', 'ones', 'average', 'random', 'repeat') | |
| invert_output | BOOLEAN | false | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FEATURE | FEATURE | β |