π HD Video Generator is an open-source, lightweight, and high-performance command-line (CLI) tool to upscale Standard Definition (SD) videos to High Definition (HD/4K) using state-of-the-art Real-ESRGAN deep learning super-resolution models with ONNX Runtime and OpenCV.
- π Overview
- β¨ Key Features
- π·οΈ Keywords & Tags
- π Prerequisites
- βοΈ Setup & Installation
- π§ Model Download
- π Project Structure
- π Usage & CLI Examples
- π¬ Supported Formats & Capabilities
- β Troubleshooting & FAQ
- π€ Contributing
- β Star History
- π License
Are your vintage home videos, old animations, or low-resolution clips blurry and pixelated? π½οΈ HD Video Generator uses cutting-edge artificial intelligence and computer vision to restore, enhance, and upscale video frames to crystal-clear high definition. Powered by the optimized RealESR_Gx4_fp16 ONNX model, it delivers 4x spatial resolution improvements with sharp edges, rich colors, and reduced compression artifacts. π¨β¨
- π€ AI-Powered 4x Video Upscaling: Harnesses the deep learning power of Real-ESRGAN (
RealESR_Gx4_fp16) to reconstruct fine textures and realistic details. - β‘ High-Performance ONNX Inference: Utilizes
onnxruntimefor blazing-fast, cross-platform, hardware-accelerated model execution. - π₯ Robust Frame Processing: Leverages
opencv-pythonfor accurate frame-by-frame decoding, high-quality transformation, and seamless re-encoding. - π» Intuitive CLI Interface: Simple, developer-friendly command-line options with smart default output handling.
- π 100% Local & Privacy-Friendly: All video processing runs locally on your machineβno cloud uploads, subscriptions, or API rate limits! π‘οΈ
- π¦ Lightweight & Extensible: Minimal dependencies and modular code structure for easy customization and pipeline integration. π§©
video-upscaling Β· real-esrgan Β· super-resolution Β· ai-video-enhancer Β· onnxruntime Β· opencv Β· python Β· sd-to-hd Β· video-enhancement Β· deep-learning Β· computer-vision Β· image-restoration Β· video-processing
- π Python: Version 3.8 or higher
- π Git: For cloning the repository
- π» OS: Windows, macOS, or Linux
git clone https://github.com/ishandutta2007/HDGenerator.git
cd HDGenerator-
Windows (PowerShell / Command Prompt): πͺ
python -m venv venv .\venv\Scripts\activate -
macOS / Linux: ππ§
python3 -m venv venv source venv/bin/activate
pip install -r requirements.txtThis project requires the Real-ESRGAN ONNX model weights (RealESR_Gx4_fp16.onnx):
- π₯ Download
RealESR_Gx4_fp16.onnxdirectly from the ONNX Model Zoo on Hugging Face (ai-forever/Real-ESRGAN). - π Create a
models/directory in the project root (if not already present):mkdir models
- πΎ Place
RealESR_Gx4_fp16.onnxinside themodels/folder.
HDGenerator/
βββ assets/
β βββ banner.svg # Dynamic SVG header banner
β βββ social-preview.gif # Social preview animated GIF (640x320)
βββ models/
β βββ RealESR_Gx4_fp16.onnx # ONNX super-resolution model weights
βββ src/
β βββ main.py # CLI entry point & argument parser
β βββ upscaler.py # Video decoding, inference, & encoding pipeline
βββ videos/
β βββ sample.mp4 # Sample input / demo video
βββ .gitignore
βββ README.md
βββ requirements.txt
Run the pipeline from the project root directory using Python:
Upscale a video using default output naming (<original_name>_upscaled.mp4):
python src/main.py --input "videos/sample.mp4"Specify an exact path for the enhanced video output:
python src/main.py --input "videos/sample.mp4" --output "videos/sample_4k_enhanced.mp4"Specify a different ONNX model variant if needed:
python src/main.py --input "videos/sample.mp4" --model_path "models/RealESR_Gx4_fp16.onnx"| Argument | Type | Default | Description |
|---|---|---|---|
--input |
str |
(Required) | Filepath to the input SD video to upscale. |
--output |
str |
<input_dir>/<name>_upscaled.mp4 |
Destination filepath for the upscaled HD video. |
--model_path |
str |
models/RealESR_Gx4_fp16.onnx |
Filepath to the .onnx super-resolution model. |
- πΉ Input Formats: MP4, AVI, MOV, MKV, and other standard formats supported by OpenCV.
- π Upscaling Factor: 4x spatial scaling (e.g., 480p SD
$\rightarrow$ 1080p/4K HD). - π Execution Providers: CPU and GPU (CUDA/DirectML) inference via
onnxruntime/onnxruntime-gpu.
β‘ Q: How do I enable GPU acceleration with ONNX Runtime?
To use NVIDIA CUDA acceleration, install
onnxruntime-gpu instead of standard onnxruntime:
pip uninstall onnxruntime
pip install onnxruntime-gpuEnsure compatible CUDA and cuDNN libraries are configured on your system.
π¦ Q: Where can I find more Real-ESRGAN ONNX weights?
Alternative checkpoints and specialized anime/photo enhancement models can be downloaded from Hugging Face or converted from PyTorch weights to ONNX format.
Contributions, issues, and feature requests are welcome! π
- π΄ Fork the repository
- πΏ Create your feature branch (
git checkout -b feature/AmazingFeature) - πΎ Commit your changes (
git commit -m 'feat: Add AmazingFeature') - π€ Push to the branch (
git push origin feature/AmazingFeature) - π Open a Pull Request
Distributed under the MIT License. See LICENSE for more information. βοΈ