Nodes/comfyui-AGSoft/🎬🔊AGSoft Latent Stitch Video & Audio
ComfyUI Node

🎬🔊AGSoft Latent Stitch Video & Audio

Join your segments before spending the VRAM to decode them

By Art-xmaster·Created about a year ago·Updated about 15 hours ago· 27
🎬🔊AGSoft Latent Stitch Video & Audio
  • video_vae
  • audio_vae
  • stitched_images
  • stitched_audio
inputs_count2
trim_first_frames1
fps_float24.000
trim_audiotrue

🎬🔊AGSoft Latent Stitch Video & Audio is the same idea as its decoded sibling - join the segments, trim the duplicate anchor frame, keep the order - but it takes the segments as latents and does the decode once, at the end, inside itself.

That matters more than it sounds. H3 and LTX segments are generated one at a time, and the natural habit is to decode each segment the moment it finishes. Every decode is a full VAE pass at 2K-ish resolution, and each one costs you peak VRAM and time. If you're going to hand the segments to one node anyway, you can skip all of it: slice the latents (the pack's MiniMax H3 slice nodes do exactly this), stitch them, and pay for one decode of the joined clip instead of five.

How it works

Two dynamic socket families, both index-paired: video_latent_N and audio_latent_N. inputs_count (2–50) only decides how many sockets are visible; unconnected or bypassed ones are ignored rather than counted.

For each segment index, in ascending order:

  1. Video decode. video_latent_N goes through the VAE you connect to video_vae, producing IMAGE frames. If you leave video_vae unconnected, there are no images for that segment - which then triggers the black-frame fallback if audio exists for it.
  2. Audio, with a fallback chain. The preferred source is audio_latent_N, decoded through audio_vae. If that socket is empty but video_latent_N carries an internal audio part, that internal part is used instead. This is H3-specific and not an accident: H3's audio-visual latent is a nested structure holding video and audio together, so a segment latent can contain both. Great news for the common case where you never split them.
  3. Trim. trim_first_frames (default 1) drops the leading decoded frames from segments 2+, killing the anchor-frame duplicate at each join - and here audio is trimmed proportionally, which is what keeps A/V sync through the stitch.
  4. Fill and join. Missing audio gets silence for the segment's duration; missing video with audio present gets black frames. Image chunks are conformed to the first chunk's shape and audio chunks resampled to the first chunk's rate, then everything is concatenated in CPU memory.

Outputs are stitched_images and stitched_audio. Timing runs on fps_float, default 24, used for the silence lengths and for the proportional audio trim.

If you have no audio VAE

Leave audio_vae unconnected and stitched_audio comes back as a silent placeholder rather than failing - you get the video, correctly joined, with a flat waveform. That's deliberate: this is a video model that generated audio whether or not you asked for it, and the node would rather hand you a usable clip than a stack trace. If your output sounds like nothing, that's the first thing to check, and the fix is to wire the audio VAE you already used for the sampling side.

trim_audio defaults to true here - the opposite of the decoded-input node - because the latents never went through anything that trimmed them. Turning it off means your joins carry the duplicated audio frame.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft
# restart ComfyUI

Manager → search comfyui-AGSoft. Nothing to download; the VAE sockets reuse whatever VAEs your H3 or LTX workflow is already loading.

Where people get burned

Empty stitched_images. Usually a missing video_vae - the node decodes only what it's given a decoder for, and there's no error, just no frames.

Silent-but-connected audio. Check the fallback order before assuming the audio VAE is at fault: if audio_latent_N isn't wired but the video latent has no internal audio part, that segment gets generated silence, which then hides as "the model produced no sound".

Odd audio at the joins. Same two suspects as always - a wrong fps_float (the silence fills are sized from it) or trim_audio on when the incoming audio was already trimmed somewhere upstream. If a segment arrived pre-trimmed, copy that workflow's habit and switch this off.

Sockets not showing up. These dynamic inputs are drawn by the pack's frontend JS. If you only see two of them, reload the page. The Nodes 2.0 renderer broke a lot of custom-node frontends - if you've enabled it, drop back to the legacy canvas before digging further.

CategoryAGSoft/MiniMaxH3

Inputs (6)

NameTypeDefaultDescription
inputs_countCOMBO2Number of visible segment sockets. Unconnected sockets are ignored. --- Количество видимых сокетов. Неподключённые сокеты игнорируются.
trim_first_framesINT10–8Trim first decoded frames from segments 2+. Audio is trimmed proportionally. --- Подрезать первые декодированные кадры у сегментов 2+. Аудио режется пропорционально.
video_vaeoptVAEVideo VAE used to decode video_latent_N into IMAGE. --- Video VAE для декодирования video_latent_N в IMAGE.
audio_vaeoptVAEAudio VAE used to decode audio_latent_N into AUDIO. --- Audio VAE для декодирования audio_latent_N в AUDIO.
fps_floatoptFLOAT24.0001–120FPS for timing, silence generation and fallback audio trim. --- FPS для тайминга, генерации тишины и резервной подрезки аудио.
trim_audiooptBOOLEANtrueTrim decoded audio from segments 2+ proportionally to trimmed frames. --- Подрезать декодированное аудио у сегментов 2+ пропорционально подрезанным кадрам.

Outputs (2)

NameTypeDescription
stitched_imagesIMAGE
stitched_audioAUDIO