Commit Graph
292 Commits
Author SHA1 Message Date
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
AustinMroz 958b03b44a Merge pull request #129 from Kosinkadink/develop2
Merge DOMWidget migration, add 16bit-png format
2024-01-14 12:51:26 -06:00
Austin Mroz ff59a789c9 Initial DOMWidget migration
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.
2024-01-13 20:28:28 -06:00
Austin Mroz cf343e0a9d Add 16bit-png format. Support sequence file paths
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.
2024-01-13 17:56:00 -06:00
AustinMroz b86c1f9f45 Merge pull request #127 from Kosinkadink/develop2
Merge Develop2
2024-01-12 21:31:24 -06:00
Austin Mroz 030afa209b VideoCombine: Support 4 channel Images
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
2024-01-12 21:24:22 -06:00
Austin Mroz 6ec9bdf17f Only reload preview if aspect ratio would change
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.
2024-01-09 22:19:27 -06:00
Jedrzej Kosinski c0d3e3ffa6 PR #123 from Kosinkadink/develop: Mask versions of image/latent nodes
Added mask version of image/latent nodes
2024-01-08 22:59:16 -06:00
Austin Mroz 625d43e31d Pass custom_width and custom_height to python code
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
2024-01-08 16:12:45 -06:00
Austin Mroz cfcbddc1bb Improve format_widget handling when prompt is None
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
2024-01-08 08:16:25 -06:00
Jedrzej Kosinski 6dda23d4f0 Added mask version of image/latent nodes 2024-01-06 07:55:50 -06:00
Jedrzej Kosinski 5af8afa0e9 Merge PR #120 from Kosinkadink/develop - VAE Decode/Encode Batched nodes
Added VAE Decode Batched and VAE Encode Batched
2024-01-06 05:42:15 -06:00
Jedrzej Kosinski 1d274e0ab1 Added Batched versions of VAE Decode and VAE Encode 2024-01-06 04:28:15 -06:00
Jedrzej Kosinski 4ad394520d Merge pull request #91 from iemesowum/h264_nvenc
Add h264_nvenc, hevc_nvenc (NVIDIA) hw encoding
2024-01-05 01:24:41 -06:00
Isaac Emesowum 1318b08a32 Add h264_nvenc, hevc_nvenc (NVIDIA) hw encoding
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.
2024-01-02 18:04:31 -05:00
AustinMroz 36fea9f97b Merge pull request #115 from Kosinkadink/develop
Fix load_image validation, old version validation
2023-12-30 10:24:44 -06:00