Commit Graph
244 Commits
Author SHA1 Message Date
Meisoftcoltd 3afcee2bef test: add safety guards and unit tests for video loop calculators
Added input validations (`source_frame_count <= 0` or `target_frames_per_loop <= 0`) to `AutoLoopCalculatorLTX` (in `loop.py`), and `AutoLoopCalculator`, `AutoLoopCalculatorWan` (in `video.py`). When conditions are met, a safe default is returned to prevent math domain errors. Also included a new comprehensive unit test suite in `tests/test_loop_calculator.py`.
2026-05-14 20:24:55 +00:00
Meisoft 9df7a16940 Merge pull request #112 from Meisoftcoltd/feat/audio-duration-calculator-1774713163093024603
feat(tools): add AudioDurationCalculator node
2026-05-14 11:49:21 +02:00
Meisoftcoltd 0c280ec6f2 feat(tools): add AudioDurationCalculator node
Adds a new ComfyUI utility node `AudioDurationCalculator` to `tools.py` for
calculating the exact duration of an audio file in seconds. Includes robust
error handling to ensure the input is a valid dictionary and returns a
logging string output to maintain consistency with other tools.
2026-05-14 08:42:29 +00:00
Meisoft c44796d59b Merge pull request #111 from Meisoftcoltd/fix/unit-clash-tts-timeline-2852292516543970131
Fix: Resolve TTS timeline unit clash in SessionImageSender
2026-05-14 00:36:59 +02:00
Meisoftcoltd 6cd32fcfe9 Fix: Resolve Unit Clash between TTS chunks and video frames in Sequential Batcher
- Introduce `global_step_by_chunk` ghost variable initialized to `False` in `loop.py`
- Set `loop.global_step_by_chunk = True` in `AutoLoopCalculatorTTS` to indicate chunk mode
- Reset `loop.global_step_by_chunk = False` in video calculators (`AutoLoopCalculator`, `AutoLoopCalculatorWan`, `AutoLoopCalculatorLTX`) to ensure state resets
- Update `SessionImageSender.send_image` timeline management to branch logic, using `is_chunk_mode` to calculate progress differently for text chunks versus video frames
2026-05-13 22:34:58 +00:00
Meisoft db22f2ea3f Merge pull request #110 from Meisoftcoltd/improve-tts-auto-loop-calculator-2913379197447008085
feat(tts): add intelligent buffer to TTS sequence chunking
2026-05-11 23:57:48 +02:00
Meisoftcoltd 7b900c10cd feat(tts): implement intelligent text buffering for AutoLoopCalculatorTTS
This commit replaces the raw regex text-splitting logic in `AutoLoopCalculatorTTS` with an "intelligent buffer" approach. It first splits the text by sentence terminators as before, but now aggregates these smaller segments until they contain a minimum of 5 words.

This prevents TTS models from generating robotic, out-of-context micro-audios when encountering trailing ellipses (`...`) or extremely short phrases, leading to more natural intonation and pacing.

All existing loop and timeline injections are preserved.
2026-05-11 21:48:30 +00:00
Meisoft 48ce1b3826 Merge pull request #109 from Meisoftcoltd/feat/tts-regex-chunking-8529750223989142037
feat(tts): improve AutoLoopCalculatorTTS regex chunking
2026-05-09 19:54:48 +02:00
Meisoftcoltd d1d5f47562 feat(tts): implement regex-based robust chunking for AutoLoopCalculatorTTS
Replaced simple paragraph/sentence splitting with advanced regex
to gracefully handle split scenarios involving `.`, `?`, `!`,
quotes, ellipses, and `\n`. Punctuation is correctly retained on
the chunks to assure proper TTS intonation.

Moved `import re` to module level imports.
2026-05-09 17:46:49 +00:00
Meisoft 960acd7371 Merge pull request #108 from Meisoftcoltd/fix-graph-surgery-node-input-error-6346624600916527026
fix: remove destructive graph surgery causing NodeInputError
2026-05-09 13:37:07 +02:00
Meisoftcoltd 7f025b9a18 fix: remove destructive graph surgery in SequentialLoopTrigger
Replaced destructive `del inputs["on_true"]` and `del inputs["on_false"]` with simple state update `inputs["is_final_cycle"] = is_next_final` to rely on MasterSwitch's native lazy evaluation (`check_lazy_status`), fixing a `NodeInputError` bug during looping.
2026-05-09 11:27:29 +00:00
Meisoft eac81a4b14 Merge pull request #107 from Meisoftcoltd/fix-tts-chunk-calculation-6615407643540930151
Fix estimated chunk size for AutoLoopCalculatorTTS
2026-05-03 12:44:59 +02:00
Meisoftcoltd 1f64452691 Fix estimated chunk size calculation for AutoLoopCalculatorTTS
Update `SequentialLoopTrigger` in `loop.py` to correctly identify
`AutoLoopCalculatorTTS` and set `estimated_chunk` to 1 instead of falling
back to a default of 50. This prevents the trigger from incorrectly guessing
when the final loop occurs and mutating the graph prematurely, which caused
errors during sequential TTS tasks.
2026-05-03 10:41:15 +00:00
Meisoft 7375f9d478 Merge pull request #106 from Meisoftcoltd/fix/incremental-video-stitcher-inplace-error-9647683454534116380
Fix RuntimeError: Inplace update to inference tensor outside InferenceMode
2026-05-02 23:55:48 +02:00
Meisoftcoltd d6c2a4b012 Fix RuntimeError due to in-place tensor updates in InferenceMode
Refactors `IncrementalVideoStitcher.stitch` to eliminate in-place assignments
into a pre-allocated empty tensor when loading image frames in parallel, which
caused `RuntimeError: Inplace update to inference tensor outside InferenceMode
is not allowed.` in newer PyTorch versions.

