📝 (docs): add detailed documentation for new video metadata append functionality and VHS VideoCombine compatibility ♻️ (nodes.py): refactor VideoMetadataNode to support appending metadata instead of overwriting, enhancing data preservation 🔧 (pyproject.toml): update version to 1.3.0 to reflect new features and improvements 📝 (VIDEO_METADATA_NODE.md): update documentation to reflect changes in input parameters and usage examples for new metadata handling 📝 (UPDATE_VIDEO_METADATA_APPEND_FUNCTIONALITY.md): add comprehensive guide for the new append functionality in video metadata processing 📝 (VHS_VIDEOCOMBINE_COMPATIBILITY_FIX.md): document the compatibility fix for VHS VideoCombine integration 📝 (VIDEO_METADATA_JSON_INTEGRATION.md): provide details on the integration of JSON metadata processing in VideoMetadataNode
8.8 KiB
VideoMetadataNode JSON Integration Update
Overview
The VideoMetadataNode has been updated to integrate with the new JSON output format from the LoRAInfoExtractor, replacing individual metadata inputs with structured JSON processing.
Changes Made
Removed Inputs
The following input fields have been removed from VideoMetadataNode:
- title: Individual title input field
- description: Individual description input field
- keywords: Individual keywords input field
- lora_name: Individual LoRA name input field
Added Input
- lora_json: (STRING) - LoRA JSON data from LoRAInfoExtractor containing structured LoRA metadata
Retained Inputs
The following inputs remain unchanged:
- filename: (STRING, forceInput) - Video filename input
- artist: (STRING) - Artist/Creator metadata
- comment: (STRING, multiline) - Additional comments metadata
- overwrite_original: (Yes/No) - File overwrite behavior
JSON Processing Logic
Automatic Metadata Generation
When lora_json input is provided, the node automatically generates metadata:
-
Title: Extracted from
combined_displayfield- Example: "LoRA1 + LoRA2"
-
Description: Generated from individual LoRA
infofields- Format: "LoRA Information:\n• Info1\n• Info2"
- Example: "LoRA Information:\n• CivitAI: LoRA1 by Creator1\n• Local: LoRA2 (strength: 0.8)"
-
Keywords: Created from LoRA
namefields- Format: "LoRA: Name1, Name2"
- Example: "LoRA: Realistic Vision, Custom Style"
-
Raw JSON: Complete JSON stored as
lora_jsoncustom metadata
Error Handling
- JSON Parse Errors: Falls back to treating input as simple string
- Missing Fields: Gracefully handles incomplete JSON structures
- Empty Data: Skips metadata generation for empty/invalid inputs
Workflow Integration
New Recommended Workflow
[LoRA Selector] → [LoRAInfoExtractor] → [Video Processing] → [VHS_VideoCombine] → [VideoMetadataNode]
↓ ↑
[lora_json] ──────────────────────────────────────────────────────┘
Connection Steps
- Connect LoRA selector (e.g., WanVideo Lora Select Multi) to LoRAInfoExtractor
- Connect
lora_jsonoutput from LoRAInfoExtractor to VideoMetadataNodelora_jsoninput - Connect video filename from VHS_VideoCombine to VideoMetadataNode
filenameinput - Optionally add
artistandcommentmetadata - Configure
overwrite_originalbehavior
Benefits
Structured Data Processing
- Rich Metadata: Comprehensive LoRA information in video metadata
- Automatic Generation: No manual input of title/description/keywords required
- Consistency: Standardized metadata format across videos
- Extensibility: Easy to add new metadata fields from JSON structure
Workflow Simplification
- Fewer Connections: Single JSON input instead of multiple string inputs
- Automatic Population: Metadata automatically derived from LoRA data
- Error Reduction: Less manual input reduces configuration errors
- Future-Proof: JSON structure allows for easy extension
Example Output Metadata
Video with Two LoRAs
Given JSON input:
{
"loras": [
{
"name": "Realistic Vision",
"info": "CivitAI: Realistic Vision (v5.1) by SomeCreator",
"strength": 1.0,
"has_civitai_data": true
},
{
"name": "CustomStyle",
"info": "Local: CustomStyle (strength: 0.8)",
"strength": 0.8,
"has_civitai_data": false
}
],
"count": 2,
"combined_display": "Realistic Vision + CustomStyle"
}
Generated metadata:
- title: "Realistic Vision + CustomStyle"
- description: "LoRA Information:\n• CivitAI: Realistic Vision (v5.1) by SomeCreator\n• Local: CustomStyle (strength: 0.8)"
- keywords: "LoRA: Realistic Vision, CustomStyle"
- lora_json: [Complete JSON string]
Migration Guide
For Existing Workflows
Old Structure (No Longer Supported):
[Manual Input] → title ────┐
[Manual Input] → description ──┤
[Manual Input] → keywords ──┤
[LoRA Name] → lora_name ──────┤
├─→ [VideoMetadataNode]
[Video File] → filename ──────┘
New Structure:
[LoRA Data] → [LoRAInfoExtractor] → lora_json ──┐
[Video File] → filename ─────────────────────────├─→ [VideoMetadataNode]
[Optional] → artist ─────────────────────────────┤
[Optional] → comment ────────────────────────────┘
Update Steps
- Remove Manual Inputs: Delete title, description, keywords, lora_name connections
- Add LoRAInfoExtractor: Connect LoRA selector to LoRAInfoExtractor
- Connect JSON: Connect
lora_jsonoutput to VideoMetadataNode - Test: Verify metadata generation works as expected
Technical Implementation
Method Signature Change
Before:
def add_metadata(self, filename, title="", description="", artist="", keywords="", comment="", lora_name="", overwrite_original="No"):
After:
def add_metadata(self, filename, artist="", comment="", lora_json="", overwrite_original="No"):
JSON Processing Code
# Process LoRA JSON metadata
if lora_json.strip():
try:
import json
lora_data = json.loads(lora_json)
# Extract title from combined_display
if 'combined_display' in lora_data and lora_data['combined_display']:
cmd.extend(['-metadata', f'title={lora_data["combined_display"]}'])
# Generate description and keywords from LoRA array
if 'loras' in lora_data and lora_data['loras']:
descriptions = []
keywords = []
for lora in lora_data['loras']:
if 'info' in lora and lora['info']:
descriptions.append(lora['info'])
if 'name' in lora and lora['name']:
keywords.append(lora['name'])
if descriptions:
description_text = '\n'.join([f'• {desc}' for desc in descriptions])
cmd.extend(['-metadata', f'description=LoRA Information:\n{description_text}'])
if keywords:
keywords_text = ', '.join(keywords)
cmd.extend(['-metadata', f'keywords=LoRA: {keywords_text}'])
# Store raw JSON for advanced use
cmd.extend(['-metadata', f'lora_json={lora_json.strip()}'])
except json.JSONDecodeError:
# Fallback to simple string storage
cmd.extend(['-metadata', f'lora={lora_json.strip()}'])
Testing
Validation Results
✅ Input Structure: All old inputs removed, lora_json input added
✅ JSON Processing: Correctly parses LoRA JSON and generates metadata
✅ Error Handling: Graceful fallback for invalid JSON
✅ Backward Compatibility: artist and comment inputs preserved
✅ Workflow Integration: Works seamlessly with LoRAInfoExtractor
Test Scenarios
- Valid JSON: Proper metadata generation
- Invalid JSON: Fallback to string storage
- Empty JSON: No metadata generated
- Partial JSON: Handles missing fields gracefully
- No JSON: Node works with only artist/comment inputs
Impact
Positive Changes
- Automation: Reduces manual metadata input
- Consistency: Standardized metadata format
- Rich Data: More comprehensive LoRA information
- Integration: Better workflow connectivity
- Maintenance: Easier to extend and modify
Breaking Changes
- Old Workflows: Existing workflows using title/description/keywords/lora_name inputs need updates
- Manual Control: Less granular control over individual metadata fields
- Dependencies: Now requires LoRAInfoExtractor for rich metadata
Future Enhancements
Potential Additions
- Custom Templates: Configurable metadata formatting
- Field Selection: Choose which JSON fields to include
- Merge Logic: Combine JSON metadata with manual inputs
- Validation: JSON schema validation for input
- Preview: Metadata preview before processing
Documentation Updates
- ✅ VIDEO_METADATA_NODE.md: Updated with new input structure
- ✅ JSON_OUTPUT_FORMAT.md: Documents LoRAInfoExtractor JSON format
- ✅ This Document: Comprehensive update documentation
- 🔄 Workflow Examples: Need update in other documentation files
- 🔄 Integration Guides: Update integration documentation