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.
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
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.
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.
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.
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
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
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.
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
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
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.
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.
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.
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
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.
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.
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
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.
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.
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.
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.
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.
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.
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