Kling Video to File (MP4)
Turn an IMAGE batch into a real .mp4, without VideoHelperSuite
- video
- file_path
Every Kling video node hands you its result as an IMAGE batch - a stack of frames, great for previewing and post-processing, useless as something you can actually play or send someone. KlingDirect_VideoToFile is the pack's built-in encoder: it takes an IMAGE batch and writes a real .mp4 to your output folder using OpenCV. Pure local code, no API call, no credits - and a genuinely useful default export path that keeps you from installing VideoHelperSuite just to get a playable file.
The author's intent is right there in the source docstring: "without depending on VideoHelperSuite." If you've got VideoHelperSuite installed and love it, keep using it - its VHS_VideoCombine is more flexible. But if you're on the Kling pack and just want frames → MP4, this is one node with no extra dependency.
What you set
- video (
IMAGE) - the frame batch. Any of the pack's video outputs (Text to Video,Lip Sync,Motion Control, …) feed straight in. Expects[N, H, W, C]with N ≥ 1; it validates the shape and errors clearly if you feed it a single image. - fps - frames per second, default 24. Set it to match the source (Kling renders are commonly 24/25/30).
- filename_prefix - the name prefix; the node appends a random suffix, so you won't clobber previous exports.
- codec -
mp4v(default, most compatible),avc1(H.264 - better compression/quality but may need extra codecs on your system), orMJPG. The tooltip's warning is real: if the writer fails to open, drop back tomp4v.
Output
A single file_path (STRING) pointing at the written .mp4 in ComfyUI's output folder. It's an output node, so it marks the end of the branch in the graph.
Install and what it needs
Part of ComfyUI-Kling-Direct: ComfyUI Manager → search "Kling Direct" → install, or git clone https://github.com/IxMxAMAR/ComfyUI-Kling-Direct into ComfyUI/custom_nodes, then restart. No API key, no model downloads, no credits - it's cv2.VideoWriter under the hood, and opencv-python ships with the pack's (already satisfied) dependency list.
Where people get burned
- Wrong fps. If the exported clip plays too fast or too slow, your
fpsdoesn't match the source. Match it to the generation node's duration × frame count. - Codec that won't open.
avc1needs an H.264 encoder available to OpenCV on your OS. If the node errors with "cv2.VideoWriter failed to open," switch tomp4v- it's the safe default for a reason. - Feeding a single image. It validates the batch, so a lone frame raises a clear error rather than silently writing a 1-frame file. Batch your frames first (a generation node's
videooutput is already a batch).
The chain that makes it click: Text to Video → Video Extend → Video to File → a single playable MP4 of your whole extended story, no extra installs.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| video | IMAGE | Image batch where each frame is a video frame. | |
| fps | INT | 241–120 | — |
| filename_prefix | STRING | kling_export | — |
| codec | COMBO | mp4v | FourCC codec. mp4v is most compatible; avc1 is H.264 (better, may need extra codecs). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | — |