Add video metadata preservation and save_first_image option to VideoCombine #595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two new features to the VideoCombine node:
Changes
New Features
1. Metadata Preservation
Metadata Extraction: Added
get_video_metadata()function inutils.pythat extracts metadata from video files using ffmpeg=,;,#,\, newlines)LoadVideo Nodes Enhancement: All LoadVideo nodes now extract and return metadata
VHS_METADATAmetadatato all LoadVideo variants:LoadVideoUploadLoadVideoPathLoadVideoFFmpegUploadLoadVideoFFmpegPathVideoCombine Enhancement: VideoCombine now accepts optional video metadata input
video_metadata(type:VHS_METADATA)2. Save First Image Option
save_first_imageboolean parameter to VideoCombine (default:True){filename}_{counter:05}.pngOther Improvements
-movflags "+faststart+write_colr"to several video formats (h264-mp4, h265-mp4, nvenc variants) for better compatibility and faster streamingUse Cases
Metadata Preservation: This feature enables workflows where you want to:
This feature is particularly useful when you want to perform interpolation or other post-processing on generated videos at a later time while preserving the original workflow metadata.
Save First Image:
Example Workflow
The metadata flows from LoadVideo to VideoCombine, ensuring the output video contains the same workflow/prompt information as the input video. With
save_first_imageenabled (default), you also get a PNG that can be dragged directly into ComfyUI to load the workflow.Technical Details
Backward Compatibility
✅ Fully backward compatible:
video_metadatainput is optional and defaults to using current workflow metadata when not connectedsave_first_imageparameter defaults toTrue, maintaining the existing behavior of always saving the first frame as PNGsave_first_imagetoFalse