Commit Graph
307 Commits
Author SHA1 Message Date
Robin Huang c0bcded0be Add Github Action for Publishing to Comfy Registry 2024-05-16 21:23:03 -07:00
Mel Massadian 47e56f3e42 fix: 🐛 properly handle list inputs
see
https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite/pull/197#issuecomment-2067233344
2024-04-20 17:29:09 +02:00
Mel Massadian 91863cb3ed feat: ✨ add empty input support 2024-04-19 19:10:51 +02:00
Austin Mroz 5b5026cfb7 Fix LoadAudioUpload IS_CHANGED/VALIDATE_INPUTS
I gave incorrect information in #192. IS_CHANGED is used
for optional inputs. This raised a minor issue in needing to resolve
the selected autio to a file path which is fixed here.
2024-04-17 09:48:03 -05:00
Kijai a81be0b8c5 Fixes 2024-04-17 11:34:46 +03:00
Kijai 34b6604927 Update nodes.py 2024-04-16 18:01:19 +03:00
Kijai b2fde5abde Add LoadAudioUpload -node 2024-04-16 17:39:54 +03:00
Austin Mroz e369cac458 Fix typo in error shown when ffmpeg is unavailable
Resolves #191
2024-04-15 10:43:31 -05:00
Austin Mroz a92db63067 Use case insensitive counter checking
Windows has unusual behaviour for case sensitivity in file paths. Files
and folders retain the case used when initially created, but path
resolution is case insensitive. Since the previous counter code did not
account for this, setting a filename_prefix in Video Combine with case
different from a previous execution would fail to include prior
executions nad produce a counter and filename that resolve to an already
existant file, throwing an error.

To account for this, the counter code has been made case insensitive.

See #190
2024-04-10 13:48:58 -05:00
Austin Mroz 47c7f9a78e Force migrate batch_manager inputs to meta_batch
When loading graph data, the "name" field on inputs is overwritten to
the name data saved in the workflow. As old workflows utilizing these
meta batches have the old batch_manager name, the input is loaded to
it's old name which would cause an error on execution.

Instead, quick javascript code has been added to manually force the
update of these inputs.
2024-04-09 11:46:54 -05:00
Austin Mroz d621c6b534 Always display ffmepg formats, raise error instead
While it made sense to quietly proceed when io nodes were rolled into
animate diff, the process of hiding unusable formats has caused frequent
confusion in addition to being a logic path that should not be formally
supported (imageio-ffmpeg is in requirements.txt so a lack of ffmpeg
is best considered an invalid install.)

While an angry warning was displayed on boot, this error message is
frequently missed by end users. Now, all format options are
displayed and, if an unusable format is selected, an error is raised
which provides a list of options for how to install ffmpeg

Additionally, an extra search path was added to run an ffmpeg executable
that is placed in the base ComfyUI directory. For those struggling with
virtual environments or the system path, this provides a third
installation option that works regardless of os, or venv and requires no
need for external configuration or environment variables.

See #188, among others.
2024-04-08 22:57:05 -05:00
Austin Mroz eb302e3844 Swap Batch Manager name to Meta Batch Manager.
The reuse of the word batch in different contexts cuases a good bit of
confusion. The batching performed by the batch manager node has been
renamed as "meta batch" to help alleviate this confusion.
2024-04-05 17:23:43 -05:00
Austin Mroz 27719462b2 Remove try/finally block from cv_frame_generator
See #185
2024-03-30 19:30:16 -05:00
Austin Mroz 50a2e3c8ed Fix missing total_frames in Load Video
Several additional information variables were added for VideoInfo
that need to be saved and passed. total_frames was ommited from one of
the tuples resulting in errors when using batch_manager and has been
fixed

Resolves #179
2024-03-25 13:24:29 -05:00
Austin Mroz 0034d76be2 Use iterators internally for Video Combine
Reduces the need for the converted image data to exist entirely in
memory for a 20% reduction in memory used by VideoCombine

Removes the allocation of a new array for pingpong.

Allows for for processing of input images which are not tensors.

Resolves #176
2024-03-23 11:20:32 -05:00
Austin Mroz 6c22ca055e Swap frame_rate on VideoCombine to float.
As video info produces a float for it's loaded frame rate, and
non_integer frame_rates are reasonably obtainable by using
select_every_nth, frame_rate has been changed on VideoCombine so that
the loaded frame_rate of Video info may be wired.
2024-03-22 15:15:38 -05:00
Austin Mroz 664814d735 Respect select_every_nth in VideoInfoLoaded 2024-03-22 14:59:06 -05:00
badayvedat ba1781c3f9 feat: return info for both source and loaded video info 2024-03-22 01:14:48 +03:00
badayvedat 836f9252da feat: add video info node 2024-03-21 21:49:29 +03:00
Jedrzej Kosinski f94597739f Merge pull request #159 from kijai/main
Batched vae encode fix for latest comfyui changes
2024-02-21 04:39:52 -06:00
Kijai 2d4bac8612 Batched vae encode fix for latest comfyui changes 2024-02-21 12:34:52 +02:00
Austin Mroz ca8494b380 Add support for saving with timestamp metadata
Always record CreationTime when saving the first frame png.

