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
Migrates preview widgets to use the ComfyUI DOMWidgets implementation.
This resolves a number of issues with flickering, adds support for DOM
element clipping, and should have better compatibility with future
updates.
resolves#128
Fixes to logic for determining when the aspect ratio of a video preview
has changed.
Add a 16bit-png video_format which supports output transparency. Other
formats could be updated for similar capabilities, but are likely to
have issues with device support and unlikely to see widespread adoption.
Modifies the preview server code to properly parse and check for the
existence of sequence filenames.
Some custom nodes will produce Image tensors with an alpha channel
Pillow will automatically handle this correctly, but this extra data
made the input pix format incorrect for ffmpeg.
While there is a trivial solution to trim the alpha channel from the
image tensor with images[:,:,:,:3], it's quite straightforward to
instead specify the inclusion of the alpha channel in the input pix_fmt
resolves#126
Previously, any change to force_size, custom_width, or custom_height
would cause the video preview to reload. This has been changed to only
reload the preview if a change of values has occurred that could change
the aspect ratio.
Before, custom_width and custom_height widgets were virtual widgets that
were used to generate an equivalent force_size value on serialization.
This logic has been moved to the python side, but is largely unchanged
for simplicity.
This allows for custom_width and custom_height to be converted to an
input and set by output from python code which is not known before
execution.
resolves#119
When ComfyUI-to-python is used, prompt is not set. This makes sense
because prompt could not be accurate to any changes which are made to
the generated python code.
However, the extra format values from a converted workflow are sanitized
away and unrecoverable.
This is handled by
- Using the default values for format_widgets when prompt is None
- Allowing for these values to be manually specified with the
manual_format_widgets argument
resolves#118
In Video Combine, libx264 may crash with 1000+ input images.
To avoid the crash, add hardware encoding supported by NVIDIA GPUs.
Add bitrate option which precludes crf.
Add megabit option, which so the user may specify bitrate in Mb or Kb.
Add hvc1 video tag, for better support on with Apple quicktime - to hevc_nvenc and libx265 video formats.
This allows previews to show up in Safari too.
Add *.swp to .gitignore.