The refactored implementation uses a pure map function to return individual
tensors and concatenates them sequentially using `torch.cat`, remaining thread-safe
and compatible with PyTorch's `InferenceMode`. Security against deserialization
vulnerabilities is preserved by ensuring `weights_only=True` remains when loading
audio caches.
2026-05-02 21:55:05 +00:00
Meisoft b7e1fb6f89 Merge pull request #105 from Meisoftcoltd/test-video-audio-error-handling-369389381641730631
🧪 Add error handling and coverage tests for audio extraction
2026-05-02 22:46:31 +02:00
Meisoftcoltd ba6fc7b8fc 🧪 Add error handling and coverage tests for audio extraction
- Implemented unit tests for `extract_and_standardize_audio` in `video.py`.
- Added test case to verify exception handling when `torchaudio.load` fails.
- Expanded coverage to include resampling and channel standardization (mono/multichannel to stereo).
- Followed the repository's clean testing pattern for mocking dependencies and loading code under test.
2026-05-02 20:46:16 +00:00
Meisoft 41c2d7d34c Merge pull request #104 from Meisoftcoltd/performance-loop-optimization-4925127687414595231
⚡ Performance Optimization: Merge sequential loops in prompt iteration
2026-05-02 22:45:54 +02:00
Meisoftcoltd ecdda64169 ⚡ optimize: merge sequential loops in prompt iteration
Merged two sequential loops over `prompt.items()` in `SequentialLoopTrigger.trigger_next` into a single pass.
The first pass now simultaneously finds the `estimated_chunk` from `AutoLoopCalculator` and performs mutations for seeds and loop indices.
`MasterSwitch` mutations are deferred to a small secondary pass after `is_next_final` is calculated using the gathered chunk size.

