37 Commits
Author SHA1 Message Date
应元东 8923bd836b fix ffv1 color/alpha shift (#581)
* Add 'gbra' to alpha channel regex check

* Add input color depth 16bit option to ffv1-mkv.json

* use rgba64le by default in ffv1-mkv.json
2025-11-02 23:28:40 -08:00
Hoernchen f1698cbd92 add ffv1 support
FFV1 is a nice lossless format that allows recovering the original images for postprocessing. It is nowadays specified for MP4 containers as well, but ffmpeg support was only added in nov '24: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/0b8c9cf5b490a0231949ab3c6d797462ae001730 so for now MKV is enough.
2025-07-21 23:03:36 +02:00
Austin Mroz 47fb44708d Fix missing list nesting 2025-04-18 13:46:18 -05:00
Austin Mroz e49fed4585 Variable length format arguements. ProRes fixes
Co-authored-by: Kaur Kuut <strom@nevermore.ee>

A single item list is now mapped as a template string later flattened to a
variable number of arguments. This handles the case of both no and
multiple arguments

Apply required ProRes fixes from xStrom. While the delays were
unfortunate, these changes should handle any future edge cases and
retains support for older workflows using the numbered ProRes profiles

Closes #451
2025-04-13 02:26:26 -05:00
Austin Mroz 136fc6abde Merge nvenc-av1, pixfmt, prepass fixes 2025-04-08 01:05:27 -05:00
Kaur Kuut a11bcf4a08 Use correct p010le pixel format with NVENC. 2025-04-06 15:49:15 +03:00
Kaur Kuut 17ad06aa25 Add NVENC AV1 format. 2025-04-06 15:25:09 +03:00
Austin Mroz 2fb06b1634 Merge explicit Metadata, gifski fixes. 2025-04-03 01:45:21 -05:00
Kaur Kuut d1733bb518 Add explicit color space metadata for FFmpeg 4.2 output. 2025-04-03 00:30:23 +03:00
Kaur Kuut a0312ec4c2 Increase the quality of the YUV4MPEG2 pipe stream to Gifski. 2025-04-02 23:47:45 +03:00
Austin Mroz eeb794ab0d Merge colorspace, NVENC fixes. 2025-04-02 00:29:14 -05:00
Kaur Kuut d18ff47633 Remove broken rgba support from NVENC formats. 2025-04-02 00:46:12 +03:00
Kaur Kuut b34d3ba46b Add color space metadata to ffmpeg input. 2025-04-01 16:02:32 +03:00
Austin Mroz 3ed5c7fcc2 Remove colorspace filter from ProRes/webm formats
Applying this breaks alpha and testing seems to indicate that the other
colorspace arguments produce a much more visible difference in output
quality.

Resolves #350
2025-01-03 01:28:42 -06:00
Austin Mroz 6953fa2144 Fixes to trimming, add to formats
The js code to add format widgets incorrectly checked for truthiness,
so trying to set false as a default value would leave a widget
uninitialized. This has been fixed.

The check for the actual state of trim_to_audio incorrectly assumed it
to still be a boolean and has been corrected.

The webm and h264 formats have had widgets added for trimming to audio
length. After further consideration, VHS already has code to ensure that
workflows won't brick if an option is removed in the future. A minor QoL
being sunset in the future is still better than that QoL feature never
existing.

Bump version
2024-12-12 11:47:44 -06:00
Austin Mroz 8893cdc8be Force colorspace conversion in video formats
The color in output videos being slightly off has been a long standing
issue. While a workaround has been known for several months,
implementing the change would break the loop_count functionality on
Video Combine and gave concerns about compatibility when older versions
of ffmpeg were used.

See
https://www.canva.dev/blog/engineering/a-journey-through-colour-space-with-ffmpeg/
2024-11-19 14:17:33 -06:00
Austin Mroz 8f8df32db1 Add additional format options for transparency
Updated ProRes to allow transparent output when set to Profile 4. As
part of this change, pix_fmt is no longer explicitly set for ProRes, but
the expected format is automatically applied from for each profile.

Added rgba as an output pix_fmt for the nvenc formats. These have not
been tested and may not function.

Fix incorrect escape in Advanced Preview code.
2024-07-31 02:19:27 -05:00
Austin Mroz b5d907bade WIP preview synchronization 2024-07-10 12:57:06 -05:00
Austin Mroz 659ba661de Fix size scaling, Load Images preview, add 8bitpng
On Load Video, Size scaling had a major rewrite to support different
downscale ratios, but logic was flawed. This has been fixed

Image Sequence previews were broken by adding a framerate arg since the
input is a sequence file and not the images themself. This could be
added later by adding the speed information to the sequence file, but
has been removed for now since there isn't any infrastructure to set the
frame rate on the Load Images node itself

Added an 8bit-png output format. Lots of people seem to prefer
outputting image sequences. When the extra quality isn't required,
having a separate 8bit format allows for a significant speedup and less
disk space used.
2024-06-24 12:13:26 -05:00
Austin Mroz b70a173d5e Reduce console spam, ffmpeg_gif split filter
There were still intermittent errors and console spam from a transcoded
advanced preview being interrupted before it could finish.Connection
errors are also caught now.

ffmpeg does not appear to handle transparency as expected for gif
creation. Transparent areas will show the previous frame, or a portion
of it. A deep dive into trying to find configuration options to fix this
did not result in solutions that functioned on my machine, but did
introduce me to the ffmpeg split filter.

Split allows for a single ffmpeg execution to generate a palette and
utilize the palette for creating the output gif without requiring a temp
file. However, the video data must be buffered in memory by ffmpeg.
Quick testing seems to show that ffmpeg uses 4 bytes per pixel
of buffered frame data.

The ramifications for memory usage are nuanced, but wind up preferable.
The increased memory per pixel of ffmpeg's buffering only results in
(approximated) 3% memory increase over the whole workflow, but remove
the need for a tempfile, a second subprocess call, and allow for
imperfect Meta Batch support which can only extend the total frame count
by 5-6x. It's a reduction in moving parts for underwhelming memory
characteristics in both the best and worst case. Additionally, it likely
actually addresses the issue the original requester saw in #160

The actual code for allowing pre-passes is left in for now and will
likely be re-evaluated for other uses or pruned at a later time.

Actually bump version.
2024-06-07 00:38:34 -05:00
Austin Mroz 9d48b51a26 Merge branch for ffmpeg-gifs
While I have no repro on the reported issue for this branch, I feel
merging it is the best path forward for getting information and ensuring
the added functionality of the branch doesn't stagnate forever

Minor tweaks are made to wrangle input.
2024-05-29 04:10:39 -05:00
Austin Mroz f06d0fe0a5 Rework Gifski support
Gifski added support for input from pipes about a month ago, but I only
learned of this today.

The implementation was due for a rework, and brings numerous advantages:
- Gifski no longer needs to be compiled with ffmpeg support
- Gifski output now supports Meta Batches
- A temp file is no longer required
- The simplified intermediary format should increase performance/quality

This will require a recently updated version of gifski and there is not
currently code in place to notify the user of this.
2024-05-21 16:10:57 -05:00
Austin Mroz 0391ddfed3 Implement format templates, pre_pass, ffmpeg gifs
Adds supoort for an ffmpeg gif output.
Resolves #160

Adds support for a pre_pass field in video formats which can be used for
other advanced encoding formats

Adds support for string templates in format widgets

Known issues:
Gif output requires a complex filtergraph. This makes it incompatible
with the loop count setting. The error message for this is not the
clearest currently and will need further investigation.
2024-02-24 15:26:39 -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 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
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
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
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 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 e8e6971eaf Merge branch 'format_widgets' into develop 2023-11-29 20:43:25 -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 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
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
zhangsongbo d36f61ff46 upgrade the video formats. 2023-11-15 17:54:10 +08:00
Austin Mroz 9ed20235c3 Support ProRes as an output video_format 2023-11-03 12:12:59 -05:00
FizzleDorf b668935c45 exposed crf value for user input 2023-10-31 21:55:35 -04:00
Austin Mroz 7671c680ff Add additional video formats and config system
Allows for ffmpeg output settings to be set from a series of json config
files stored in video_formats. This allows for higher quality
output files with newer codecs (like av1), while still ensuring
compatibility with older ffmpeg versions

In addition to these changes, the logging of ffmpeg is better handled.
Error messages from ffmpeg itself are printed and logging from encoders
that was improperly filtered have been individually addressed.

While h265 has been included, most browsers will be unable to display
the resulting video.
2023-09-18 15:52:52 -05:00