2.4 KiB
2.4 KiB
VMAF Optimizer - Maintenance Guide
Project Goals
To automatically optimize a large video library (TV Shows & Content) on Windows using an AMD RX 9070 XT GPU. The goal is to reduce file size while maintaining "Visually Lossless" quality (VMAF 93+).
Core Strategy
- Hybrid Encoding:
- Encode: Use Hardware Acceleration (
av1_amf/hevc_amf) for speed (critical for 2TB+ library). - Verify: Use
ab-av1(software) strictly for VMAF score calculation.
- Encode: Use Hardware Acceleration (
- Safety Net:
- Extract a 60s sample.
- Encode sample with AV1 (QP 32).
- Calculate VMAF & Savings.
- Decision Logic:
- If VMAF > 97: Re-encode with higher QP (more compression) to save space.
- If VMAF < 93 or Savings < 12%: Fallback to HEVC.
- If HEVC fails: Keep original.
- Architecture:
smart_gpu_encoder.py: The "Engine". Handles logic, ffmpeg calls, VMAF checks. Can run standalone.smart_monitor.py: The "UI/Controller". Runs the engine in threads, displays a TUI (Rich), handles caching and directory scanning.
Current Status
- Working:
- Hardware detection (AMD/NVIDIA/Intel).
- VMAF calculation (fixed regex for raw number output).
- Optimization logic (Smart QP adjustment).
- Multithreading (4 workers).
- Caching (Instant startup on second run).
- Issues:
- UI Progress: The TUI shows "Action" but Progress/Speed columns are empty.
- Root Cause:
smart_gpu_encoder.pysends status updates likeEncoding AV1 (size=...)butsmart_monitor.pyexpects formatAction | Progress% | Speed.
- Root Cause:
- Logs: User reported logs might be hard to find or missing if permissions fail on
Z:.
- UI Progress: The TUI shows "Action" but Progress/Speed columns are empty.
Debugging Instructions
To run a simplified test without scanning the whole library:
- Create a folder
test_mediawith 1 small video file. - Run:
python smart_gpu_encoder.py --tv-dir ".\test_media" --content-dir ".\test_media" --jobs 1
Future Todos
- Fix TUI Parsing: Update
smart_gpu_encoder.pyto format strings asAction | Percent% | Speed. - Sonarr Integration: Add webhook triggers on success.
- Linux Support: Verify
av1_qsvorav1_vaapiflags for Linux/Docker deployments.
Key Files:
smart_gpu_encoder.py: Core logic.smart_monitor.py: TUI and Watchdog.library_cache.json: Cache of scanned files to speed up startup.