ComfyUI-FolderBatch
Nodes to batch process with ComfyUI
Nodes (9)
ComfyUI-FolderBatch
Inspired by https://github.com/da2el-ai/D2-nodes-ComfyUI/tree/main and its design ideas.
Folder-based batch queue helpers for ComfyUI. These nodes let you queue items from a folder one-by-one and feed them into your workflow.
Japanese translation below (日本語は後半に記載).
Nodes
FolderBatch Video Queue
Queue video files from a folder, one per execution.
Inputs (required)
- folder (STRING): Folder path to scan.
- extension (STRING): Glob pattern, default
*.mp4. - start_at (INT): Start index (0-based).
- auto_queue (BOOLEAN): If enabled, triggers next queue automatically.
- sort_by (Name|Date|Random): Sorting method.
- order_by (A-Z|Z-A): Sort order.
Inputs (optional)
- video_count (INT): UI display only.
- progress (FLOAT): UI display only (0.0 - 1.0).
Outputs
- video_path (STRING): Full path of the selected video.
- file_name (STRING): Selected video base name without extension.
- video_count (INT): Total count of matching files.
FolderBatch Load Video Frames
Load a video and output frames as IMAGE batch, and also output the original video object.
Inputs (required)
- video_path (STRING): Full path to the video file.
Outputs
- images (IMAGE): Video frames as a batch.
- video (VIDEO): Original video input as ComfyUI VIDEO.
FolderBatch Text Queue
Queue text from either a folder or a single file, by file or by line.
Inputs (required)
- source_mode (folder|file): Use a folder scan or a single text file.
- unit_mode (file|line): Queue per file or per line.
- folder (STRING): Folder path to scan.
- text_path (STRING): Single text file path used when
source_mode=file. - extension (STRING): Glob pattern, default
*.txt. - start_at (INT): Start index (0-based).
- auto_queue (BOOLEAN): If enabled, triggers next queue automatically.
- sort_by (Name|Date|Random): Sorting method.
- order_by (A-Z|Z-A): Sort order.
- skip_empty_lines (BOOLEAN): Skip blank lines in line mode.
Inputs (optional)
- text_count (INT): UI display only.
- progress (FLOAT): UI display only (0.0 - 1.0).
- repeat_count (INT): Number of executions per text item before advancing.
- repeat_index (INT): Current 0-based repetition index for queue state.
Outputs
- text_path (STRING): Full path of the selected text file.
- file_name (STRING): Selected text base name without extension.
- text_count (INT): Total count of queued items.
- line_index (INT): Original 0-based line index, or
-1in file mode.
FolderBatch Load Text
Load a text file and output its content.
Inputs (required)
- text_path (STRING): Full path to the text file.
- skip_empty_lines (BOOLEAN): Match line-mode queue behavior when reading by line.
Inputs (optional)
- line_index (INT):
-1or unconnected for full file, otherwise the 0-based line index to load.
Outputs
- text (STRING): File content.
FolderBatch Audio Queue
Queue audio files from a folder, one per execution.
Inputs (required)
- folder (STRING): Folder path to scan.
- extension (STRING): Glob pattern(s), default
*.mp3;*.wav;*.flac;*.m4a;*.ogg;*.aac. - start_at (INT): Start index (0-based).
- auto_queue (BOOLEAN): If enabled, triggers next queue automatically.
- sort_by (Name|Date|Random): Sorting method.
- order_by (A-Z|Z-A): Sort order.
Inputs (optional)
- audio_count (INT): UI display only.
- progress (FLOAT): UI display only (0.0 - 1.0).
Outputs
- audio_path (STRING): Full path of the selected audio file.
- file_name (STRING): Selected audio base name without extension.
- audio_count (INT): Total count of matching files.
FolderBatch Load Audio
Load an audio file and output it as AUDIO plus durations.
Inputs (required)
- audio_path (STRING): Full path to the audio file.
Outputs
- audio (AUDIO): Loaded audio waveform and sample rate.
- duration_float (FLOAT): Audio duration in seconds.
- duration_int (INT): Rounded audio duration in seconds.
FolderBatch Image Queue
Queue image files from a folder, one per execution.
Inputs (required)
- folder (STRING): Folder path to scan.
- extension (STRING): Glob pattern(s), default
*.png;*.jpg;*.jpeg;*.webp;*.bmp. - start_at (INT): Start index (0-based).
- auto_queue (BOOLEAN): If enabled, triggers next queue automatically.
- sort_by (Name|Date|Random): Sorting method.
- order_by (A-Z|Z-A): Sort order.
Inputs (optional)
- image_count (INT): UI display only.
- progress (FLOAT): UI display only (0.0 - 1.0).
Outputs
- image_path (STRING): Full path of the selected image file.
- file_name (STRING): Selected image base name without extension.
- image_count (INT): Total count of matching files.
FolderBatch Load Image
Load an image file and output it as IMAGE and MASK.
Inputs (required)
- image_path (STRING): Full path to the image file.
Outputs
- image (IMAGE): Loaded image.
- mask (MASK): Alpha-derived mask if present, otherwise empty mask.
FolderBatch Sync Queue
Queue synchronized items across image, video, text, and audio sources.
Inputs (required)
- common_folder (STRING): Shared folder used when a per-media folder is blank.
- sync_mode (By Name|By Order): Match by basename or by sorted index.
- missing_policy (Skip|Error|Empty): Skip incomplete sets, stop on mismatch, or output empty paths.
- start_at (INT): Start index (0-based).
- auto_queue (BOOLEAN): If enabled, triggers next queue automatically.
- sort_by (Name|Date|Random): Sorting method.
- order_by (A-Z|Z-A): Sort order.
- use_image / use_video / use_text / use_audio (BOOLEAN): Enable each media type.
- image_folder / video_folder / text_folder / audio_folder (STRING): Optional per-media folders.
- image_extension / video_extension / text_extension / audio_extension (STRING): Glob pattern(s) per media.
- text_unit_mode (file|line): Use one text file per item, or one text line per item.
- skip_empty_lines (BOOLEAN): Skip blank lines when
text_unit_modeisline.
Inputs (optional)
- item_count (INT): UI display only.
- progress (FLOAT): UI display only (0.0 - 1.0).
Outputs
- base_name (STRING): Matched basename or first available basename in order mode.
- image_path (STRING): Selected image path or empty string.
- video_path (STRING): Selected video path or empty string.
- text_path (STRING): Selected text path or empty string.
- line_index (INT):
-1in file mode, otherwise the 0-based text line index. - audio_path (STRING): Selected audio path or empty string.
- item_count (INT): Total synchronized item count.
Typical Usage
Video batch:
- FolderBatch Video Queue -> video_path
- FolderBatch Load Video Frames -> images
- Connect images to your processing nodes
Text batch:
- FolderBatch Text Queue -> text_path, line_index
- FolderBatch Load Text <- text_path, line_index
- Set
skip_empty_lineson Load Text to match the queue when using line mode - Connect text to prompt/conditioning nodes
Audio batch:
- FolderBatch Audio Queue -> audio_path
- FolderBatch Load Audio -> audio
- Connect audio to your processing nodes
Image batch:
- FolderBatch Image Queue -> image_path
- FolderBatch Load Image -> image, mask
- Connect image to your processing nodes
Sync batch:
- FolderBatch Sync Queue -> base_name, image_path, video_path, text_path, line_index, audio_path
- Connect the paths you need into FolderBatch Load Image / Load Video Frames / Load Text / Load Audio
- Process each synchronized item set
ComfyUI-FolderBatch (日本語)
https://github.com/da2el-ai/D2-nodes-ComfyUI/tree/main の構想と設計を参考にしています。
ComfyUIでフォルダ内のファイルを1つずつキューに流し込むためのノード集です。
ノード
FolderBatch Video Queue
フォルダ内の動画を1本ずつキューに流します。
入力(必須)
- folder (STRING): 対象フォルダのパス
- extension (STRING): 拡張子のグロブ(例:
*.mp4) - start_at (INT): 開始インデックス(0始まり)
- auto_queue (BOOLEAN): 有効なら自動で次をキュー
- sort_by (Name|Date|Random): 並び順の基準
- order_by (A-Z|Z-A): 並び順の向き
入力(任意)
- video_count (INT): UI表示用
- progress (FLOAT): UI表示用(0.0 - 1.0)
出力
- video_path (STRING): 選択された動画のフルパス
- file_name (STRING): 選択された動画の拡張子なしファイル名
- video_count (INT): 対象ファイルの総数
FolderBatch Load Video Frames
動画を読み込み、フレームをIMAGEバッチで出力し、元動画もVIDEOとして出力します。
入力(必須)
- video_path (STRING): 動画ファイルのフルパス
出力
- images (IMAGE): フレームのバッチ
- video (VIDEO): 元動画の ComfyUI VIDEO
FolderBatch Text Queue
フォルダまたは単一txtを、ファイル単位または行単位でキューに流します。
入力(必須)
- source_mode (folder|file): フォルダ指定か単一ファイル指定か
- unit_mode (file|line): ファイル単位か行単位か
- folder (STRING): 対象フォルダのパス
- text_path (STRING):
source_mode=fileのときに使うtxtパス - extension (STRING): 拡張子のグロブ(例:
*.txt) - start_at (INT): 開始インデックス(0始まり)
- auto_queue (BOOLEAN): 有効なら自動で次をキュー
- sort_by (Name|Date|Random): 並び順の基準
- order_by (A-Z|Z-A): 並び順の向き
- skip_empty_lines (BOOLEAN): 行単位時に空行を飛ばすか
入力(任意)
- text_count (INT): UI表示用
- progress (FLOAT): UI表示用(0.0 - 1.0)
- repeat_count (INT): 次のテキストへ進むまでの実行回数
- repeat_index (INT): キュー状態として保持する現在の繰り返し位置(0始まり)
出力
- text_path (STRING): 選択されたテキストのフルパス
- file_name (STRING): 選択されたテキストの拡張子なしファイル名
- text_count (INT): 対象項目の総数
- line_index (INT): 元の0始まり行番号。fileモードでは
-1
FolderBatch Load Text
テキストファイルを読み込み、内容をSTRINGで出力します。
入力(必須)
- text_path (STRING): テキストファイルのフルパス
- skip_empty_lines (BOOLEAN): 行単位時の空行スキップ設定に合わせるか
入力(任意)
- line_index (INT): 未接続または
-1なら全文、それ以外は対象の0始まり行番号
出力
- text (STRING): ファイル内容
FolderBatch Audio Queue
フォルダ内の音声を1つずつキューに流します。
入力(必須)
- folder (STRING): 対象フォルダのパス
- extension (STRING): 拡張子グロブ。複数指定可。既定値
*.mp3;*.wav;*.flac;*.m4a;*.ogg;*.aac - start_at (INT): 開始インデックス(0始まり)
- auto_queue (BOOLEAN): 有効なら自動で次をキュー
- sort_by (Name|Date|Random): 並び順の基準
- order_by (A-Z|Z-A): 並び順の向き
入力(任意)
- audio_count (INT): UI表示用
- progress (FLOAT): UI表示用(0.0 - 1.0)
出力
- audio_path (STRING): 選択された音声のフルパス
- file_name (STRING): 選択された音声の拡張子なしファイル名
- audio_count (INT): 対象ファイルの総数
FolderBatch Load Audio
音声ファイルを読み込み、AUDIOと長さを出力します。
入力(必須)
- audio_path (STRING): 音声ファイルのフルパス
出力
- audio (AUDIO): 読み込んだ音声データ
- duration_float (FLOAT): 音声の長さ(秒)
- duration_int (INT): 四捨五入した音声の長さ(秒)
FolderBatch Image Queue
フォルダ内の画像を1つずつキューに流します。
入力(必須)
- folder (STRING): 対象フォルダのパス
- extension (STRING): 拡張子グロブ。複数指定可。既定値
*.png;*.jpg;*.jpeg;*.webp;*.bmp - start_at (INT): 開始インデックス(0始まり)
- auto_queue (BOOLEAN): 有効なら自動で次をキュー
- sort_by (Name|Date|Random): 並び順の基準
- order_by (A-Z|Z-A): 並び順の向き
入力(任意)
- image_count (INT): UI表示用
- progress (FLOAT): UI表示用(0.0 - 1.0)
出力
- image_path (STRING): 選択された画像のフルパス
- file_name (STRING): 選択された画像の拡張子なしファイル名
- image_count (INT): 対象ファイルの総数
FolderBatch Load Image
画像ファイルを読み込み、IMAGEとMASKで出力します。
入力(必須)
- image_path (STRING): 画像ファイルのフルパス
出力
- image (IMAGE): 読み込んだ画像
- mask (MASK): アルファ由来のマスク。なければ空マスク
FolderBatch Sync Queue
画像・動画・テキスト・音声を同期してキューに流します。
入力(必須)
- common_folder (STRING): 個別フォルダが空のときに使う共通フォルダ
- sync_mode (By Name|By Order): ベース名一致か、ソート順一致か
- missing_policy (Skip|Error|Empty): 欠損セットをスキップ、エラー停止、空パス出力
- start_at (INT): 開始インデックス(0始まり)
- auto_queue (BOOLEAN): 有効なら自動で次をキュー
- sort_by (Name|Date|Random): 並び順の基準
- order_by (A-Z|Z-A): 並び順の向き
- use_image / use_video / use_text / use_audio (BOOLEAN): 媒体ごとの使用有無
- image_folder / video_folder / text_folder / audio_folder (STRING): 媒体ごとの個別フォルダ
- image_extension / video_extension / text_extension / audio_extension (STRING): 媒体ごとの拡張子グロブ
- text_unit_mode (file|line): テキストをファイル単位で使うか、行単位で使うか
- skip_empty_lines (BOOLEAN):
text_unit_modeがlineのとき空行をスキップ
入力(任意)
- item_count (INT): UI表示用
- progress (FLOAT): UI表示用(0.0 - 1.0)
出力
- base_name (STRING): 一致したベース名。順番同期では最初に見つかった名前
- image_path (STRING): 対応画像のパス。なければ空文字
- video_path (STRING): 対応動画のパス。なければ空文字
- text_path (STRING): 対応テキストのパス。なければ空文字
- line_index (INT): fileモードでは
-1、lineモードでは0始まりの行番号 - audio_path (STRING): 対応音声のパス。なければ空文字
- item_count (INT): 同期対象の総数
典型的な使い方
動画バッチ:
- FolderBatch Video Queue -> video_path
- FolderBatch Load Video Frames -> images
- 画像処理ノードに接続
テキストバッチ:
- FolderBatch Text Queue -> text_path, line_index
- FolderBatch Load Text に text_path, line_index を接続
- lineモード時は Load Text の
skip_empty_linesを Queue 側と合わせる - プロンプト/条件ノードに接続
音声バッチ:
- FolderBatch Audio Queue -> audio_path
- FolderBatch Load Audio -> audio
- 音声処理ノードに接続
画像バッチ:
- FolderBatch Image Queue -> image_path
- FolderBatch Load Image -> image, mask
- 画像処理ノードに接続
同期バッチ:
- FolderBatch Sync Queue -> base_name, image_path, video_path, text_path, line_index, audio_path
- 必要な path だけ FolderBatch Load Image / Load Video Frames / Load Text / Load Audio に接続
- 同期された1件ずつを処理