- Added executeAbAv1CrfSearch() function with synchronous execution
- Parses CRF and VMAF score from ab-av1 output
- 5-minute timeout for sample encodes
- Graceful fallback to configured CRF on errors
- Updates FFmpeg command with found CRF value
- Proper logging of ab-av1 results and errors
Major refactoring completed:
- Extracted 15+ focused helper functions from 500-line monolith
- Main plugin() function reduced from ~500 lines to ~150 lines
- Organized into logical sections: Constants, Predicates, Utilities, Analysis, Extraction, Command Building
- Zero behavior changes - all logic preserved exactly
- Improved maintainability, testability, and readability
New structure:
- categorizeStreams() - Stream analysis
- reorderStreamsByLanguage() - Language priority sorting
- analyzeSubtitleConversion() - Conversion detection
- processSubtitleExtraction() - Subtitle file extraction
- processCCExtraction() - CC handling with lock files
- buildFFmpegCommand() - Command construction
- buildCCExtractionCommand() - CC wrapper command
Benefits:
- Each function has single, clear responsibility
- Better error isolation and debugging
- Easier to understand and modify
- Prepared for future unit testing