Automate video upscaling with Real-ESRGAN & FFmpeg – extract, enhance, and merge frames in one simple script.
This is a fork of https://github.com/greatbody/Video-ESRGAN?tab=MIT-1-ov-file, I just added some features that the creator of that project developed.
You need to download the realesrgan-ncnn-vulkan executable from the official Real-ESRGAN repository:
Download Link: https://github.com/xinntao/Real-ESRGAN/releases
- Go to the Real-ESRGAN releases page. For now V0.2.5.0 has final releases, unless you build it yourself.
- Download the appropriate version for your operating system:
- Windows
- macOS
- Linux
- Extract the downloaded archive
- Place the
realesrgan-ncnn-vulkanexecutable and themodelsdirectory in the same directory as theenlargescript.
For more information about Real-ESRGAN, visit the official repository.
FFmpeg is required for video processing (extracting frames, merging frames back to video).
- Download from FFmpeg official website
- Or install via package manager:
# Using Chocolatey choco install ffmpeg # Using Scoop scoop install ffmpeg
# Using Homebrew
brew install ffmpeg
# Using MacPorts
sudo port install ffmpeg# Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg
# CentOS/RHEL/Fedora
sudo yum install ffmpeg
# or
sudo dnf install ffmpeg
# Arch Linux
sudo pacman -S ffmpegAfter installation, verify that both tools are available:
ffmpeg -version
./realesrgan-ncnn-vulkan -hTo enhance a video, simply run the enlarge script with your input video file, if realesrgan-ncnn-vulkan exists in the same directory:
./enlarge input_video.mp4Otherwise:
./enlarge -p /path/to/file/realesrgan-ncnn-vulkan input_video.mp4- Extracts frames from your input video using FFmpeg
- Enhances each frame using Real-ESRGAN with the
realesr-animevideov3model (2x upscaling) - Merges enhanced frames back into a new video while preserving the original audio
The script generates:
- Enhanced video:
input_video_enhanced.mp4- Your upscaled video - Temporary folders:
tmp_frames_YYYYMMDD_HHMMSS/- Original extracted framesout_frames_YYYYMMDD_HHMMSS/- Enhanced frames
- ✅ Progress tracking with real-time progress bar
- ✅ Automatic framerate detection from source video
- ✅ Audio preservation - copies original audio to enhanced video
- ✅ Subtitles preservation - copies original subtitles to enhanced video
- ✅ Unique timestamped outputs - prevents file conflicts
- ✅ Automatic detection of threads - Making ffmpeg using multiple threads (on auto)
# Make the script executable (first time only)
chmod +x enlarge
# Enhance a video
./enlarge my_video.mp4
# or
./enlarge my_video.mkv
# Output will be something like:
# enhanced_20241224_143052.mp4- The script uses the
realesr-animevideov3model which works well for anime/cartoon content - Processing time depends on video length, resolution, and your hardware
- You can safely delete the temporary frame folders after processing
- For best results, ensure your input video has good quality (not heavily compressed)