A command-line tool to upscale standard definition (SD) videos to high definition (HD) using the powerful Real-ESRGAN AI model.
- AI-Powered Upscaling: Utilizes the
RealESR_Gx4_fp16model to intelligently increase video resolution. - Simple CLI: Easy-to-use command-line interface for quick video processing.
- Efficient Processing: Uses
opencv-pythonfor frame-by-frame video manipulation andonnxruntimefor fast model inference.
- Python 3.8+
- Git
-
Clone the repository:
git clone https://github.com/your-username/HDGenerator.git cd HDGenerator -
Create and activate a virtual environment:
- On Windows:
python -m venv venv .\venv\Scripts\activate
- On macOS/Linux:
python3 -m venv venv source venv/bin/activate
- On Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Download the AI Model: You need to download the
RealESR_Gx4_fp16.onnxmodel.- Download Link: You can find the model on the ONNX Model Zoo on Hugging Face. Look for the
RealESR_Gx4_fp16.onnxfile. - Placement: Create a
modelsdirectory in the root of the project (if it doesn't exist) and place the downloaded.onnxfile inside it.
Your project structure should look like this:
HDGenerator/ βββ models/ β βββ RealESR_Gx4_fp16.onnx βββ src/ β βββ main.py β βββ upscaler.py βββ videos/ β βββ sample.mp4 βββ .gitignore βββ README.md βββ requirements.txt - Download Link: You can find the model on the ONNX Model Zoo on Hugging Face. Look for the
Run the script from the root directory of the project. For example, to upscale the sample video provided in the videos folder, use the following command:
python src/main.py --input "videos/sample.mp4"This will save the upscaled video in the videos directory with a _upscaled suffix.
--input(Required): The path to the SD video file you want to upscale.--output(Optional): The path where the upscaled HD video will be saved. If not provided, it will be saved in the same directory as the input file with an_upscaledsuffix.--model_path(Optional): The path to the.onnxmodel file. Defaults tomodels/RealESR_Gx4_fp16.onnx.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.