A custom ComfyUI node that saves video outputs as H.264 .mp4 files with unique naming and returns the file path as a string.
- 🎥 Saves video tensors as H.264 encoded .mp4 files
- 🔢 Generates unique filenames with timestamp and UUID
- 📁 Configurable output directory
- ⚙️ Adjustable quality settings (CRF 0-51)
- 🎬 Configurable frame rate
- 📝 Returns full file path as string output
- 🔄 Automatic tensor format detection and conversion
- ⚡ Optional FFmpeg re-encoding for better compression
-
Copy the
comfyui_video_save_nodefolder to your ComfyUIcustom_nodesdirectory:cp -r comfyui_video_save_node /path/to/ComfyUI/custom_nodes/
-
Install the required Python dependencies:
cd /path/to/ComfyUI/custom_nodes/comfyui_video_save_node pip install -r requirements.txt -
(Optional but recommended) Install FFmpeg for better H.264 encoding:
- macOS:
brew install ffmpeg - Ubuntu:
sudo apt install ffmpeg - Windows: Download from FFmpeg website
- macOS:
-
Restart ComfyUI
- Add the "Save Video (H.264)" node to your workflow
- Connect a video output from another node (e.g., VEO3 API node) to the
videoinput - Configure the parameters:
- filename_prefix: Prefix for the output filename (default: "video_output")
- fps: Frame rate for the output video (default: 30)
- quality: H.264 CRF quality, lower = better quality (default: 23)
- output_dir: Optional custom output directory (uses ComfyUI output folder by default)
- The node will output the full file path as a string
The node generates filenames in the format:
{filename_prefix}_{timestamp}_{unique_id}.mp4
Example: video_output_20241213_143022_a1b2c3d4.mp4
| Parameter | Type | Default | Description |
|---|---|---|---|
| video | VIDEO | - | Input video tensor from previous nodes |
| filename_prefix | STRING | "video_output" | Prefix for the output filename |
| fps | INT | 30 | Frame rate (1-120) |
| quality | INT | 23 | H.264 CRF quality (0-51, lower = better) |
| output_dir | STRING | "" | Optional custom output directory |
| Output | Type | Description |
|---|---|---|
| file_path | STRING | Full path to the saved video file |
- The node automatically detects and converts various video tensor formats
- Supports both batch and single video tensors
- Normalizes pixel values to 0-255 range
- Handles RGB/BGR conversion for OpenCV compatibility
- Uses OpenCV for initial encoding, with optional FFmpeg re-encoding
- Generates unique filenames to prevent overwrites
- "Invalid or empty video tensor": Ensure the input video tensor is valid and not empty
- FFmpeg errors: FFmpeg is optional; the node will fall back to OpenCV encoding
- File permission errors: Ensure ComfyUI has write permissions to the output directory
This project is open source. Feel free to modify and distribute.