b1d7630a10ff61f751bd86d9443e8fe898057ac3
VMAF Optimiser
Intelligent Video Library Optimization Pipeline
Automatically optimizes your video library (Movies/TV) by finding the best compression (AV1/HEVC) that maintains a high visual quality target (VMAF 93+).
Features
- Hybrid Encoding:
- Uses Hardware Acceleration (NVIDIA NVENC, AMD AMF, Intel QSV, Apple VideoToolbox) for fast encoding.
- Uses Software Encoding (CPU) as a robust fallback.
- VMAF Targeted: Ensures visual quality matches the original (Target VMAF 93+).
- Multi-Platform: Runs on Windows, Linux, and macOS.
- Distributed Processing: Run multiple workers across multiple PCs sharing the same network library.
- Safety First:
- Locks files to prevent double-processing.
- Verifies output size and integrity before replacing.
- "Smart Resume" - skips already processed files.
Directory Structure
VMAFOptimiser/
├── bin/ # Place ab-av1.exe here (or install to PATH)
├── logs/ # Local logs (processed, rejected, stats)
├── locks/ # Local lock files (if network not available)
├── src/
│ ├── smart_gpu_encoder.py # Main encoder engine
│ ├── smart_monitor.py # TUI Dashboard (Watchdog)
│ ├── vmaf_common.py # Shared logic
│ └── smart_encoder.py # Legacy CPU-only engine
├── run.ps1 # Windows One-Click Start
└── README.md
Setup & Installation
1. Requirements
- Python 3.10+
- FFmpeg (with libsvtav1/libx265 and HW drivers)
- Windows:
choco install ffmpeg - macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpeg
- Windows:
- ab-av1 (VMAF calculator)
- Download from GitHub and place in
bin/OR install viacargo install ab-av1
- Download from GitHub and place in
2. Install Python Deps
pip install watchdog rich
3. Usage
Interactive Dashboard (Recommended)
Monitors directories and shows a TUI with progress bars.
python src/smart_monitor.py --tv-dir "Z:\tv" --content-dir "Z:\content" --jobs 2
Headless / Background (Cron/Task Scheduler)
Runs once through the library and exits.
python src/smart_gpu_encoder.py --tv-dir "Z:\tv" --content-dir "Z:\content" --jobs 4
Multi-PC Setup
To speed up processing, you can run this script on multiple computers simultaneously pointing to the same NAS/Network Share.
- Map Network Drive: Ensure
Z:\(or whatever path) is mapped on ALL computers. - Shared Locks: The script automatically attempts to create a
.vmaf_locksfolder in the parent directory of your TV folder (e.g.,Z:\.vmaf_locks). - Run: Start the script on PC 1, PC 2, etc. They will respect each other's locks and not process the same file.
Note: Logs are stored LOCALLY on each PC in the logs/ folder to prevent network file contention.
Advanced Options
| Flag | Description |
|---|---|
--jobs N |
Number of parallel encoders (Default: 2) |
--tv-only |
Scan only TV Shows |
--content-only |
Scan only Movies |
--skip-until "Name" |
Skip files until this keyword is found (good for resuming) |
--debug |
Enable verbose logging |
Credits
- Powered by
ab-av1for VMAF calculation. - Uses
ffmpegfor heavy lifting.
Description
Find best params and try and optimise to VMAF to target at least 12-15% reduction in storage if not more
Languages
Python
82.2%
PowerShell
11.5%
Shell
6.3%