Commit Graph
219 Commits
Author SHA1 Message Date
Austin Mroz 75fc10e0ff Parse ffmpeg version information and choose best
While I have previously shied away from using imageio-ffmpeg as the
default version because the included version is 4 years old and
specifically does not work with the av1 format, there have been specific
issues from people with a system version of ffmpeg that is even older.

There has been a longstanding desire to create a system for determining
the best version of ffmpeg, but this has proved a reasonably involved
task. Some version information uses git commit hashes instead of a
potentially sortable semvar and there are a large number of compile time
flags that could result in a newer binary having less functionality.

Thus a sysstem has been added that parses compile flags for desired
encoders as well as the copyright year to determine which ffmpeg version
is more feature full.
2023-12-19 11:40:42 -06:00
Austin Mroz 4b2c72d483 fix Load Images hashes, video_format loading
Fix load_image_cap applying to hash when 0

Fix the video_formats path itself erroneously having the VHS namespace
applied
2023-12-12 12:11:40 -06:00
Austin Mroz 3805fa012e README, Path suggestion, video_format fixes
In an edge case, scan dir would throw an erro when encoutering a broken
symlink. It has been fixed to ignore these broken symlinks

Fix an edge case where the video_formats folder is overridden by
ComfyUI-AnimateDiff-Evolved if VideoHelperSuite loads first. See #87

Further README additions
2023-12-10 12:00:29 -06:00
Austin Mroz 4e21e8acb4 Merge correct README, update VHS_FILENAMES
I forgot to fetch before locally merging the README branch. The up to
date README is now included and has been updated with information on
output of Video Combine and the naming change to save_output

VHS_FILENAMES now includes the value of save_output and the full path of
the resulting output files.
2023-12-08 02:13:28 -06:00
Austin Mroz 942085a0d2 Fix custom height when both set, duplicate preview
When both VideoHelperSuite and animate-diff (not evolved) are installed,
the legacy video_upload option applied to the node causes animate-diff
to apply a second preview and upload button on our node. This is fixed
by removing the no longer used tag. fixes #58

Fix a minor indexing mistake that would cause the custom width to
apply to both width and height when "Custom" was selected.
2023-12-07 01:28:05 -06:00
Austin Mroz 3a34051eee Video loops, force imageio ffmpeg, metadata fix
Support loop_count with videos, fixes #83

Add support for forcing usage of ffmpeg bundled with imageio by setting
VHS_USE_IMAGEIO_FFMPEG to ease testing and as a temporary fix for #80

When saving with metadata, if an error occurred after initialization, an
empty output video would be produced which caused the without metadata
retry to fail with a less helpful error message. Now, if the pass with
metadata failed, but produced an output file, that error is raised and
the retry does not occur. This should not change the effectiveness of
the fallback for those who were experiencing the metadata issue.
2023-12-06 20:10:59 -06:00
Austin Mroz 7565290d2b Fix old workflows, Custom Size on refresh
Further migrations to video parameters had broken display of output
videos when an old workflow is loaded. This is fixed.

When the refresh button was clicked in ui, the custom size options of
Load Video were overwritten and lost. When the refresh button is
clicked, the custom size options are now readded properly.
2023-12-06 15:05:30 -06:00
Austin Mroz 76c8971c94 Rename save_image to save_output on Video Combine
This includes migration code to preserve old workflows
2023-12-04 14:08:32 -06:00
Austin Mroz d9b28d3e67 Merge 'origin/README' into develop 2023-12-04 01:06:29 -06:00
Austin Mroz 8ce1682187 Several js fixes
Fix params being uninitialized on migrated workflows

Fix null filename when performing a right click -> save on a video

Fix edge case in paths of a specific length causing console spam
2023-12-04 00:45:29 -06:00
Austin Mroz 31803f5308 URLs in Load Video (Path), more logging changes
Basic support for loading urls has been added to Load Video.
Most of the work is made trivial by both ffmpeg and opencv automatically
fetching a url if it's provided instead of a path.

A more sophisticated fix for error passing from ffmpeg during preview
generation. If a request is aborted, the ffmpeg process is immediately
killed instead of being allowed to respond to stdin being closed and
waited on at the end of the with block
2023-12-03 14:11:53 -06:00
Austin Mroz 9193868907 Revert metadata toggle, logging, round ints
The toggle for saving metadata has been changed back to a boolean
instead of a combo. While I wished to provide for future compatibility,
the change broke existing workflows and there was no accommodating
implementation to load metadata saved under a different tag.

The log level for ffmpeg preview processes has been raised to fatal.
There's a good chance this will make debugging harder for users when
errors arise, but aborted requests were too common for the error
messages produced by them to be acceptable.

Format widgets for ints are now properly rounded.
2023-12-03 12:36:41 -06:00
AustinMroz 18d7aa978c Update README for new features, Image/Latent nodes 2023-12-03 03:40:01 -06:00
Austin Mroz ad1baf1fa8 Load Image, custom size, extension passing fixes
Load Images had a typo prevent it's extension filter (of nothing) from
applying

