Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > kandinsky-s2v > Kandinsky S2V Trim To Audio

ComfyUI Node: Kandinsky S2V Trim To Audio

Class Name

KandinskyS2VTrimToAudio

Category
Kandinsky S2V
Author
kandinskylab (Account age: 362days)
Extension
kandinsky-s2v
Latest Updated
2026-11-05
Github Stars
0.04K

How to Install kandinsky-s2v

Install this extension via the ComfyUI Manager by searching for kandinsky-s2v
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter kandinsky-s2v in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Kandinsky S2V Trim To Audio Description

Trims excess Kandinsky S2V video frames to match the original audio duration at 25 fps.

Kandinsky S2V Trim To Audio:

KandinskyS2VTrimToAudio removes the extra video frames generated beyond the original audio track’s duration in a Kandinsky S2V workflow. Because speech-driven video is generated in chunks, the final chunk can include frames corresponding to silence added to complete that chunk. This node trims that padded tail by calculating how many frames fit within the original track’s duration at the model’s fixed rate of 25 frames per second, rounding down to a whole frame. It preserves the beginning of the sequence and the original frame order without changing the retained pictures. This helps you prepare a clip whose length follows the audio rather than the padded generation length. It does not detect silence within a recording, remove pauses, generate missing frames, or stretch a shorter video to match a longer track.

Kandinsky S2V Trim To Audio Input Parameters:

images

Required input of type IMAGE. This is the decoded sequence of video frames you want to trim, normally supplied by VAE Decode after Kandinsky S2V Sampler. The node treats the first dimension of this image batch as the frame count and keeps only the initial frames needed for the original audio duration. Any excess frames are removed from the end; the retained frames keep their original appearance, dimensions, and order. If the sequence already contains fewer frames than the duration requires, all available frames are returned without adding new ones. No default value, numerical minimum, numerical maximum, or selectable options are defined in the node interface; you must connect an image sequence.

conditioning

Required input of type KANDINSKY_S2V_CONDITIONING. Connect the conditioning produced by Kandinsky S2V Encode (speech + prompt), ideally the same conditioning used to generate the video. The node reads its track_seconds value, which represents the original audio track’s duration in seconds, and multiplies that duration by 25 to determine the target frame count. The result is rounded down to a whole number and limited to the number of frames available. Although the conditioning also supports other parts of the Kandinsky S2V workflow, this node uses only the track duration; it does not inspect the speech content or prompt. No default value, numerical minimum, numerical maximum, or selectable options are defined for this connection.

Kandinsky S2V Trim To Audio Output Parameters:

images

Output of type IMAGE containing the retained video frames in their original order. The frame count is the smaller of the available frame count and the original audio duration multiplied by 25, rounded down to a whole number. For example, a 10.5-second track allows 262 frames, so a longer sequence is reduced to its first 262 frames. At 25 frames per second, this corresponds to 10.48 seconds: rounding can make the video slightly shorter than the audio by less than one frame interval when sufficient frames are available. This output contains images only, not an encoded video or an audio track, and can be connected to a video-creation node.

fps

Output of type FLOAT with the fixed value 25.0. This is the playback frame rate used to calculate the trim length and is the rate you should use when assembling the returned images into a video. Connecting it to the frame-rate input of your video-creation node keeps playback timing consistent with the duration calculation. It is not measured from the image sequence, does not vary with audio length, and does not perform frame-rate conversion or interpolation.

Kandinsky S2V Trim To Audio Usage Tips:

  • Place this node after VAE Decode: connect Kandinsky S2V Sampler to VAE Decode, then connect the decoded images to images. The trim node expects image frames, not the sampler’s latent output.
  • Connect the same conditioning used by Kandinsky S2V Sampler. This ensures that trimming uses the duration of the audio associated with your generated clip rather than a different recording.
  • Connect both returned images and fps to the corresponding inputs of CreateVideo or a compatible video-assembly node, and supply the original audio separately. The trim node does not attach audio itself.
  • Keep the video-assembly frame rate at 25.0. Changing playback speed downstream changes the clip’s duration and can cause the video and audio to drift apart.
  • Generate enough chunks upstream to cover your recording. This node can remove extra frames but cannot repair a video that ends before the audio; if necessary, use the encoder’s automatic chunk selection by setting its chunks parameter to 0.
  • Do not expect pauses or silence already present in your original recording to be removed. Trimming is based on the full recorded duration, not on detecting when someone is speaking.
  • There are no adjustable trim or frame-rate controls on this node. For a custom endpoint or a different playback rate, use separate editing tools and account for their effect on audio synchronization.

Kandinsky S2V Trim To Audio Common Errors and Solutions:

'track_seconds'

  • Explanation: A Python KeyError with this text means the conditioning data does not contain the audio-duration entry required for trimming. The node accesses this entry directly and does not provide a fallback.
  • Solution: Connect conditioning directly from Kandinsky S2V Encode (speech + prompt), preferably the same output connected to your sampler. Avoid substituting ordinary text conditioning or manually constructed data that lacks the track duration.

Input type mismatch for images or conditioning

  • Explanation: ComfyUI may report a connection or validation error if images receives latent data rather than IMAGE data, or if conditioning receives a different conditioning type. The exact message depends on your ComfyUI version.
  • Solution: Decode the sampler’s output with VAE Decode before connecting it to images, and use KANDINSKY_S2V_CONDITIONING from Kandinsky S2V Encode for conditioning.

Required input is missing

  • Explanation: Both images and conditioning are required connections. ComfyUI cannot execute this node when either is missing; the exact validation message may vary.
  • Solution: Check that VAE Decode is connected to images and Kandinsky S2V Encode is connected to conditioning. Make sure the upstream nodes also have all their required connections.

Invalid track duration: TypeError or ValueError

  • Explanation: The node multiplies track_seconds by the frame rate and converts the result to an integer. Malformed custom conditioning can cause a TypeError or a conversion error such as cannot convert float NaN to integer; an infinite duration can produce cannot convert float infinity to integer.
  • Solution: Regenerate conditioning through Kandinsky S2V Encode using a valid, nonempty audio track. If you modify conditioning through custom code, make sure track_seconds is a finite, positive duration in seconds.

The returned clip is shorter than the audio

  • Explanation: This can happen without an error message. Rounding down to whole frames normally leaves a difference of less than 0.04 seconds when enough frames are available. A larger difference can mean that too few frames were generated or that the wrong conditioning was connected.
  • Solution: For a very small difference, no correction is usually necessary. For a substantial shortfall, verify the conditioning connection and generate enough chunks upstream; this node cannot extend the sequence.

The returned sequence is empty

  • Explanation: This can happen without an error message if the incoming sequence has no frames or if the recorded duration rounds down to zero frames at 25 fps, as a positive duration shorter than 0.04 seconds would. The normal encoder rejects empty speech tracks, but custom conditioning can bypass that protection.
  • Solution: Confirm that VAE Decode produced frames and that the audio is long enough to contain at least one frame interval. Recreate conditioning from the intended recording instead of using a zero or manually altered duration.

The video plays too fast, too slowly, or out of sync

  • Explanation: This is usually a downstream playback-setting issue rather than a trim-node exception. The trim calculation assumes 25 fps, so assembling the same frames at another rate changes the playback duration.
  • Solution: Connect the node’s fps output to your video-creation node, verify that the effective rate is 25.0, and use the same original audio track that produced the conditioning.

Kandinsky S2V Trim To Audio Related Nodes

Go back to the extension to check out more related nodes.
kandinsky-s2v
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Kandinsky S2V Trim To Audio