Studio-Reference VHS Restoration Pipeline
Automated deinterlacing and audio synchronization tool for modernizing VHS captures.
flowchart TD
%% Styling
classDef input fill:#DAE2F9,stroke:#3F5F91,stroke-width:1px,color:#001B3E,rx:10,ry:10;
classDef process fill:#DCE5DD,stroke:#526350,stroke-width:1px,color:#101E10,rx:5,ry:5;
classDef output fill:#E1E2E6,stroke:#44474E,stroke-width:1.5px,color:#1A1C1E,rx:10,ry:10;
Input([📼 VHS Capture]):::input
subgraph Step1 ["Step 1: Setup & Analysis"]
direction TB
Gen[Script Gen] --> Check[Pre-Flight Info Check]
Check --> Drift{"Calc Drift"}
end
subgraph Step2 ["Step 2: Processing"]
direction TB
Render[VSPipe Render] -->|Pipe| Encode["Encode + Sync + Mux"]:::process
end
Output([💾 Restored Master]):::output
Input --> Step1
Step1 --> Step2
Step2 --> Output
This tool automatically detects high-end hardware (e.g., RTX 5090, Ryzen 9950X3D) to enable ULTRA profiles:
- CPU: Automatically scales threads to match your core count (e.g., 32 threads for FFmpeg & VapourSynth).
- RAM: Automatically adjusts cache based on available memory (e.g., 35% for 32GB systems, 50% for 64GB+ systems).
- Install (Once):
- Right-click
install.ps1-> "Run with PowerShell". - This creates a local, self-contained Python environment.
- Right-click
- Run:
- Drag & Drop your video file (or folder) onto
start.bat. - Or double-click
start.batand drop files into the window.
- Drag & Drop your video file (or folder) onto
- Config:
- Edit
config.yamlto change betweenprores/av1or tweak hardware settings.
- Edit
- Windows (tested on Windows 11)
Capturing VHS is messy.
- Deinterlacing is hard: Standard FFmpeg filters (yadif/bwdif) lose half the temporal resolution or jaggy edges.
- Audio Sync Drift: VHS captures often report 30.00fps vs 29.97fps, causing audio to drift seconds apart by the end of the tape.
This tool solves both automatically.
- Studio Reference Reliability: Built on a self-contained, portable Python environment ensuring zero dependency conflicts.
- Archival Grade QTGMC: Uses
Preset="Very Slow"withSourceMatch=3andLossless=2. Defaults to pure deinterlacing (no denoising/sharpening), but configurable inconfig.yaml. - Smart-Drift Correction: Enabled by default. Uses adaptive thresholding (absolute 10ms + relative 1.5%) to distinguish between true clock skew and container metadata jitter.
- Lossless Audio Workflow: Configurable support for PCM (24-bit) alongside AAC and FLAC, ensuring archival-grade, bit-perfect audio preservation.
- ISO 8601 Logging: Comprehensive audit logs with millisecond-precision timestamps and timezone offsets.
- Real-Time Progress: Visual progress bars with ETA (Estimated Time Left), current timestamp, and rendering speed.
- Zero-Loss Pipeline: Pipes raw YUV422P10LE video data directly from VapourSynth to FFmpeg.
- Windows 10/11
- Internet Connection (For first-time setup only)
- Python 3.10+
- 90% Code Coverage: Mandatory for all contributions. Enforced via CI/CD.
- pytest: Run
run_tests.ps1to verify changes locally before pushing.
-
Install (One-Time Setup):
- Right-click
install.ps1and select "Run with PowerShell". - This script will:
- Create a secluded
.venvenvironment. - Download and configure a portable VapourSynth R73 build.
- Install all required QTGMC plugins automatically via
vsrepo. - Generate a
start.batlauncher.
- Create a secluded
- Right-click
-
Run:
- Method A: Drag & Drop your video file (or folder of videos) directly onto
start.bat. - Method B: Double-click
start.batand drop files into the interactive window.
- Method A: Drag & Drop your video file (or folder of videos) directly onto
-
Processing:
- The tool will initialize, verify hardware, and begin batch processing.
- Outputs are saved in the same folder as the source file with a
_deinterlacedsuffix.
The script generates a VapourSynth script (.vpy) on the fly with defensive plugin loading.
- Ingest: Loads video via FFMS2 (robust indexing).
- Processing: Applies QTGMC (Placebo/Archival settings).
- Single-Pass Processing:
- Efficiency: Pipes video directly from VapourSynth to FFmpeg (
Pipe -> Encode). - Sync: Calculates audio drift before encoding begins. Applies
atempofilters dynamically during the single pass. - Encoding:
- ProRes: Encodes to ProRes 422 HQ (10-bit) for archival.
- AV1: Optional high-efficiency encoding (configurable).
- Efficiency: Pipes video directly from VapourSynth to FFmpeg (
MIT