A practical video restoration AI model for real-world scenarios, capable of enhancing and repairing video quality.
Real-ESRGAN (Real-World Enhanced Super-Resolution Generative Adversarial Network) is an open-source AI-powered tool designed for general image and video restoration, with a particular focus on upscaling content affected by complex real-world degradations. Developed by Xintao Wang and collaborators (often associated with Tencent ARC Lab), Real-ESRGAN builds upon the powerful ESRGAN architecture to deliver practical and high-quality super-resolution. Unlike many earlier methods trained on synthetic degradations (like simple bicubic downsampling), Real-ESRGAN is specifically trained with a more complex degradation modeling process to better handle the blur, noise, compression artifacts, and other issues commonly found in real-world low-resolution images and videos.
The project, available on GitHub, provides pre-trained models and code, making advanced AI super-resolution accessible to developers, researchers, content creators, and anyone looking to enhance the quality and resolution of their visual media.
Real-ESRGAN offers a robust set of features for image and video upscaling:
RealESRGAN_x4plus
): For upscaling general photographic images.RealESRGAN_x4plus_anime_6B
, realesr-animevideov3
): Optimized for upscaling anime, cartoons, and manga-style illustrations, preserving sharp lines and vibrant colors. These are often smaller and faster.ffmpeg
for extracting frames from a video and merging upscaled frames back into a video, optionally copying the original audio.-s
), and potentially control output format or face enhancement.Real-ESRGAN is widely used for a variety of image and video enhancement tasks:
There are several ways to use Real-ESRGAN, catering to different user needs:
Using Pre-compiled Executables (Easiest for Non-Developers):
realesrgan-ncnn-vulkan.exe
) are generally recommended for broad GPU compatibility and speed.cd
) to the folder where you extracted Real-ESRGAN.# For Windows (example)
./realesrgan-ncnn-vulkan.exe -i path/to/your/input_image.jpg -o path/to/your/output_image.png -n model_name -s scale_factor
# For Linux/macOS (example)
./realesrgan-ncnn-vulkan -i path/to/your/input_image.jpg -o path/to/your/output_image.png -n model_name -s scale_factor
-i <input_path>
: Path to your low-resolution image or folder of images.-o <output_path>
: Path to save the upscaled image or folder for upscaled images.-n <model_name>
: Specify the pre-trained model to use (e.g., realesrgan-x4plus
, realesrgan-x4plus-anime
, realesr-animevideov3
). Model .param
and .bin
files for NCNN are usually included with the executables.-s <scale_factor>
: The upscaling factor (e.g., 2
for 2x, 4
for 4x). The chosen model usually implies a default scale (e.g., x4 models).-f <format>
: Output image format (e.g., png
, jpg
, webp
).--face_enhance
: To enable face enhancement (may require additional models or be built into certain executables).--tile <tile_size>
: To process the image in tiles (e.g., --tile 256
) to save VRAM.--outscale <float>
: If you want to achieve a final scale different from the model's native scale by combining model upscaling with traditional resizing (e.g., using a 4x model but outputting at 2x overall with --outscale 0.5
).Using Python Scripts (For Developers & Customization):
git clone [https://github.com/xinntao/Real-ESRGAN.git](https://github.com/xinntao/Real-ESRGAN.git)
cd Real-ESRGAN
pip install basicsr facexlib gfpgan
pip install -r requirements.txt
python setup.py develop
.pth
model files from the links provided in the GitHub README or model zoo (e.g., for RealESRGAN_x4plus.pth
, RealESRGAN_x4plus_anime_6B.pth
). Place them in a weights
or experiments/pretrained_models
directory.inference_realesrgan.py
script.
python inference_realesrgan.py -n RealESRGAN_x4plus -i path/to/input_image.jpg -o results --outscale 4 --face_enhance
-n <model_name>
: Name of the model (e.g., RealESRGAN_x4plus
).-i <input_path>
: Input image/folder.-o <output_folder>
: Output folder.--outscale <float>
: The final upsampling scale.--face_enhance
: Enable face enhancement using GFPGAN.--tile <int>
: Tile size for out-of-memory (OOM) issues.--half
: Use FP16/half-precision for faster inference on compatible GPUs.Video Upscaling:
ffmpeg
.ffmpeg
, often copying the audio from the original video.docs/anime_video_model.md
).Real-ESRGAN provides several pre-trained models tailored for different needs:
RealESRGAN_x4plus
: A general-purpose model for 4x upscaling of real-world photos.RealESRGAN_x2plus
: A general-purpose model for 2x upscaling.RealESRGAN_x4plus_anime_6B
: A smaller and faster 4x model specifically optimized for anime and cartoon images.realesr-animevideov3
: A model designed for upscaling anime video frames, often used with the NCNN implementation.The Real-ESRGAN project is typically released under a permissive open-source license. The primary codebase on xinntao/Real-ESRGAN
often uses the BSD 3-Clause "New" or "Revised" License. Some components or specific model weights might have slightly different permissive licenses (e.g., models from other authors hosted on OpenModelDB). The NCNN version also generally follows permissive licensing.
This means the software can generally be used for commercial purposes, with conditions like retaining copyright notices. However, users should always check the specific LICENSE
file in the version they download.
Q1: What is Real-ESRGAN? A1: Real-ESRGAN is an AI-powered super-resolution tool designed to upscale and enhance images and videos, particularly those affected by real-world degradations like blur, noise, and compression artifacts. It's an improvement over the original ESRGAN.
Q2: How is Real-ESRGAN different from ESRGAN or other upscalers? A2: Real-ESRGAN is specifically trained using a more complex degradation process to better simulate real-world image issues, making it more effective for general photo and video restoration compared to ESRGAN, which was often trained on simpler bicubic downscaling. It aims for more practical and visually pleasing results on a wider variety of inputs.
Q3: Is Real-ESRGAN free to use? A3: Yes, Real-ESRGAN is an open-source project. The code, pre-trained models, and pre-compiled executables provided by the authors are free to download and use under the terms of their license (typically BSD 3-Clause).
Q4: Do I need a powerful GPU to use Real-ESRGAN? A4: While CPU-only mode is possible for the Python version (but very slow), a GPU is highly recommended for practical use. The RealESRGAN-ncnn-vulkan executables leverage Vulkan for GPU acceleration and can run on a wide range of modern GPUs (NVIDIA, AMD, Intel). VRAM requirements depend on the image size and scale factor.
Q5: What types of images work best with Real-ESRGAN?
A5: Real-ESRGAN has general models (RealESRGAN_x4plus
) that work well on a variety of real-world photos. It also offers specialized models like RealESRGAN_x4plus_anime_6B
which are highly effective for upscaling anime, cartoons, and similar illustrative styles.
Q6: Can Real-ESRGAN upscale videos?
A6: Yes, Real-ESRGAN can be used to upscale videos. This typically involves extracting all frames from the video, upscaling each frame individually using a suitable Real-ESRGAN model (e.g., realesr-animevideov3
for anime videos), and then merging the upscaled frames back into a video, usually with the original audio track. Scripts and guides for this process are available.
Q7: What are the realesrgan-ncnn-vulkan
executables?
A7: These are pre-compiled versions of Real-ESRGAN that use the NCNN deep learning inference framework and Vulkan for cross-platform GPU acceleration. They are often the easiest way for non-programmers to use Real-ESRGAN quickly on Windows, Linux, or macOS with a compatible GPU, without needing to set up a Python environment.
Q8: Can I use Real-ESRGAN for commercial projects? A8: The BSD 3-Clause license, under which Real-ESRGAN is commonly distributed, is a permissive license that allows for commercial use, modification, and distribution, provided the license conditions (like retaining copyright notices) are met.
Here are examples of helpful resources for learning and using Real-ESRGAN:
realesrgan-ncnn-vulkan
versions)Last updated: May 26, 2025