Audio inputs and outputs now consistently use lowercase audio as a
description and have a format name of VHS_AUDIO. While other extensions
could share the audio type name, they would not pass functions.

Previously when using ffmpeg to load a video, care was needed to ensure
that the first frame was index 0, but the frame at 1s was the first to
appear after 1s. This should now be fixed.

The js code for load video nodes now passes the extension as part of the
format so that gifs and webps can be properly distinguished between when
deciding if an advanced preview should be loaded.

Fixed a mistake in serialization of custom height on load video nodes
2023-12-02 11:59:05 -06:00
Austin Mroz 19a84ddf72 Yet further fixes
Add "-b:v" flag to webm format, resolves #78

Fixes Video Combine to provide an output usable outside the ui,
a list of files produced, resolves #57

Fix error in file path safety checks across drives on windows

Fixes for preview generation when backing file has audio

Don't scale video previews above their base resolution

Implement select_every_nth for advanced previews

Fix regression with improper callback checking on Load Audio

Reorder Load Audio in node mappings to not be grouped with image nodes
2023-12-01 14:43:20 -06:00
Austin Mroz 70f010f7ea Support previews for Load Video (Path), cleanup
Video Combine now returns a list of output files:
Partial fix for #57

Move safety checks to single shared function, added opt out by
environment variable. Easier methods are being considered

Modifications to viewvideo endpoint to work with paths instead of
standard methodology

Return an empty list of options instead of an error status for path
suggestions in an attempt to further reduce console spam.

Substantial js refactoring to simplify preview logic and
compartmentalize code that is shared between upload and path nodes
2023-12-01 10:04:59 -06:00
Austin Mroz 0ee635d2b0 Improve Load Images masks, further cleanup
Enable path suggestions for Load Images

Add masks equal to image size if any image has masks
This causes images with masks to function as expected and those
without to remain fully opaque.
Special thanks to @miaoerduo

Fix counter regex to work with audio outputs

Fix extension not being set for animated image outputs

Reductions to extraneous preview loads

Prevent new preview code from applying to webp files
2023-11-30 21:54:25 -06:00
Austin Mroz a1ee051238 Further cleanup
save_metadata is now a format flag
- This allows saving to different tag and hides for image formats

Implement high bit depth support
- Disabled by default, but works for images and has shown in testing to
  produce objectively higher quality output than base Save Image

Fix target_size from load video not applying when 2 dimensions are set
When an input video is scaled to a new aspect ratio, it is now cropped
Removed try wrapping of load video nodes. This creates more confusion
now a system of fallbacks isn't used

A fix for parsing format_widgets when applied outside a '_pass'

Fixed missing import of logger in utils

Animated images are now included in the animated preview code
- This improves performance and allows for pausing

Cleaned up injection of code to load metadata
2023-11-30 17:40:57 -06:00
Austin Mroz f63a0f789d Feature branch cleanup
Switch to new path widget code on remaining nodes

Performance tuning on video preview code
Surround preview code in try block in case request is closed
- May warrant a future pass, but ffmpeg errors will still log to console

Swap lack of common path in get_path to status=403
- This was mostly made to ease future changes to common path behaviour

Simplify the value field of preview widget.
- Reduces complexity and lessens duplicate requests on first loa

Introduce ui setting for advanced previews
- Reliability is shakey, so it's better kept as opt-in for now

Previews are properly integrated and apply to Video Combine nodes

More advanced formatting code when a path is too long to display

Reduced console spam from path suggestions
2023-11-30 14:29:03 -06:00
Austin Mroz e8e6971eaf Merge branch 'format_widgets' into develop 2023-11-29 20:43:25 -06:00
Austin Mroz 417332840c Merge audio, videopreview, path_completion branche 2023-11-29 20:39:52 -06:00
Austin Mroz 6218fe5342 Implement path completion
A number of nodes take a path as input.
This commit gives a search box with a list of valid files and folders
It also provides support for quickly selecting from valid options by
clicking or pressing tab.

Completion options are currently only suggested for subfolders of
comfyui, but this is easily changeable.
2023-11-29 16:31:32 -06:00
Austin Mroz d0ddff7391 Numerous audio improvements
Audio settings are now stored in video_formats
Updated video_formats with reasonable defaults for audio
A Load Audio (Path) node has been added
Audio Loads are cached with load state and only occur once.
2023-11-26 22:30:33 -06:00
Austin Mroz 53d6d24b5f Partial implementation for audio wiring
Seemingly functional.
Loading audio from a file will be reimplemented as a future node
Format support is forthcoming
2023-11-26 20:30:19 -06:00
Austin Mroz 0592867fa6 Merge remote-tracking branch 'gate/main' 2023-11-26 19:37:34 -06:00
Jedrzej Kosinski c7c299a9e8 Merge PR #76 from Kosinkadink/stderr_capture (code by AustinMroz)
In Video Combine, capture stderr from ffmpeg
2023-11-25 19:29:58 -06:00
Austin Mroz 6682ee3077 Transition from Popen to subprocess.run
This should remove any chance of deadlock.

Adds a system to attempt saving without metadata if an error occurs
while attempting to save with.