This change reduces the overhead of iterating over large prompt dictionaries and yielded a ~26.8% performance improvement in synthetic benchmarks.
2026-05-02 20:45:27 +00:00
Meisoft 26428789ae Merge pull request #103 from Meisoftcoltd/fix-insecure-deserialization-torch-load-video-3886399146367191308
🔒 [security fix] Insecure Deserialization via torch.load() in video.py
2026-05-02 22:44:51 +02:00
Meisoftcoltd 4ce91323a1 🔒 Security fix: Use weights_only=True in torch.load()
Added `weights_only=True` to `torch.load()` in `video.py` to prevent insecure deserialization and potential arbitrary code execution via crafted pickle files. This change restricts the unpickler to only load tensors, primitive types, and basic containers, which is sufficient for the audio dictionary being loaded.
2026-05-02 20:44:38 +00:00
Meisoft cb7b0374ae Merge pull request #102 from Meisoftcoltd/update-tts-calculator-split-mode-4843793747721075440
feat: Update AutoLoopCalculatorTTS to support sentence and paragraph splitting
2026-05-02 22:43:02 +02:00
Meisoftcoltd 08edcf71cb feat: add split mode to AutoLoopCalculatorTTS
This commit introduces a new dropdown to the `AutoLoopCalculatorTTS` node inside `video.py`, allowing text to be split by either "Párrafos (Saltos de línea)" or "Frases (Puntos)". When splitting by sentences, it cleanly preserves the periods to maintain proper intonation in TTS systems. Output pins are renamed (`current_text`, `total_chunks`) for better semantics.
2026-05-02 20:31:44 +00:00
Meisoft f49014866a Merge pull request #101 from Meisoftcoltd/cleanup-video-imports-5692053012707757175
🧹 Cleanup unused and redundant imports in video.py
2026-05-02 22:29:26 +02:00
Meisoftcoltd 60fc92fec0 🧹 Cleanup unused and redundant imports in video.py
- Removed unused import `sys`.
- Removed unused import `nodes`.
- Removed redundant duplicate import `torch`.
- Removed orphaned comment related to the duplicate import.
2026-05-02 20:29:12 +00:00
Meisoft 8fc697a8c3 Merge pull request #100 from Meisoftcoltd/testing-format-bytes-utility-10775869003227782014
🧪 Unit tests for format_bytes utility function
2026-04-30 17:16:46 +02:00
Meisoftcoltd 75ab5d9676 🧪 Add unit tests for format_bytes utility function
- Created tests/test_vram_node.py
- Mocked dependencies (torch, comfy) to allow testing in isolation
- Implemented test cases for zero values, exact GB, fractional values, small values (rounding check), and large values.
- Verified test robustness by confirming failure when logic was intentionally altered.
2026-04-30 15:16:06 +00:00
Meisoft cba02bf08f Merge pull request #99 from Meisoftcoltd/security-fix-command-injection-ffmpeg-3363411280039704601
🔒 [security] Fix command injection in FFmpeg installation
2026-04-30 17:14:42 +02:00
Meisoftcoltd 8d8e3deb1e fix: 🔒 prevent command injection in FFmpeg installation
Replaces the shell-based subprocess call with list-based arguments and
separate invocations for 'apt-get update' and 'apt-get install'.
This eliminates the risk of command injection by avoiding shell
interpretation and properly handles the DEBIAN_FRONTEND environment
variable via sudo.
2026-04-30 14:59:46 +00:00
Meisoft a875f536da Merge pull request #98 from Meisoftcoltd/perf-concurrent-image-loading-13430517007901480050
⚡ [Performance] Concurrent image loading in Video Stitcher
2026-04-30 16:56:44 +02:00
Meisoftcoltd 12a55c7fd6 ⚡ [Performance] Concurrent image loading in Video Stitcher
Introduced concurrent image loading and processing in the Video Stitcher node
using ThreadPoolExecutor. This optimizes the transition from disk-cached PNGs
to the final video tensor by parallelizing I/O and color conversion.