Always record DateTimeOriginal when saving as webp.

For video formats, when saving with metadata, record creation_time.

Resolves #155
2024-02-12 13:28:28 -06:00
AustinMroz 1916b7c0fb Merge pull request #154 from Kosinkadink/develop2
Merge Develop2 branch
2024-02-07 23:34:22 -06:00
Austin Mroz 5a60c935c7 Improved audio handling when no audio exists
Before, if an attempt is made to load audio from a media file that lacks
audio, an exception is raised which, inconveniently, is incorrectly
captured and handled by a higher level try-catch block.

Instead, exceptions in the ffmpeg call to extract audio from a file are
handled inside the get_audio function call and False is passed on
failure. False is used largely as a matter of convenience so that the
failed output is cached between runs and not re-executed

Since this output is cached, it's then easy to just check if audio
resolves to False and skip the code to embed audio (as if there was not
an audio input wired). This allows reuse of a single workflow that will
embed audio when it's available.

Resolves #153
2024-02-07 23:23:02 -06:00
Austin Mroz 03dbc9bc2a Improve import speed with single ffmpeg option
In order to eliminate the issues related to old system versions of
ffmpeg, a system was added for ranking the suitability of available
ffmpeg versions. This has a fairly high startup cost, so it's now
skipped when only one option exists.
2024-02-07 15:03:58 -06:00
Austin Mroz e1fe20a39d Fixes to Gifski implementation
When gifski is selected as a format, an image output is produced even
though it is produced through the video encoding path. The format has
been updated so javascript code knows that a gif image was produced and
is able to display the output even when Advanced Previews is disabled.

Gifs can not have embeded audio. If a format that produces gifski output
has been selected, any routed audio input is now ignored. Comments
related to audio output were moved to improve the clarity of the else.
2024-02-07 14:59:25 -06:00
Austin Mroz a2900c3273 Add support for Gifski ouput
Adds support for a gifski_pass in video_formats and a gifski format
which utilizes it. Resolves #79

Much consideration was put into how best to implement this. Gifski does
not support piped input, and implementing such functionality is
infeasible as the ffmpeg library used by Gifski requires inputs be
physical files. Consequentially, an intermediate file of some sort is
required. While an implementation that would not require a prior ffmpeg
pass was investigated, the only viable intermediary format
between Pillow and Gifski's ffmpeg decoder is an animated png and gifski
will never pass this png to it's ffmpeg decoder as it sees the png
header and instead interprets the file as a single frame image.
2024-02-07 12:03:26 -06:00
Austin Mroz ad9be8d398 Restrict BIG constants to js safe integer values
js uses doubles for all numbers, as a result, the maximum number that
could be entered by the ui and still allow for functioning of
increment/decrement.

Of consideration, ComfyUI uses a lower cap of 2**50 for seeds
2024-02-07 12:03:15 -06:00
Jedrzej Kosinski 9e79ff4399 Merge PR #151 - os.environ.get fix + improved inputs limits
os.environ.get fix + improved inputs limits
2024-02-06 02:22:30 -06:00
Jedrzej Kosinski ffd061a709 Use BIGMIN and BIGMAX for inputs with no intended limits, use DIMMAX for setting size inputs to go up to ComfyUI limits, increased force_rate max up to 60 2024-02-06 02:17:45 -06:00
Jedrzej Kosinski f880012653 Fixed os.environ.get call 2024-02-06 01:58:05 -06:00
Austin Mroz 7cdb6b474f Fix truncated audio with select_every_nth > 1
Resolves #146
2024-01-31 12:54:00 -06:00
Austin Mroz 9cf39079b6 File hash and filename counter fixes.
The hash function used for IS_CHANGED had particularly poor performance
characteristics when combined with the new batch functionality. The
larger video files take a while to scan through and the scan occurs for
every sub-batch step. Consequentially, hash calculation has an
exponential performance cost when batching larger videos.

calculate_file_hash has been changed to instead use the modified
timestamp on the file. In profiling this brought the time cost for a
single call to IS_CHANGED from ~600 ms to <1 ms

