- ab-av1 requires ffmpeg/ffprobe to be in PATH (no CLI args/env vars for custom paths)
- Create temporary wrapper scripts that call tdarr-ffmpeg
- Add temp directory to PATH when executing ab-av1
- Clean up wrappers in finally block
- No permanent symlinks or system modifications needed
- Use FFMPEG and FFPROBE environment variables instead of --ffmpeg/--ffprobe flags
- Older ab-av1 versions don't support those command-line arguments
- Sets env vars to point to tdarr-ffmpeg when executing ab-av1
- ab-av1 now uses --ffmpeg and --ffprobe flags to locate tdarr-ffmpeg
- No symlinks needed - uses existing Tdarr binaries
- tdarr-ffmpeg acts as both ffmpeg and ffprobe (multi-call binary)
- Fixed: Binary exists but X_OK check fails on Docker mounts
- Added: 'which ab-av1' fallback detection
- Added: Better debug logging when X_OK check fails
- Binary will now be found even with permission issues
- 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