A professional-grade, hardware-accelerated video optimization suite featuring state-of-the-art visual quality-targeted encoding. This release introduces absolute feature and engine parity across the Python CustomTkinter GUI, PowerShell WPF GUI, and PowerShell CLI/TUI, powered by an advanced two-stage seeking engine.
This release eliminates redundant VMAF probe encodes when the quality ladder steps down through multiple targets for the same file, delivering dramatic speed improvements on difficult-to-optimize files.
- In-Session Shared Probe Cache: When a file's VMAF search steps down through the quality ladder (e.g., Target 95 β 93 β 91 β ...), all CQβVMAF scores probed in earlier steps are shared with subsequent steps. Previously, boundary probes (CQ 1 and CQ 51) and overlapping search points were redundantly re-encoded on every ladder step β now they return instantly from the shared cache.
- Cross-Session Probe Persistence (Quick Test Mode): The persistent on-disk probe cache now works in Quick Test mode. Previously, probe results were discarded between runs for clip-based encodes because the cache key used the temporary clip path. Now it keys on the original file path, so VMAF probe results persist across tool sessions.
- Zero-Overhead Cache Hits: Shared cache lookups are O(1) hashtable reads with no disk I/O or FFmpeg invocations. On files that trigger multiple ladder fallbacks, this can save 60β120+ seconds per file.
- Single-Pass Reference Sample Cache: Moves VMAF reference sample extraction out of the inner search loop to a single-pass phase per file. Reference segments are extracted exactly once and shared across multiple targets in the VMAF ladder or fallback retries, dramatically reducing disk write overhead and processing duration.
- Logical Core Scaling: Replaces the conservative VMAF thread cap of 4 threads with a
Cores - 2thread allocation strategy, enabling high-core CPUs (e.g. 12, 16, 24 cores) to compute VMAF scores up to 5x faster by fully utilizing processor capability without locking up GUI/OS responsiveness. - HW-Accelerated Transcode Probing: Automatically applies hardware-accelerated decode flags (
-hwaccel) during VMAF quality probing to further reduce CPU bottlenecking on GPU-bound runs.
- Live FFmpeg Encoding Metrics: Real-time extraction of
Speed(e.g.,1.4x) andFPSvalues from the FFmpeg progress stream, computing a dynamic, real-timeETAprogress string next to the progress bar in both Python and WPF GUIs. - Dynamic WPF Row Color-Coding: File list rows in the WPF GUI are dynamically color-coded based on status (Green for Done, Cyan for In Progress, Gold for Quick Test Skips, and Red for Failures).
- Interactive CLI TUI Menu Upgrades: Re-structured menu layouts into sub-menus to solve vertical terminal space issues. Replaced selection text prefixes with a high-contrast reverse-color Cyan bar highlight. Blocked Left/Right arrow value modification on comma-separated list values to prevent overwrites.
- Traceable Logging: All intermediate Quick Test trial logs now explicitly include the original video filename instead of random temporary clip names, making log analysis clear and readable.
- Smart Fallback Handling: If all trials fail size verification in Quick Test mode, the status is set to
Skipped (Quick Test), and fail actions (quarantine, deletion) are safely bypassed to keep the original file untouched.
- Two-Stage Plateau-Aware Binary Search (PABS): Eliminates VMAF overshooting (e.g., defaulting to CQ 1 when intermediate values like CQ 16 yield the same VMAF). Maps unreachable high quality targets exactly to the source's visual ceiling.
- Directional Refinement Scan (Stage 2): Scans the tested quality history, finds the nearest similar CQ in the search direction, and executes a secondary binary search in the interval to perfectly locate the plateau "knee."
- Three-Point Plateau Detection: Analyzes probed CQ trends. If 3 probed CQs have VMAF scores within a
0.05tolerance, a visual quality plateau is detected, and the search immediately narrows boundaries to the highest efficient CQ on that plateau. - One-Time Reference Caching: Extracts reference sample segments exactly once before seeking. Probing loops reuse these segments, cutting Disk I/O overhead and accelerating the seek phase by up to 300%.
- Dynamic Multi-Threaded VMAF: System-aware logical core allocation (
libvmaf=n_threads=N) dynamically scales calculation speed based on system logical processor counts. - Defensive Thread Safety: Protects background thread execution streams via extensive
try/exceptandtry/catchfallbacks to completely eradicate NoneType unpacking crashes. - Robust Platform-Independent Storage: Automatically persists GUI settings inside a secure, home-directory path (
Path.home() / ".Video_Optimizer"), making configuration immune to varying launch paths.
- Full Hardware Accel Detection: Auto-detects NVIDIA NVENC, AMD AMF, and Intel QSV capabilities via a real-world, 1-frame dummy encode pass.
- GPU-Accelerated Pipeline: Injects
-hwaccelflags to ensure hardware-driven decoding AND encoding for maximum throughput. - NVIDIA Visual Tuning: Automatically injects
-spatial_aq 1 -aq-strength 8for superior visual fidelity on NVENC hardware. - Intelligent Audio Compatibility: Analyzes audio streams and automatically transcodes to high-quality AAC only if the original audio is incompatible with the target container.
- Windows 10/11
- FFmpeg (Must be in your system
PATH)- Download FFmpeg here
- Crucial: Build must include
libvmaffor advanced quality targeting.
- Python 3.10+ (The smart launcher handles virtual environment setup automatically)
- Launch: Double-click
Video Optimizer.batin the repository root. - Smart Startup: The batch launcher will automatically verify Python, compile/update the virtual environment, install requirements, and boot up the CustomTkinter GUI.
- Optimize: Configure your visual targets (or use the recommended VMAF 93), choose your encoder, and click START PRO OPTIMIZATION.
The suite provides 100% functional and performance parity for terminal and script-focused workflows under Windows.
- PowerShell WPF GUI (
Video-Optimizer-GUI.ps1): A modern, system-aware XAML graphical interface. Supports multi-pass stepping ladders, VMAF ceilings, and real-time intra-file progress bars. - PowerShell Interactive TUI (
Video-Optimizer.ps1): A robust keyboard-driven CLI menu (Arrow keys, Enter) for fast, headless configurations. - Interrupt Safety: Press 'S' to safely skip the current video or 'Q' to quit the entire session gracefully. Temporary segments are safely unlinked in a robust
finallyblock.
irm https://raw.githubusercontent.com/BishnuMahali/Video-Optimizer/main/Video-Optimizer.ps1 | iex- Run
Video-Optimizer-GUI.ps1(for GUI) orVideo-Optimizer.ps1(for CLI) in PowerShell. - Configure options and initiate optimization.
This project is licensed under the MIT License β see the LICENSE file for details.
Copyright (c) 2026 Bishnu Mahali
These projects are simple utility scripts built to solve everyday problems. If you find them helpful in your workflow and would like to support me, any small contribution is deeply appreciated! β€οΈ