The 16bit-png format was not being matched by the file counter regex and
resulted repeat counter values when combined with Prune Outputs.
The regex has been relaxed to prevent this discrepancy.
2024-01-31 12:32:39 -06:00
Austin Mroz d521e54444 Fix Batch Manager with Prune Outputs.
For safety, Prune Outputs asserts early that the list of filenames is at
least length 2. This results in an error when the partial output of a
managed batch returns no files. A simple check is added to instead do
nothing for these incomplete batches.
2024-01-30 16:26:05 -06:00
AustinMroz d6b359468c Merge pull request #145 from Kosinkadink/batch_manager
Implement Batch Manager node
2024-01-30 11:59:56 -06:00
Austin Mroz 088b700873 Merge branch 'main' into batch_manager 2024-01-29 21:04:29 -06:00
Austin Mroz 38618d4eae Fixes for batch_manager error handling
stdin is always flushed before yeilding. While this loses some potential
speedup by processing video output on cpu while the gpu is processing
the next batch of frames, it is likely incompatible with errors related
to metadata which could not be replicated. For now, stdin is flushed to
reduce the likelihood of regression.

Fixed a mistaken ordering in the batch_manager node causing the
unique_id to be overwritten.

Re-add the dummy count value to the batch manager node in js. Without
it, an error during the first batch step will result in teh batch
manager node not being marked as stale. Since the batch_manager node
exists only as an optional input, IS_CHANGED will never be called and
there must be some external change to ensure it is still marked stale
2024-01-29 20:50:31 -06:00
Austin Mroz af3f0c1be4 Migrate re-queues to occur on server side
Terminate batch when any input closes
2024-01-29 16:15:12 -06:00
Austin Mroz eb09af1d17 Minor refactoring to #144
target_frame_time is instead passed with the width and height variables.
This removes the need for the video file to be re-opened on each of the
sub-batch executions.

env is instead calculated outside of the ffmpeg_subprocess function so
that any changes made by the video_format can apply to the audio
pass as well.
2024-01-28 22:26:35 -06:00
Austin Mroz b076b129cf Add error messages to batch incompatibilities
pingpong and image output formats are incompatible with batched output.
pingpong will have each batch segment be reversed independently. An
error message is printed for pingpong to indicate this is a known issue
Image formats will write over themselves. An exception is raised to
immediately halt execution.
2024-01-28 22:12:43 -06:00
QuintinMouser 662c6caab1 Fix missing target_frame_time variable 2024-01-28 17:42:46 -08:00
QuintinMouser b46265db0d Fix missing env variable 2024-01-28 17:41:57 -08:00
Austin Mroz 60cdc6c8bc Batch Manager supports multiple inputs and outputs
Also removes the use of a static batch_manager instance
2024-01-25 01:08:38 -06:00
Austin Mroz ca317b85ba Fix overlaying on transparent gif output
When saving a gif with transparency, the previous frame would display
underneath the new one. This is fixed by setting the disposal flag.

Resolves #141
2024-01-24 12:11:10 -06:00
Austin Mroz c5de20d0bf Initial proof of concept for Batch Management
Processing video can have prohibitively high memory requirements.
This commit introduces a system for dividing the processing of a video
input into multiple workflow executions.

To accomplish this, the reference to the cv2 video_capture instance, and
the ffmpeg subprocess are kept open and the workflow is automatically
re-executed for each partial step.
2024-01-23 23:47:36 -06:00
Austin Mroz aca4dfcdac Update preview on Upload
Previously, Load Video (Upload) and Load Images (Upload) would swap to
the new file or folder, but would not update the preview. They have both
been fixed.
2024-01-18 16:03:03 -06:00
Austin Mroz 97fbebd3af Restore preview display when zoomed out.
In switching to video previews to use DOMWidgets, the performance
optimization to hide elements when zoomed out was left enabled by
default. This hiding has been disabled to restore prior functionality.
2024-01-17 17:34:23 -06:00
AustinMroz 1dbf01b918 Merge pull request #132 from Kosinkadink/develop2
Merge Prune Outputs node
2024-01-16 21:05:03 -06:00
Austin Mroz 48f7b5e2f4 Add hotkey to disable PathWidget extension filters
Load Video and Load Audio both function with inputs not officially
listed as supported. Load Video can be used to load image files as a
substitute for Load Image and Load Audio can be passed video files.

While users have always had the option to manually type the path to a
filetype not ostensibly supported, this can be inconvenient.

A hotkey (Ctrl+g) has been added to temporarily disable the extension
filtering.
2024-01-15 22:14:35 -06:00
Austin Mroz 93fd8dc8d5 Add "Prune Outputs" node
Adds a node for pruning some file outputs produced by Video Combine

"Intermediate" will remove an output with no audio if a better output
with audio has been produced.
"Intermediate and Utility" will also remove the standalone first frame.
Partial support for an "All" option would potentially allow for fully
ephemeral previews, but has been disabled as it creates a race condition
where the output is deleted before it can be displayed.

resolves #130
2024-01-15 22:02:13 -06:00