- Replaced sequential loop with ThreadPoolExecutor.map
- Wrapped executor.map in list() to ensure exception propagation
- Verified ~85% speedup in mocked I/O-bound benchmarks
2026-04-30 14:55:12 +00:00
Meisoft 119626a20f Merge pull request #97 from Meisoftcoltd/add-tts-calculator-and-audio-stitcher-15540597175344943849
Support text-driven sequential looping and audio stitching
2026-04-28 19:29:57 +02:00
Meisoftcoltd b854a90bf9 feat: add AutoLoopCalculatorTTS and update IncrementalVideoStitcher for audio caching
- Registered `AutoLoopCalculatorTTS` in `NODE_DISPLAY_NAME_MAPPINGS`.
- Added `AutoLoopCalculatorTTS` class to `video.py` to allow looping through text paragraphs instead of video frames.
- Replaced the implementation of `IncrementalVideoStitcher` to cache audio tensors as `.pt` files and concatenate them along the time axis on the final cycle.
2026-04-28 17:26:50 +00:00
Meisoft e1181c468c Merge pull request #96 from Meisoftcoltd/ffmpeg-audio-standardizer-5748644544721797280
Fix VHS audio bug by physically cloning video with standardized limits
2026-04-25 21:12:26 +02:00
Meisoftcoltd e4f53ca75a feat(video): add conditional FFmpeg audio standardizer for VHS safety
- Introduced `standardize_video_file` helper in `video.py`.
- The helper creates a physical video clone via FFmpeg, copying the video stream exactly to retain quality while limiting the audio stream.
- Audio limits are conditionally applied using `torchaudio.info` (<=44100Hz and <=2 Channels) to avoid unnecessary processing.
- Implemented a "Fail-Fast" approach with `raise Exception` if the FFmpeg cloning process fails, preventing silent downstream crashes.
- Injected the helper directly into `VideoAnalyzerFaceDetector` and `VideoAnalyzerSceneDetector` to secure the path passed down to VHS.
2026-04-25 18:50:46 +00:00
Meisoft 16604f101c Merge pull request #95 from Meisoftcoltd/refactor/standardize-audio-extraction-7105937645850785286
Standardize audio to 44100Hz/Stereo and cleanup residual files
2026-04-25 15:57:42 +02:00
Meisoftcoltd de0797ddb9 Refactor audio extraction and clean up residual files
- Created `extract_and_standardize_audio` helper in `video.py` to standardize audio to 44100Hz and Stereo format.
- Refactored `VideoAnalyzerFaceDetector` and `VideoAnalyzerSceneDetector` to use the new helper function.
- Permanently deleted `modify_facedetector.py`, `modify_facedetector2.py`, and `modify_facedetector3.py` residual scripts.
2026-04-25 13:46:36 +00:00
Meisoft 771f4bf709 Merge pull request #94 from Meisoftcoltd/feat/scene-cuts-priority-1402347662369726826
Refactor scene cuts priority in loop calculators
2026-04-25 14:23:15 +02:00
Meisoftcoltd d660a6b41b Refactor loop calculators to prioritize scene cuts over face cuts\n\n* Added SCENE_CUTS type to VideoAnalyzerSceneDetector.\n* Replaced "safe_faces_list" usage in loop calculators with "scene_cuts_list" as priority.\n* Removed dead code/scripts: update_video.py, fix_newlines.py, fix_tqdm.py, add_scenedetector.py. 2026-04-25 12:20:48 +00:00
Meisoft 0805acb114 Merge pull request #93 from Meisoftcoltd/video-scene-detector-2048273577937433579
feat(video): add scene detector node and caching for sequential batcher
2026-04-25 08:39:27 +02:00
Meisoftcoltd 5983ff65b4 feat: rename video analyzer to face detector, add global cache, and introduce scene detector node
- Renamed `VideoAnalyzerWithAudio` to `VideoAnalyzerFaceDetector`.
- Introduced `VIDEO_ANALYSIS_CACHE` and `current_loop_index` for cycle caching.
- Created `VideoAnalyzerSceneDetector` to detect scene changes via pixel difference.
- Added dynamic reference frame preview functionality outside the caching logic.
- Registered nodes with proper display names in `__init__.py`.
2026-04-24 21:29:55 +00:00
Meisoft d4e507af7c Merge pull request #91 from Meisoftcoltd/fix-lazy-session-cache-8902851697963122458
Fix aggressive Lazy Evaluation in LazySessionCache
2026-04-22 19:34:37 +02:00
Meisoftcoltd 863154901b fix(switch_node): implement aggressive lazy evaluation for LazySessionCache
- Moved `value_in` to the `optional` group to allow ComfyUI to defer its evaluation.
- Updated `check_lazy_status` to return an empty list `[]` for loops > 0, completely cutting off upstream execution.
- Retained the `GLOBAL_SESSION_CACHE` logic scoped by `unique_id`.
- Removed `@register_node` decorator to prevent duplicate registry issues since mapping is handled in `__init__.py`.
2026-04-22 17:34:09 +00:00
Meisoft 6479883f6d Merge pull request #90 from Meisoftcoltd/feat-primitive-delay-12488753207120426735
Add PrimitiveDelay Tool Node
2026-04-21 23:04:10 +02:00
Meisoftcoltd 89a5f767d7 feat: add PrimitiveDelay tool node for timeline control
Adds a PrimitiveDelay custom node to tools.py that blocks execution for a user-configurable number of seconds, acting as a passthrough using the global `AnyType` wildcard connection. This allows users to throttle rapid API requests, wait for IO tasks to complete, or generally space out ComfyUI execution times in sequential batcher workflows. Re-uses the existing AnyType instance from switch_node.py to adhere to DRY principles.
2026-04-21 21:01:56 +00:00
Meisoft fb35df1526 Merge pull request #89 from Meisoftcoltd/feature/lazy-session-cache-8805062770877095561
Add LazySessionCache node with lazy evaluation
2026-04-21 08:59:51 +02:00
Meisoftcoltd 2551cd5832 feat: add LazySessionCache to prevent redundant input node executions
Adds the LazySessionCache node to `switch_node.py` with lazy evaluation.
It intercepts and stores the input value in cycle 0 and bypasses upstream
evaluation in subsequent loops. Updates `__init__.py` to map the class
and register its display name cleanly.
2026-04-21 06:25:30 +00:00
Meisoft 3eb5dcb7ae Merge pull request #88 from Meisoftcoltd/feat/add-logs-and-rename-debug-9893747542349634290
feat: add log string outputs to all nodes and rename debug prefix
2026-04-19 15:35:51 +02:00
Meisoftcoltd ce6041da4a feat: rename [DEBUG] to [Secuencial Batcher] and add STRING log outputs to all nodes
This commit addresses two primary requests:
1. Replaces all console log prefixes `[DEBUG]` (and variations) with `[Secuencial Batcher]`.
2. Extends the `RETURN_TYPES` and `RETURN_NAMES` of all nodes to output a `log` string containing exactly the text emitted via `print()`. This string is constructed by intercepting `print()` calls inside node methods using a local wrapper and appending the texts to a list, which is then returned joined by newlines.
2026-04-19 13:33:52 +00:00
Meisoft 7d266f818c Merge pull request #87 from Meisoftcoltd/feat/vhs-path-selector-dual-output-1840554855603352002
feat: update VHS_Path_Selector outputs and category
2026-04-18 12:40:45 +02:00