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.
- FFmpeg 9.0 Compatibility: Fixed an issue where NVENC encoding failed with
Unrecognized option 'spatial_aq'due to deprecated underscore aliases removed in FFmpeg 9.0. - Cache System Unicode Fix: Resolved a major issue on Windows where
Cache.jsonfailed to persist runs for paths containing non-ASCII characters (e.g., Russian, CJK). File encodings have been explicitly set to UTF-8 across both Python and PowerShell caching layers.
This release implements an advanced Multi-Run History Architecture to the cache system alongside a massive Quality-of-Life UI UX Refactor across all GUI engines.
- Multi-Run Cache Dictionaries: The persistent
Cache.jsonsystem now groups historical outcomes by their exactSettingsKey. You can seamlessly flip back and forth between different combinations (like VMAF Mode and Hard CQ Mode) on the same file without overwriting your cache history. The engine instantly remembers previous failures/successes for every specific configuration! - Zero-Friction UI: The redundant 'Enable Cache' and 'Enable Resume' checkboxes have been consolidated into a single predictable
Enable Cache & Resumesetting. - Icon-Driven Granular Purges: Added native
ποΈ(Delete) andποΈ(View) interaction icons next to the session options, letting you instantly clear out old cache configurations or pop open the current session's log file without digging through directories. - Global Factory Reset: Added a subtle "Clear Cache & Data" master button that safely wipes the entire working directory out of existence in one click.
- Aesthetic Directory Renaming: Rebranded the somewhat glitchy-looking
.Video Optimizerhidden directory to a much cleaner__Video-Optimizer__prefix which automatically sorts to the top of your folders. - Unified Transparent Video Handling: Replaced disjointed alpha-channel checkboxes with a clean 4-state intelligent menu across all engines. Effortlessly select between preserving transparency via lossless VP9 (
.webm) or ProRes 4444 (.mov), safely skipping the files entirely, or forcefully flattening them to standard backgrounds to maximize space savings.
- 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! β€οΈ