Fixed a minor mistake when attempting to dump non-fatal stderr output
from ffmpeg to system stderr
2023-11-24 22:27:34 -06:00
Austin Mroz 092688e373 In Video Combine, capture stderr from ffmpeg
This ensures the error pop up in the webui contains information on what
went wrong with two minor caveats:

The error output of ffmpeg is no longer colored. This could be
re-enabled with an environment variable, but it would then need to be
manually filtered out from the webui display.

This introduces a likely insignificant chance of deadlock.
If stderr somehow becomes full without ffmpeg terminating, it could
block execution of writing data to stdin. I don't forsee a situation
where this could occur as ffmpeg is set to low verbosity.
2023-11-24 17:25:26 -06:00
Austin Mroz 7773c61ef7 Functional previews in browser
Current js implementation is rough, but results are promising
2023-11-23 14:20:44 -06:00
Austin Mroz 1c9f3ab7d4 Initial proof of concept preview endpoint
Adds a new url endpoint for previewing videos
The intent, is that the video can be encoded on-the-fly with low quality
parameters to return a preview of the selected video time slice, it's
resolution, and frame rate, with lessened quality to reduce transmission
time.

Initial testing has a response time that is not great,
correspondingly, this may be non-viable
2023-11-23 12:24:13 -06:00
Austin Mroz 9fd996ead3 Fix server-side prompt parsing, debugging.
While having the optional arguments passed is non-trivial, there's an
easy fix to get retrieve all params sent from the client.

Substantial changes to how formats are stored on the backend to ensure
that the extra data isn't displayed in the dropdown list or upon
clicking the "Refresh" button in the ui.

Update most existing existing formats to expose options as widgets
2023-11-22 00:04:58 -06:00
gateway e34ada55ac refactor to take in account each video coded and the proper audio code requiredx 2023-11-21 19:50:39 -08:00
gateway 742d3038e8 removed default, this may trigger it to fire off the audio function.. 2023-11-21 15:55:13 -08:00
gateway 8c15c6ccf6 removed space and comma 2023-11-21 15:51:00 -08:00
gateway 96d81cf33f Adding audio track to video combind 2023-11-21 15:47:34 -08:00
Jedrzej Kosinski a69bea4af3 Merge pull request #71 from Kosinkadink/rollback_ffmpeg_settings
Rolled back h264 and webm -pix_fmt due to too many issues
2023-11-18 17:36:26 -06:00
Jedrzej Kosinski 8841506a81 Rolled back h264 and webm -pix_fmt due to too many issues (at least with h264, not sure about webm, rolled back just in case) 2023-11-18 17:35:43 -06:00
AustinMroz aba622c97f Merge pull request #61 from zhangp365/main
Swaps pix_fmt for h264 and webm to 420p10le
2023-11-17 10:46:08 -06:00
Jedrzej Kosinski a824859f93 Merge PR #66 from Kosinkadink/make_save_video_optional_param
Made save_metadata an optional parameter for now
2023-11-16 16:25:52 -06:00
Jedrzej Kosinski f33f146d8a Made save_metadata an optional parameter for now to keep ComfyUI from throwing an error when loading an old workflow 2023-11-16 16:23:25 -06:00
Jedrzej Kosinski d924bf62ad Merge PR #65 from Kosinkadink/metadata_toggle (by AustinMroz)
Add toggle for saving video metadata
2023-11-16 15:50:56 -06:00
Austin Mroz 729f2c225b Add toggle for saving video metadata
If enabled, metadata is saved using a tempfile

Code has been simplified to as metadata length is no longer considered
and fallbacks are no longer needed
2023-11-16 12:08:05 -06:00
zhangsongbo d36f61ff46 upgrade the video formats. 2023-11-15 17:54:10 +08:00
Austin Mroz cb6d1ae2c7 wip format_widgets implementation
Likely impossible to implement
Widgets which are not defined in original node function definition are
not passed
2023-11-09 13:39:34 -06:00
Austin Mroz 4de52b66c8 Escape filename in regex counter code
The change to remove the underscore from the end of Video Combine output
filenames uses regex to extract the digits of existing filenames, but
fails to escape the filename_prefix. This can go wrong in a bunch of
ways, but most concretely, a prefix like `video (1)` would establish an
earlier matching group and set the counter to 2, making a repeated
counter likely.

Also compiles the regex once per execution.
2023-11-05 12:40:54 -06:00
Austin Mroz ba0110350c Fix extra crf flag when saving longer metadata 2023-11-03 21:55:42 -05:00
AustinMroz ac495cbef8 Add information on I/O nodes 2023-11-03 13:13:53 -05:00
Austin Mroz 9ed20235c3 Support ProRes as an output video_format 2023-11-03 12:12:59 -05:00
Austin Mroz 5a5cf93599 Merge pull requests #45 and #50 2023-11-02 17:16:18 -05:00
Austin Mroz c4b36a0555 State migration: combo and IOB
Combo widgets which use the first item instead of a default field are
now successfully reloaded if not defined.

Fixed a minor IOB from combo inputs having only a single element in
their definition
2023-11-02 17:07:02 -05:00