- Create shared/media/format_utils.py with format detection and validation - Create shared/media/video_encoder.py with FFmpegEncoder and PILEncoder classes - Extract validate_video_for_discord to shared utility - Extract ffmpeg detection to shared detect_ffmpeg() function - Extract Discord video optimization to shared optimize_video_for_discord() - Remove duplicate code from video_node.py (-109 lines) Phase 3 summary: - video_node.py: 1201 -> 1092 lines (9% reduction this phase) - Total reduction from original: 1562 -> 1092 lines (30% reduction) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
850 B
Python
41 lines
850 B
Python
"""
|
|
Media Processing Utilities
|
|
|
|
Provides image and video processing functions.
|
|
"""
|
|
|
|
from .image_processing import tensor_to_numpy_uint8
|
|
from .format_utils import (
|
|
parse_format_string,
|
|
normalize_video_extension,
|
|
get_mime_type,
|
|
validate_video_for_discord,
|
|
is_animated_format,
|
|
supports_alpha
|
|
)
|
|
from .video_encoder import (
|
|
detect_ffmpeg,
|
|
FFmpegEncoder,
|
|
PILEncoder,
|
|
optimize_video_for_discord,
|
|
mux_audio_to_video
|
|
)
|
|
|
|
__all__ = [
|
|
# Image processing
|
|
'tensor_to_numpy_uint8',
|
|
# Format utilities
|
|
'parse_format_string',
|
|
'normalize_video_extension',
|
|
'get_mime_type',
|
|
'validate_video_for_discord',
|
|
'is_animated_format',
|
|
'supports_alpha',
|
|
# Video encoding
|
|
'detect_ffmpeg',
|
|
'FFmpegEncoder',
|
|
'PILEncoder',
|
|
'optimize_video_for_discord',
|
|
'mux_audio_to_video',
|
|
]
|